curl --request POST \
--url https://api.example.com/v1/images/generations \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model": "<string>",
"n": 123,
"size": "<string>",
"quality": "<string>",
"response_format": "<string>",
"style": "<string>",
"background": "<string>",
"output_format": "<string>",
"output_compression": 123,
"moderation": "<string>",
"stream": true,
"partial_images": 123,
"user": "<string>"
}
'{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
]
}curl --request POST \
--url https://api.example.com/v1/images/generations \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model": "<string>",
"n": 123,
"size": "<string>",
"quality": "<string>",
"response_format": "<string>",
"style": "<string>",
"background": "<string>",
"output_format": "<string>",
"output_compression": 123,
"moderation": "<string>",
"stream": true,
"partial_images": 123,
"user": "<string>"
}
'{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
]
}/v1/chat/completions instead.
client.images.generate(params)
gpt-image-1dall-e-3dall-e-2openai/dall-e-2openai/dall-e-3openai/gpt-image-1openai/dall-e-2 (unless a gpt-image-1-specific parameter is used)dall-e-3, only n=1 is supported.Default: 1gpt-image-1: 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default)dall-e-2: 256x256, 512x512, or 1024x1024dall-e-3: 1024x1024, 1792x1024, or 1024x1792auto (default) - automatically select the best qualityhigh, medium, low - supported for gpt-image-1hd, standard - supported for dall-e-3standard - only option for dall-e-2url - URLs valid for 60 minutesb64_json - Base64-encoded JSONgpt-image-1 always returns base64-encoded images.Default: urlvivid - hyper-real and dramatic imagesnatural - more natural, less hyper-real looking imagesgpt-image-1 only):auto (default) - model automatically determines the best backgroundtransparent - transparent background (requires png or webp output format)opaque - opaque backgroundgpt-image-1 only):pngjpegwebpgpt-image-1 only, with webp or jpeg formats).Default: 100gpt-image-1 only):auto (default) - standard filteringlow - less restrictive filteringgpt-image-1 only). See the Image generation guide for more information.Default: falseconst image = await client.images.generate({
prompt: "A white siamese cat",
model: "openai/dall-e-3"
});
console.log(image.data[0].url);