Create image variation
POSThttps:/api.openai.com/v1/images/variations
Creates a variation of a given image. This endpoint only supports dall-e-2.
Request body
imagestringRequired
The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.modelstring
The model to use for image generation. Only
dall-e-2is supported at this time.modelstring
modelstring
dall-e-2string
ninteger or nullDefaults: 1
The number of images to generate. Must be between 1 and 10.response_formatstring or nullDefaults: url
The format in which the generated images are returned. Must be one of
urlorb64_json. URLs are only valid for 60 minutes after the image has been generated.urlstring
b64_jsonstring
sizestring or nullDefaults: 1024x1024
The size of the generated images. Must be one of
256x256,512x512, or1024x1024.256x256string
512x512string
1024x1024string
userstring
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
Response
Returns a list of image objects.
Example request
1 curl https://api.openai.com/v1/images/variations \2 -H "Authorization: Bearer $OPENAI_API_KEY" \3 -F image="@otter.png" \4 -F n=2 \5 -F size="1024x1024"
Example response
1 {2 "created": 1589478378,3 "data": [4 {5 "url": "https://..."6 },7 {8 "url": "https://..."9 }10 ]11 }
Built with