Generate images
Starts an asynchronous generation of n PNG images (1–6) from
prompt, optionally guided by up to 8
reference images. aspect_ratio and resolution select the output
size (see CreateImageForm). Answers 200 with the queued Image;
poll GET /v1/images/{image_id} until it is ready or failed.
Each image costs 1 credit at 1K and 2 credits at 2K. The whole
job (n × the per-image price) is reserved when it is created —
402 when the balance cannot cover it — and refunded in full if
the job fails. A 400 creates no job and uploads no file. 429 RATE_LIMITED means the credit-reservation gate is busy; retry with
backoff.
Authorizations
Headers
Body
Body of POST /v1/images, multipart/form-data only. Text-to-image
when no reference image is supplied, reference-guided generation when
at least one is. aspect_ratio and resolution select one of the
model's fixed output sizes (width × height, in pixels); with
reference images, 2K is a smaller size than without:
Up to 8 reference images in total, as any mix of reference_image
uploads and reference_image_url URLs. The model receives the
uploads first, then the URLs, each in the order sent.
Response
Image generation accepted and queued.
An image generation job (img_ prefix), returned by both
POST /v1/images and GET /v1/images/{image_id}. It only moves
forward — queued → processing → ready or failed — and is
never cancelled. images stays empty until the job is ready,
then lists every generated image in request order. A job either
produces all n images or fails; it never returns a partial set.
Failure details, only when status is failed; otherwise null.
code is SERVICE_BUSY (retryable — the generation service is
busy or unavailable, or the job did not finish within 15
minutes), TASK_FAILED (retryable — any other generation or
upload failure), or INVALID_REQUEST (not retryable — the model
rejected the request, for example an unusable reference image).