# SDXL API

> Provider: **Stability AI**
> Source: https://www.pixazo.ai/models/sdxl

SDXL API by Stability AI.

## SDXL Base 1.0

### Text to Image

## Get Image - Stable Diffusion XL Base 1.0 API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/getImage/v1/getSDXLImage
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
  "negative_prompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
  "height": 1024,
  "width": 1024,
  "num_steps": 20,
  "guidance_scale": 5,
  "seed": 40
}
```

```
import requests

url = "https://gateway.pixazo.ai/getImage/v1/getSDXLImage"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
    "negative_prompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance_scale": 5,
    "seed": 40
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
```

```
const url = 'https://gateway.pixazo.ai/getImage/v1/getSDXLImage';
const headers = {
  'Content-Type': 'application/json',
  'Cache-Control': 'no-cache',
  'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
};

const data = {
  prompt: 'High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.',
  negative_prompt: 'Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.',
  height: 1024,
  width: 1024,
  num_steps: 20,
  guidance_scale: 5,
  seed: 40
};

fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```
curl -v -X POST "https://gateway.pixazo.ai/getImage/v1/getSDXLImage" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
    "negative_prompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance_scale": 5,
    "seed": 40
  }'
```

## Output

```
{
  "imageUrl": ""
}
```

[Try Now](https://api.pixazo.ai/api-details#api=stable-diffusion-xl-base-10&operation=get-image)

## Request Parameters - Get Image

Parameter

Required

Type

Description

prompt

Yes

String

The main instruction for the image generation

negative\_prompt

No

String

A prompt to specify what should be avoided in the image

height

No

Integer

The height of the output image (e.g., 1024)

width

No

Integer

The width of the output image (e.g., 1024)

num\_steps

No

Integer

The number of steps for the generation process (e.g., 20)

guidance\_scale

No

Integer

The guidance scale for the generation (e.g., 5)

seed

No

Integer

The seed value for random number generation to ensure reproducibility

## Example Request

```
{
  "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
  "negative_prompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
  "height": 1024,
  "width": 1024,
  "num_steps": 20,
  "guidance_scale": 5,
  "seed": 40
}
```

## Response

```
{
  "imageUrl": ""
}
```

## Request Headers

Header

Value

Content-Type

application/json

Cache-Control

no-cache

Ocp-Apim-Subscription-Key

YOUR\_SUBSCRIPTION\_KEY

## Response Handling

Common status codes for Get Image.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

## SDXL Lightning

### Text to Image

## Get Image - Stable Diffusion XL Lightning API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/sdxl_lightning/getImage/v1/getSDXLImage
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
  "negativePrompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
  "height": 1024,
  "width": 1024,
  "num_steps": 20,
  "guidance": 5,
  "seed": 42
}
```

```
import requests

url = "https://gateway.pixazo.ai/sdxl_lightning/getImage/v1/getSDXLImage"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
    "negativePrompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance": 5,
    "seed": 42
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
```

```
fetch('https://gateway.pixazo.ai/sdxl_lightning/getImage/v1/getSDXLImage', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
  },
  body: JSON.stringify({
    prompt: "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
    negativePrompt: "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    height: 1024,
    width: 1024,
    num_steps: 20,
    guidance: 5,
    seed: 42
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```
curl -v -X POST "https://gateway.pixazo.ai/sdxl_lightning/getImage/v1/getSDXLImage" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
    "negativePrompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance": 5,
    "seed": 42
  }'
```

## Output

```
{
  "imageUrl": ""
}
```

[Try Now](https://api.pixazo.ai/api-details#api=stable-diffusion-xl-lightning&operation=get-image)

## Request Parameters - Get Image

Parameter

Required

Type

Description

prompt

Yes

String

The main instruction for the image generation

negativePrompt

No

String

A prompt to specify what should be avoided in the image

height

No

Integer

The height of the output image (e.g., 1024)

width

No

Integer

The width of the output image (e.g., 1024)

num\_steps

No

Integer

The number of steps for the generation process (e.g., 20)

guidance

No

Integer

The guidance scale for the generation (e.g., 5)

seed

No

Integer

The seed value for random number generation to ensure reproducibility

## Example Request

```
{
  "prompt": "High-resolution, realistic image of a sparrow bird perched on a blooming cherry blossom branch during springtime. The sparrow feathers should be finely detailed with natural colors, including shades of brown and white. The background should be soft-focused with a clear blue sky, creating a serene and peaceful atmosphere.",
  "negativePrompt": "Low-quality, blurry image, with any other birds or animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
  "height": 1024,
  "width": 1024,
  "num_steps": 20,
  "guidance": 5,
  "seed": 42
}
```

## Response

```
{
  "imageUrl": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/sdxl_lightning/prompt-355182775-1724841428119-422172.png"
}
```

## Request Headers

Header

Value

Content-Type

application/json

Cache-Control

no-cache

Ocp-Apim-Subscription-Key

YOUR\_SUBSCRIPTION\_KEY

## Response Handling

Common status codes for Get Image.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

## SDXL Turbo

### Text to Image

## SDXL Turbo Get Image - Stable Diffusion XL Turbo V2 API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/sdxlTurbo/v2/getData
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "Create a detailed illustration of a sparrow perched on a branch. The bird should be depicted with its distinctive brown and gray feathers, a small beak, and bright, curious eyes. Surround the sparrow with a vibrant background of spring leaves and soft sunlight filtering through the trees, capturing the essence of a tranquil morning in nature.",
  "height": 768,
  "width": 768,
  "num_inference_steps": 50,
  "guidance_scale": 7.5,
  "seed": 42
}
```

```
import requests

url = "https://gateway.pixazo.ai/sdxlTurbo/v2/getData"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "Create a detailed illustration of a sparrow perched on a branch. The bird should be depicted with its distinctive brown and gray feathers, a small beak, and bright, curious eyes. Surround the sparrow with a vibrant background of spring leaves and soft sunlight filtering through the trees, capturing the essence of a tranquil morning in nature.",
    "height": 768,
    "width": 768,
    "num_inference_steps": 50,
    "guidance_scale": 7.5,
    "seed": 42
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
```

```
const url = "https://gateway.pixazo.ai/sdxlTurbo/v2/getData";
const headers = {
  "Content-Type": "application/json",
  "Cache-Control": "no-cache",
  "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
};
const data = {
  "prompt": "Create a detailed illustration of a sparrow perched on a branch. The bird should be depicted with its distinctive brown and gray feathers, a small beak, and bright, curious eyes. Surround the sparrow with a vibrant background of spring leaves and soft sunlight filtering through the trees, capturing the essence of a tranquil morning in nature.",
  "height": 768,
  "width": 768,
  "num_inference_steps": 50,
  "guidance_scale": 7.5,
  "seed": 42
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
```

```
curl -v -X POST "https://gateway.pixazo.ai/sdxlTurbo/v2/getData" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "Create a detailed illustration of a sparrow perched on a branch. The bird should be depicted with its distinctive brown and gray feathers, a small beak, and bright, curious eyes. Surround the sparrow with a vibrant background of spring leaves and soft sunlight filtering through the trees, capturing the essence of a tranquil morning in nature.",
    "height": 768,
    "width": 768,
    "num_inference_steps": 50,
    "guidance_scale": 7.5,
    "seed": 42
  }'
```

## Output

```
{
  "output": "https://d3re0c8wemxg38.cloudfront.net/output_mme/8891449d-7bbd-4150-9a56-86ff51378640.jpeg",
  "status": "complete",
  "message": "In progress"
}
```

[Try Now](https://api.pixazo.ai/api-details#api=stable-diffusion-xl-turbo-v2&operation=sdxl-turbo-get-image)

## Request Parameters - SDXL Turbo Get Image

Parameter

Required

Type

Description

prompt

Yes

string

The text query that instructs the AI model on what kind of content to generate. In this case, "Create a detailed illustration of a sparrow perched on a branch..."

height

No

integer

The height in pixels of the generated image. Default: 768

width

No

integer

The width in pixels of the generated image. Default: 768

num\_inference\_steps

Yes

integer

The number of diffusion steps; higher values can improve quality but take longer. Minimum: 1, Maximum: 50

guidance\_scale

Yes

float

Determines the adherence to the prompt; higher values encourage better alignment with the prompt. Minimum: 0, Maximum: 15

seed

No

integer

A seed for random number generation to ensure reproducibility of the results. Default is usually set by the system if not specified

## Example Request

```
{
  "prompt": "Create a detailed illustration of a sparrow perched on a branch. The bird should be depicted with its distinctive brown and gray feathers, a small beak, and bright, curious eyes. Surround the sparrow with a vibrant background of spring leaves and soft sunlight filtering through the trees, capturing the essence of a tranquil morning in nature.",
  "height": 768,
  "width": 768,
  "num_inference_steps": 50,
  "guidance_scale": 7.5,
  "seed": 42
}
```

## Response

```
{
  "output": "https://d3re0c8wemxg38.cloudfront.net/output_mme/8891449d-7bbd-4150-9a56-86ff51378640.jpeg",
  "status": "complete",
  "message": "In progress"
}
```

## Request Headers

Header

Value

Content-Type

application/json

Cache-Control

no-cache

Ocp-Apim-Subscription-Key

YOUR\_SUBSCRIPTION\_KEY

## Response Handling

Common status codes for SDXL Turbo Get Image.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error
