Skip to main content
POST
/
v1
/
images
/
generations
Generate image
curl --request POST \
  --url http://localhost:8080/v1/images/generations \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "n": 5,
  "size": "256x256",
  "quality": "auto",
  "style": "natural",
  "response_format": "url",
  "background": "transparent",
  "moderation": "low",
  "partial_images": 1,
  "output_compression": 50,
  "output_format": "png",
  "user": "<string>",
  "seed": 123,
  "negative_prompt": "<string>",
  "num_inference_steps": 123,
  "stream": false,
  "fallbacks": [
    {
      "provider": "openai",
      "model": "<string>"
    }
  ]
}
'
{
  "id": "<string>",
  "created": 123,
  "model": "<string>",
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>",
      "index": 123
    }
  ],
  "background": "<string>",
  "output_format": "png",
  "quality": "<string>",
  "size": "256x256",
  "usage": {
    "input_tokens": 123,
    "input_tokens_details": {
      "image_tokens": 123,
      "text_tokens": 123
    },
    "total_tokens": 123,
    "output_tokens": 123,
    "output_tokens_details": {
      "image_tokens": 123,
      "text_tokens": 123
    }
  },
  "extra_fields": {
    "request_type": "<string>",
    "provider": "openai",
    "model_requested": "<string>",
    "model_deployment": "<string>",
    "latency": 123,
    "chunk_index": 123,
    "raw_request": {},
    "raw_response": {},
    "cache_debug": {
      "cache_hit": true,
      "cache_id": "<string>",
      "hit_type": "<string>",
      "provider_used": "<string>",
      "model_used": "<string>",
      "input_tokens": 123,
      "threshold": 123,
      "similarity": 123
    }
  }
}

Body

application/json
model
string
required

Model identifier in format provider/model

prompt
string
required

Text prompt to generate image

n
integer

Number of images to generate

Required range: 1 <= x <= 10
size
enum<string>

Size of the generated image

Available options:
256x256,
512x512,
1024x1024,
1792x1024,
1024x1792,
1536x1024,
1024x1536,
auto
quality
enum<string>

Quality of the generated image

Available options:
auto,
high,
medium,
low,
hd,
standard
style
enum<string>

Style of the generated image

Available options:
natural,
vivid
response_format
enum<string>
default:url

Format of the response.

Available options:
url,
b64_json
background
enum<string>

Background type for the image

Available options:
transparent,
opaque,
auto
moderation
enum<string>

Content moderation level

Available options:
low,
auto
partial_images
integer

Number of partial images to generate

Required range: 0 <= x <= 3
output_compression
integer

Compression level (0-100%)

Required range: 0 <= x <= 100
output_format
enum<string>

Output image format

Available options:
png,
webp,
jpeg
user
string

User identifier for tracking

seed
integer

Seed for reproducible image generation

negative_prompt
string

Negative prompt to guide what to avoid in generation

num_inference_steps
integer

Number of inference steps for generation

stream
boolean
default:false

Whether to stream the response. When true, images are sent as SSE. When streaming, providers may return base64 chunks (b64_json) and/or URLs (url) depending on provider and configuration.

fallbacks
object[]

Fallback models to try if primary model fails

Response

Successful response. Returns JSON for non-streaming requests, or Server-Sent Events (SSE) stream when stream=true. When streaming, events are sent with the following event types:

  • image_generation.partial_image: Intermediate image chunks with base64-encoded image data
  • image_generation.completed: Final event for each image with usage information
  • error: Error events with error details
id
string

Unique identifier for the generation request

created
integer<int64>

Unix timestamp when the image was created

model
string

Model used for generation

data
object[]

Array of generated images

background
string

Background type for the image

output_format
enum<string>

Output image format

Available options:
png,
webp,
jpeg
quality
string

Quality of the generated image

size
enum<string>

Size of the generated image

Available options:
256x256,
512x512,
1024x1024,
1792x1024,
1024x1792,
1536x1024,
1024x1536,
auto
usage
object
extra_fields
object

Additional fields included in responses