Generate Image
POST /v1/images/generations/
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Optional | Model for image generation. One of dall-e-2, dall-e-3, or gpt-image-1. Defaults to dall-e-2 unless parameters specific to gpt-image-1 are used. |
prompt | string | Required | A text description of the desired image. Max length: 32000 characters for gpt-image-1, 1000 for dall-e-2, 4000 for dall-e-3. |
n | integer | Optional | Number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported. |
size | string | Optional | Size of the generated image. For gpt-image-1: 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default). For dall-e-2: 256x256, 512x512, or 1024x1024. For dall-e-3: 1024x1024, 1792x1024, or 1024x1792. |
background | string | Optional | Allow setting transparency for the generated image background. This parameter only supports gpt-image-1. Must be one of transparent, opaque, or auto (default). When using auto, the model determines the best background. If transparent, the output format must support transparency. Set output format to png (default) or webp. |
moderation | string | Optional | Controls the content moderation level for images generated by gpt-image-1. Must be low for less restrictive filtering, or auto (default). |
quality | string | Optional | Quality of the generated image. |
stream | string | Optional | - |
style | string | Optional | - |
user | string | Optional | - |
Request Example
{
"body": {
"prompt": "string"
}
}
Response Fields(200)
| Field Name | Type | Description |
|---|---|---|
model | string | p p-0 Model for image generation. One of dall-e-2, dall-e-3, or gpt-image-1. Defaults to dall-e-2 unless gpt-image-1-specific parameters are used. |
prompt | string | p p-0 A text description of the desired image. Max: 32000 chars for gpt-image-1, 1000 for dall-e-2, 4000 for dall-e-3. |
n | integer | p p-0 Number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported. |
size | string | p p-0 Size of the generated image. For gpt-image-1: 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default). For dall-e-2: 256x256, 512x512, or 1024x1024. For dall-e-3: 1024x1024, 1792x1024, or 1024x1792. |
background | string | p p-0 Allow setting transparency for the generated image background. Only supports gpt-image-1. Must be one of: transparent, opaque, or auto (default). When using auto, the model determines the best background.the model determines the best background. If transparent, the output format must support transparency — set it to png (default) or webp. |
moderation | string | p p-0 Controls the content moderation level for gpt-image-1 generated images. Must be low for less restrictive filtering, or auto (default). |
quality | string | p p-0 Quality of the generated image. |
stream | string | - |
style | string | - |
user | string | - |