Parameters
string
required
Text description of the image to generate. Maximum 32,000 characters.
string
Render quality tier — directly affects cost. One of
low, medium, high. Default: medium.string
Output dimensions. One of
1024x1024, 1024x1536, 1536x1024, 1024x2048, 2048x1024, 688x2048, 2048x688, 880x2048, 2048x880, 1152x2048, 2048x1152, 1360x2048, 2048x1360, 1536x2048, 2048x1536, 2048x2048, 2160x3840, 3840x2160, auto. Default: 1024x1024.integer
Number of images to generate. Range:
1–10. Default: 1. Each image is
billed its own output cost, so n images cost n× (you’re charged only for
images actually returned).string
Background style. One of
transparent, opaque, auto. Default: auto.
transparent renders a true alpha channel and requires output_format
png (the default) or webp — JPEG has no transparency.string
Output file format. One of
png, jpeg, webp. Default: png.integer
Output compression quality,
0–100. JPEG only.string
Moderation strictness. One of
low, auto. Default: auto.string
HTTPS endpoint to POST the finished generation to. Delivered after the image
is mirrored to storage, so it carries the final URL. Private and loopback
addresses are rejected.
boolean
Stream the result over SSE instead of answering immediately. Default:
false.
See Getting the result.Getting the result
Generation takes roughly 20-120 seconds, so the request does not return the image. It returns the generation id right away:Poll (default)
status becomes success (read data[0].url) or failed (read
error_message).
Webhook
Passcallback_url and we POST it once the image is stored:
Stream
Pass"stream": true for text/event-stream:
partial_images has no effect.
Send an
Idempotency-Key header with every request. If the connection drops,
repeating the request with the same key returns the original generation instead
of creating and charging a second one. See
Idempotency.