Synchronous Generate body
/v1/images/generations for synchronous work.
Set size explicitly when downstream storage or layout depends on exact pixels. The public API does not define the output dimensions produced by an omitted value.
Unified asynchronous body
Send JSON to/v1/images/tasks. Generation uses action=generate and omits input_images. Editing accepts 1–16 items; this two-image request combines references:
mime_type must match the PNG, JPEG, or WebP bytes. Omit aspect_ratio.
Add Idempotency-Key to retryable submissions. The key is limited to 255 bytes; the same key and body replay the task, while a changed body returns HTTP 409.
Edit form
POST /v1/images/edits uses multipart/form-data:
Synchronous multipart Edit covers one source image. Use the unified task endpoint for multiple references.
Synchronous multipart Edit does not publish one fixed source-image byte or pixel limit. If the gateway returns HTTP
413, reduce the image and total multipart body before retrying; the unified JSON task limit remains 20 MiB decoded. See errors and safe retries.
Response
Successful Generate and Edit responses contain one image:b64_json before writing the PNG. Do not expect a hosted image URL.
Controls outside this reverse-image route
The public contract does not include masks,n > 1, partial-image streaming, output format/compression, transparency, callbacks, or cancellation. Completed tasks preserve native ImagesResponse under result, expose result_expires_at, and expire the image after 24 hours.
Copy Web examples
Use complete synchronous, asynchronous, and editing flows.