Image Generation
Generate images from text descriptions using an OpenAI-compatible endpoint.
POST /v1/images/generationsRequired capability: images
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Image generation model (e.g. dall-e-3, stable-diffusion-xl). |
prompt | string | Yes | Text description of the desired image (1-4000 characters). |
n | integer | No | Number of images to generate (1-10). Defaults to 1. |
size | string | No | Image dimensions in WIDTHxHEIGHT format (e.g. 1024x1024, 1792x1024). |
quality | string | No | Image quality setting (model-dependent, e.g. "standard", "hd"). |
style | string | No | Image style (model-dependent, e.g. "natural", "vivid"). |
response_format | string | No | "url" to receive a URL, or "b64_json" for base64-encoded image data. |
Response
{ "created": 1709000000, "data": [ { "url": "https://cdn.example.com/generated-image.png", "revised_prompt": "A detailed oil painting of a sunset over mountains..." } ]}When response_format is "b64_json":
{ "created": 1709000000, "data": [ { "b64_json": "/9j/4AAQSkZJRg...", "revised_prompt": "A detailed oil painting of a sunset over mountains..." } ]}Response Fields
| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the image was generated. |
data | array | Array of generated image objects. |
data[].url | string | URL of the generated image (when response_format is "url"). |
data[].b64_json | string | Base64-encoded image data (when response_format is "b64_json"). |
data[].revised_prompt | string | The prompt as revised by the model (if applicable). |
Real-Time Progress
For providers that support it (such as ComfyUI), image generation progress updates are emitted via WebSocket on the /image-progress namespace. Connect to receive percentage updates during long-running generation jobs.
Example
curl https://your-gateway.example.com/v1/images/generations \ -H "Authorization: Bearer aigw_sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "model": "dall-e-3", "prompt": "A watercolor painting of a mountain lake at sunrise", "size": "1024x1024", "quality": "hd", "n": 1 }'