For the full and up-to-date list of supported image models, see Image models on the Supported Models page.
Image generation
Generate images from a text prompt usingPOST /v2/router/images/generations.
Parameters
| Parameter | Description |
|---|---|
model | Model ID |
prompt | Text description of the desired image |
n | Number of images to generate |
size | Image dimensions (see Supported Models for per-model sizes) |
response_format | url or b64_json. DALL-E 2/3 only — gpt-image-1 always returns b64_json |
quality | Image quality level. Values vary by model |
style | vivid or natural. DALL-E 3 only |
background | transparent, opaque, or auto. gpt-image-1 only |
output_format | png, jpeg, or webp. gpt-image-1 only |
output_compression | Compression level 0-100%. gpt-image-1 only |
moderation | auto or low. gpt-image-1 only |
Response format
Setresponse_format to url to receive a hosted image link, or b64_json to receive the image as a base64-encoded string inline in the response. Supported sizes and response formats vary by model. See Image models.
Image editing
Modify an existing image using a prompt and an optional mask withPOST /v2/router/images/edits.
Parameters
| Parameter | Description |
|---|---|
model | Model ID |
image | PNG, WEBP, or JPEG file to edit. Some models accept an array of images |
prompt | Text description of the desired edit |
mask | Optional PNG mask where transparent areas indicate where to edit |
size | Output image dimensions |
response_format | url or b64_json. gpt-image-1 always returns b64_json |
quality | Image quality level. Values vary by model |
Image variations
Generate variations of an existing image withPOST /v2/router/images/variations. See Image models for which models support variations.
Parameters
| Parameter | Description |
|---|---|
model | Model ID |
image | PNG image to create a variation of |
n | Number of variations to generate (1-10) |
size | Output image dimensions |
response_format | url or b64_json |
Fallbacks and reliability
Image endpoints support the samefallbacks and retry parameters as chat completions:
TypeScript