API reference

Generate an image

Create an image job with any model on the Image Router.

POST /v1/image-router/generate

Host https://api.open.sume.com · Auth API key

Starts an image job with the model you name and returns at once with the job id and the URLs to follow. The job runs on its own; poll Get job status or set a webhook.

Request

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer <key>. Or send x-api-key.
Content-TypestringYesapplication/json
Idempotency-KeystringNo1–255 printable ASCII. Makes a retry return the original job. See Idempotency.

Body

NameTypeRequiredDescription
modelstringYesAn id from List image models, such as gpt-image-2 or nano-banana-pro.
promptstringYesWhat to make.
image_urlsstring[]No1–16 HTTPS images to edit or follow. Text-only models reject it.
aspect_ratiostringNoOne the model lists, such as 1:1, 16:9, 9:16, 4:5. auto follows an input image.
image_sizestring or objectNoA named preset, WIDTHxHEIGHT, or {width, height}. Wins over aspect_ratio.
qualitystringNoModel-specific. gpt-image-2: low, medium, high.
resolutionstringNoModel-specific, such as 1K, 2K, 4K or 1080p.
num_imagesintegerNo1–4 images in one job. Default 1.
output_formatstringNopng, jpeg or webp, where the model lists it.
mask_urlstringNoAn edit mask, on models that take one.
modestringNoasync (default), webhook, sync or subscribe. See How the API works.
webhook_urlstringNoPublic HTTPS URL for the terminal callback. Used with mode: "webhook".
wait_timeout_secondsintegerNo0–30. How long sync / subscribe waits before answering.
metadataobjectNoYour own key-value data, stored on the job. Not sent to the model.

Example

Generate an image

POST /v1/image-router/generate

Required

Response

202 Accepted

Errors

StatuscodeWhen
400invalid_requestA field is missing, unknown for the model, or out of range.
400concurrency_limit_reachedYour workspace is at its jobs-in-flight cap.
401unauthorizedNo key, or the key is wrong or revoked.
402insufficient_fundsYour balance cannot cover the price. details has required_usd and available_usd.
409idempotency_conflictThe Idempotency-Key was used for a different request.
429rate_limitedToo many requests for your key in this window.
503database_busyA short overload. Retry after retry-after.

All error codes