Body Required
-
A text description of the desired image(s). The maximum length is 1000 characters for
dall-e-2
and 4000 characters fordall-e-3
. -
n integer | null
The number of images to generate. Must be between 1 and 10. For
dall-e-3
, onlyn=1
is supported.Minimum value is
1
, maximum value is10
. Default value is1
. -
quality string
The quality of the image that will be generated.
hd
creates images with finer details and greater consistency across the image. This param is only supported fordall-e-3
.Values are
standard
orhd
. Default value isstandard
. -
response_format string | null
The format in which the generated images are returned. Must be one of
url
orb64_json
. URLs are only valid for 60 minutes after the image has been generated.Values are
url
orb64_json
. Default value isurl
. -
size string | null
The size of the generated images. Must be one of
256x256
,512x512
, or1024x1024
fordall-e-2
. Must be one of1024x1024
,1792x1024
, or1024x1792
fordall-e-3
models.Values are
256x256
,512x512
,1024x1024
,1792x1024
, or1024x1792
. Default value is1024x1024
. -
style string | null
The style of the generated images. Must be one of
vivid
ornatural
. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported fordall-e-3
.Values are
vivid
ornatural
. Default value isvivid
. -
user string
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
curl \
-X POST https://api.openai.com/v1/images/generations \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"prompt":"A cute baby sea otter","model":"dall-e-3","n":1,"quality":"standard","response_format":"url","size":"1024x1024","style":"vivid","user":"user-1234"}'
{
"prompt": "A cute baby sea otter",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"response_format": "url",
"size": "1024x1024",
"style": "vivid",
"user": "user-1234"
}
{
"created": 42,
"data": [
{
"b64_json": "string",
"url": "string",
"revised_prompt": "string"
}
]
}