v1

latestOpenAPI 3.1.0Apache 2.02026-07-264001921002.3 KB
Images

Generate an image

Generates images from text prompts using the specified model.

post/v1/images/generations

Request body

modelstring required

Model identifier in format provider/model

promptstring required

Text prompt to generate image

ninteger

Number of images to generate

size'256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792' | '1536x1024' | '1024x1536' | 'auto'

Size of the generated image

quality'auto' | 'high' | 'medium' | 'low' | 'hd' | 'standard'

Quality of the generated image

style'natural' | 'vivid'

Style of the generated image

response_format'url' | 'b64_json'

Format of the response.

background'transparent' | 'opaque' | 'auto'

Background type for the image

moderation'low' | 'auto'

Content moderation level

partial_imagesinteger

Number of partial images to generate

output_compressioninteger

Compression level (0-100%)

output_format'png' | 'webp' | 'jpeg'

Output image format

userstring

User identifier for tracking

seedinteger

Seed for reproducible image generation

negative_promptstring

Negative prompt to guide what to avoid in generation

num_inference_stepsinteger

Number of inference steps for generation

streamboolean

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.

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
idstring

Unique identifier for the generation request

createdinteger

Unix timestamp when the image was created

modelstring

Model used for generation

backgroundstring

Background type for the image

output_format'png' | 'webp' | 'jpeg'

Output image format

qualitystring

Quality of the generated image

size'256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792' | '1536x1024' | '1024x1536' | 'auto'

Size of the generated image