# Stable Diffusion API

> Provider: **Stability AI**
> Source: https://www.pixazo.ai/models/stable-diffusion

Industry-leading image and video generation models.

## Stable Diffusion v3

### Text to Image

## Get Data - Stable Diffusion 3 API

## Request Code

HTTP Python JavaScript cURL

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

{
  "prompt": "Picture a sleek, futuristic car racing through a neon-lit cityscape, its engine humming efficiently as it blurs past digital billboards. The driver skillfully navigates the glowing streets, aiming for victory in this high-tech, adrenaline-fueled race of tomorrow.",
  "negativePrompt": "dark, blurry",
  "steps": 28,
  "cfg": 4.0,
  "aspect_ratio": "3:2",
  "output_format": "jpg",
  "output_quality": 90,
  "prompt_strength": 0.85
}
```

```
import requests

url = "https://gateway.pixazo.ai/sd3/v1/getData"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "Picture a sleek, futuristic car racing through a neon-lit cityscape, its engine humming efficiently as it blurs past digital billboards. The driver skillfully navigates the glowing streets, aiming for victory in this high-tech, adrenaline-fueled race of tomorrow.",
    "negativePrompt": "dark, blurry",
    "steps": 28,
    "cfg": 4.0,
    "aspect_ratio": "3:2",
    "output_format": "jpg",
    "output_quality": 90,
    "prompt_strength": 0.85
}

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

```
const url = 'https://gateway.pixazo.ai/sd3/v1/getData';

const data = {
  prompt: "Picture a sleek, futuristic car racing through a neon-lit cityscape, its engine humming efficiently as it blurs past digital billboards. The driver skillfully navigates the glowing streets, aiming for victory in this high-tech, adrenaline-fueled race of tomorrow.",
  negativePrompt: "dark, blurry",
  steps: 28,
  cfg: 4.0,
  aspect_ratio: "3:2",
  output_format: "jpg",
  output_quality: 90,
  prompt_strength: 0.85
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```
curl -X POST "https://gateway.pixazo.ai/sd3/v1/getData" \
    -H "Content-Type: application/json" \
    -H "Cache-Control: no-cache" \
    -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
    -d '{
      "prompt": "Picture a sleek, futuristic car racing through a neon-lit cityscape, its engine humming efficiently as it blurs past digital billboards. The driver skillfully navigates the glowing streets, aiming for victory in this high-tech, adrenaline-fueled race of tomorrow.",
      "negativePrompt": "dark, blurry",
      "steps": 28,
      "cfg": 4.0,
      "aspect_ratio": "3:2",
      "output_format": "jpg",
      "output_quality": 90,
      "prompt_strength": 0.85
    }'
```

## Output

```
{
  "output": "https://example.com/image.jpg"
}
```

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

## Request Parameters - Get Data

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, "womens street skateboarding final in Paris Olympics 2024."

negativePrompt

No

string

Negative prompts do not really work in SD3. Using a negative prompt will change your output in unpredictable ways.

steps

No

integer

The number of steps for the transformation process. Default: 28, (minimum: 1, maximum: 28)

cfg

No

decimal

The guidance scale tells the model how similar the output should be to the prompt. Default: 3.5, (minimum: 0, maximum: 20)

aspect\_ratio

No

string

The aspect ratio of your output image. This value is ignored if you are using an input image. Default: "1:1"

output\_format

No

string

Format of the output images. Default: "webp"

output\_quality

No

integer

Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Default: 90, (minimum: 0, maximum: 100)

prompt\_strength

No

decimal

Prompt strength (or denoising strength) when using image to image. 1.0 corresponds to full destruction of information in image. Default: 0.85, (minimum: 0, maximum: 1)

## Example Request

```
{
  "prompt": "Picture a sleek, futuristic car racing through a neon-lit cityscape, its engine humming efficiently as it blurs past digital billboards. The driver skillfully navigates the glowing streets, aiming for victory in this high-tech, adrenaline-fueled race of tomorrow.",
  "negativePrompt": "dark, blurry",
  "steps": 28,
  "cfg": 4.0,
  "aspect_ratio": "3:2",
  "output_format": "jpg",
  "output_quality": 90,
  "prompt_strength": 0.85
}
```

## Response

```
{
    "output": "https://example.com/image.jpg"
}
```

## 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 Data.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

## Stable Diffusion v3.5

### Text to Image

## Get Image - Stable Diffusion 3.5 large API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/sd3-5/v1/r-sd-3-5-large
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: your-subscription-key

{
  "prompt": "~*~aesthetic~*~ #boho #fashion, full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font",
  "aspect_ratio": "1:1",
  "cfg": 4.5,
  "steps": 40,
  "output_format": "webp",
  "output_quality": 90,
  "prompt_strength": 0.85
}
```

```
import requests

url = "https://gateway.pixazo.ai/sd3-5/v1/r-sd-3-5-large"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "your-subscription-key"
}
data = {
    "prompt": "~*~aesthetic~*~ #boho #fashion, full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font",
    "aspect_ratio": "1:1",
    "cfg": 4.5,
    "steps": 40,
    "output_format": "webp",
    "output_quality": 90,
    "prompt_strength": 0.85
}

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

```
const url = 'https://gateway.pixazo.ai/sd3-5/v1/r-sd-3-5-large';

const data = {
  prompt: "~*~aesthetic~*~ #boho #fashion, full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font",
  aspect_ratio: "1:1",
  cfg: 4.5,
  steps: 40,
  output_format: "webp",
  output_quality: 90,
  prompt_strength: 0.85
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'your-subscription-key'
  },
  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/sd3-5/v1/r-sd-3-5-large" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: your-subscription-key" \
  --data-raw '{
    "prompt": "~*~aesthetic~*~ #boho #fashion, full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font",
    "aspect_ratio": "1:1",
    "cfg": 4.5,
    "steps": 40,
    "output_format": "webp",
    "output_quality": 90,
    "prompt_strength": 0.85
  }'
```

## Output

```
{
  "id": "j8qc0mvk8drmy0cxe4wvcy8ajw",
  "status": "succeeded",
  "output": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/sd-3-5-large/prompt-1775721091831-439186.webp"
}
```

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

## Request Parameters - Get Image

Parameter

Required

Type

Description

prompt

Yes

string

The text prompt describing the desired image

aspect\_ratio

Yes

string

Aspect ratio of the output image (e.g., "1:1", "16:9")

cfg

Yes

number

Classifier-Free Guidance scale, controls prompt adherence (1.0-20.0)

steps

Yes

number

Number of inference steps (20-100)

output\_format

Yes

string

Output format: "webp", "jpg", "png", "jpeg"

output\_quality

Yes

number

Quality level for compressed formats (1-100)

prompt\_strength

Yes

number

Strength of prompt influence (0.0-1.0)

## Example Request

```
{
  "prompt": "~*~aesthetic~*~ #boho #fashion, full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font",
  "aspect_ratio": "1:1",
  "cfg": 4.5,
  "steps": 40,
  "output_format": "webp",
  "output_quality": 90,
  "prompt_strength": 0.85
}
```

## Response

```
{
  "id": "j8qc0mvk8drmy0cxe4wvcy8ajw",
  "status": "succeeded",
  "output": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/sd-3-5-large/prompt-1775721091831-439186.webp"
}
```

## 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

## Stable Diffusion XL v1.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

## Stable Diffusion XL 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

### Text to Image (Stream)

## Get Image Stream - Stable Diffusion XL Lightning API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/sdxl_lightning/getImage/v1/getSDXLImageStream
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/getSDXLImageStream"
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())
```

```
const url = "https://gateway.pixazo.ai/sdxl_lightning/getImage/v1/getSDXLImageStream";
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.",
  "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
};

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/sdxl_lightning/getImage/v1/getSDXLImageStream" \
  -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": "https://example.com/image.jpg"
}
```

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

## Request Parameters - Get Image Stream

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://example.com/image.jpg"
}
```

## 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 Stream.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

## Stable Diffusion Inpainting

### Image to Image (Inpainting — Ref Image + Ref Mask to Image)

## Get Image - Stable Diffusion-v1-5 Inpainting API

## Request Code

HTTP Python JavaScript cURL

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

{
  "prompt": "Change to a lion",
  "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png",
  "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png",
  "negative_prompt": "watermark",
  "height": 1024,
  "width": 1024,
  "num_steps": 20,
  "guidance": 5,
  "seed": 42
}
```

```
import requests

url = "https://gateway.pixazo.ai/inpainting/v1/getImage"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "Change to a lion",
    "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png",
    "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png",
    "negative_prompt": "watermark",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance": 5,
    "seed": 42
}

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

```
const url = 'https://gateway.pixazo.ai/inpainting/v1/getImage';

const data = {
  prompt: 'Change to a lion',
  imageUrl: 'https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png',
  maskUrl: 'https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png',
  negative_prompt: 'watermark',
  height: 1024,
  width: 1024,
  num_steps: 20,
  guidance: 5,
  seed: 42
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
  },
  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/inpainting/v1/getImage" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "Change to a lion",
    "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png",
    "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png",
    "negative_prompt": "watermark",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance": 5,
    "seed": 42
  }'
```

## Output

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

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

## Request Parameters - Get Image

Parameter

Required

Type

Description

prompt

Yes

String

The main instruction for the image transformation

imageUrl

No

URL

The URL of the initial image to be transformed

maskUrl

No

URL

The URL of the mask image

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 transformation process (e.g., 20)

guidance

No

Integer

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

seed

No

Integer

The seed value for random number generation to ensure reproducibility

## Example Request

```
{
  "prompt": "Change to a lion",
  "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png",
  "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png",
  "negative_prompt": "watermark",
  "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

### Text to Image (Stream)

## Get Image Stream - Stable Diffusion-v1-5 Inpainting API

## Request Code

HTTP Python JavaScript cURL

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

{
  "prompt": "Change to a lion"
}
```

```
import requests

url = "https://gateway.pixazo.ai/inpainting/v1/getImageStream"
headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}
data = {
    "prompt": "Change to a lion"
}

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

```
const url = 'https://gateway.pixazo.ai/inpainting/v1/getImageStream';

const data = {
  prompt: 'Change to a lion'
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
  },
  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/inpainting/v1/getImageStream" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "Change to a lion"
  }'
```

## Output

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

[Try Now](https://api.pixazo.ai/api-details#api=stable-diffusion-v1-5-inpainting&operation=get-image-stream)

## Request Parameters - Get Image Stream

Parameter

Required

Type

Description

prompt

Yes

String

The main instruction for the image transformation

imageUrl

No

URL

The URL of the initial image to be transformed

maskUrl

No

URL

The URL of the mask image

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 transformation process (e.g., 20)

guidance

No

Integer

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

seed

No

Integer

The seed value for random number generation to ensure reproducibility

## Example Request

```
{
  "prompt": "Change to a lion",
  "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png",
  "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png",
  "negativePrompt": "watermark",
  "height": 1024,
  "width": 1024,
  "num_steps": 20,
  "guidance": 5,
  "seed": 42
}
```

## Response

```
{
  "imageUrl": "https://example.com/generated-image-12345.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 Stream.

Code

Meaning

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error
