Skip to main content

Generate Image

POST /v1/images/generations/

Request Parameters​

ParameterTypeRequiredDescription
modelstringOptionalModel 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.
promptstringRequiredA text description of the desired image. Max length: 32000 characters for gpt-image-1, 1000 for dall-e-2, 4000 for dall-e-3.
nintegerOptionalNumber of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.
sizestringOptionalSize 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.
backgroundstringOptionalAllow 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.
moderationstringOptionalControls the content moderation level for images generated by gpt-image-1. Must be low for less restrictive filtering, or auto (default).
qualitystringOptionalQuality of the generated image.
streamstringOptional-
stylestringOptional-
userstringOptional-

Request Example​

{
"body": {
"prompt": "string"
}
}

Response Fields(200)​

Field NameTypeDescription
modelstringp 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.
promptstringp 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.
nintegerp p-0 Number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.
sizestringp 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.
backgroundstringp 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.
moderationstringp p-0 Controls the content moderation level for gpt-image-1 generated images. Must be low for less restrictive filtering, or auto (default).
qualitystringp p-0 Quality of the generated image.
streamstring-
stylestring-
userstring-