Generate images
Creates images from a prompt. Every image is returned as a link in data[].url, never as base64.
A size, quality or count the model doesn’t offer is refused before anything is held.
Authentication
AuthorizationBearer
Your API key, sk-..., from Console → API keys.
Request
This endpoint expects an object.
model
prompt
n
How many images. Each model has its own maximum.
size
One of the model’s sizes, such as 1024x1024.
quality
One of the model’s qualities, such as low, medium, high.
style
background
Allowed values:
output_format
Allowed values:
user
metadata
Response
Links to the images.
created
data
usage
Token usage, for models billed by tokens.
Errors
400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
502
Bad Gateway Error