Request parameters
A text description of the image you want to generate. The more descriptive and specific your prompt, the more accurately the output will reflect your intent.
The visual style applied to the generated image. Accepted values are
"photorealistic", "illustration", and "abstract". Defaults to "photorealistic".The pixel dimensions of the output image. Accepted values are
"512x512", "1024x1024", and "1024x1792". Defaults to "1024x1024". Choose "1024x1792" for portrait-format images.The number of images to generate in this request. Accepts an integer between
1 and 4 inclusive. Defaults to 1. Each image consumes tokens separately.Example request
generate-image.sh
Example response
response.json
Response fields
A unique identifier for this image generation request.
An array of image objects, one for each image generated. The length of this array matches the
count value you specified in the request.An ISO 8601 timestamp indicating when the images were generated.
Image URLs are available for 24 hours after generation. If you need to retain the images beyond that window, download them to your own storage immediately after the request completes.
Error responses
400 Bad Request — Missing or invalid parameters
400 Bad Request — Missing or invalid parameters
Returned when the
prompt field is missing or a parameter value falls outside its accepted range (for example, count: 5).400-response.json
401 Unauthorized
401 Unauthorized
429 Too Many Requests — Rate limited
429 Too Many Requests — Rate limited
Returned when you have exceeded your plan’s rate limit. Check the
Retry-After header and wait before resending the request.429-response.json