Skip to content
Stable Diffusion API

SDXL

SDXL

Generate 1024px images with Stable Diffusion XL (SDXL) through a REST API. model_id "sdxl", cURL, Python and Node examples.

SDXL sample image

Generate with SDXL via API

Send a POST request to https://stablediffusionapi.com/api/v6/images/text2img with your API key. Get yours at modelslab.com.

curl -X POST 'https://stablediffusionapi.com/api/v6/images/text2img' \
  -H 'Content-Type: application/json' \
  -d '{
  "key": "YOUR_API_KEY",
  "model_id": "sdxl",
  "prompt": "a cinematic photo of a lighthouse in a storm",
  "width": 1024,
  "height": 1024,
  "samples": 1
}'

Also searched as

SDXL is also known as: SDXL, sdxl. Use it for sdxl generation, available via the Stable Diffusion API REST API at https://stablediffusionapi.com/api/v6/images/text2img.

FAQ — SDXL

How do I use SDXL via API?
Send a POST request to https://stablediffusionapi.com/api/v6/images/text2img with your API key, prompt, and model_id "sdxl". Get an API key from modelslab.com.
Is SDXL free to use?
No. API access requires a paid ModelsLab plan, starting at $21/month (Basic, 3,250 API calls). The $149/month Open Source Unlimited plan includes unlimited generations on open-source models; third-party models are billed separately.
What parameters does SDXL support?
SDXL takes your API key plus: model_id, prompt, width, height, samples. The code sample on this page shows a complete request.
Can I use generated images commercially?
Yes. You retain copyright on all images you generate via the API and can use them commercially.