POST
/images/variationsCreate an image variation
Creates one or more variations of a supplied image. Upload a valid square PNG in image; only dall-e-2 is supported for this operation. Use n, response_format, and size to control the generated variations.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
Multipart form data containing the source image and optional variation settings.
imagestringrequired
The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
modelstringoptional
The model to use for image generation. Only `dall-e-2` is supported at this time.
nintegeroptional
The number of images to generate. Must be between 1 and 10.
response_formatstringoptional
The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
sizestringoptional
The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
userstringoptional
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
200Returns an image generation response containing the creation timestamp and generated image data, including URLs or base64-encoded images as applicable.
createdintegerrequired
The Unix timestamp (in seconds) of when the image was created.
dataarray<object>optional
The list of generated images.
backgroundstringoptional
The background parameter used for the image generation. Either `transparent` or `opaque`.
output_formatstringoptional
The output format of the image generation. Either `png`, `webp`, or `jpeg`.
sizestringoptional
The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
qualitystringoptional
The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or `max`.
usageobjectoptional
For `gpt-image-1` only, the token usage information for the image generation.
Error handling
image is required and must be a square PNG file smaller than 4 MB. model must be dall-e-2, n must be between 1 and 10, and response_format and size must use their supported values.