Skip to main content
POST
Creates an image given a prompt. Learn more.

Headers

string
required
Bearer token authentication. Format: Bearer <token>

Body

Format: application/json
string
The model to use for image generation. One of dall-e-2, dall-e-3, or gpt-image-1. Defaults to dall-e-2 unless a parameter specific to gpt-image-1 is used.
string
required
A text description of the desired image. Maximum length is 32,000 characters for gpt-image-1, 1,000 characters for dall-e-2, and 4,000 characters for dall-e-3.
integer
The number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.
string
The size of the generated image. For gpt-image-1, must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default); for dall-e-2, must be one of 256x256, 512x512, or 1024x1024; for dall-e-3, must be one of 1024x1024, 1792x1024, or 1024x1792.
string
Allows setting transparency for the background of the generated image. This parameter is only supported for gpt-image-1. Must be one of transparent, opaque, or auto (default). When set to auto, the model will automatically determine the best background for the image.If the background is transparent, the output format must support transparency, so it should be set to png (default) or webp.
string
Controls the content moderation level for images generated by gpt-image-1. Must be low (less restrictive filtering) or auto (default).
string
The quality of the generated image.
string
Whether to stream the response.
string
The style of the generated image.
string
A unique identifier representing the end user.

Response

200

Format: application/json
integer
required
Creation timestamp (Unix time).
object[]
required
List of generated images.
object
required
Token usage statistics for the image generation process.
Last modified on October 28, 2026