Stable, asynchronous, and decoupled from execution nodes.
Every request uses a stable logical model. Public responses never include routing details, internal job IDs, endpoints, or credentials.
Quick start
Create an API key in the console, submit a job, then use the returned job_id to look it up. Only successful jobs are charged to the account balance.
curl https://gateway.example.com/v1/images/generations \
-H "Authorization: Bearer sk-gw-your-key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: product-asset-2026-001" \
-d '{
"model": "gpt-image-2",
"prompt": "Minimal product photo, soft daylight",
"image_urls": [],
"aspect_ratio": "1:1",
"resolution": "2k"
}'Authentication
Every v1 endpoint uses a Bearer key.
Authorization: Bearer sk-gw-...
/v1/images/generationsCreate image job
| Field | Type | Notes |
|---|---|---|
model | string | gpt-image-2 or a listed Nano Banana model; call GET /v1/models for the active catalog |
prompt | string | Required, up to 20,000 characters |
image_urls | string[] | Optional; any image URL uses the model's edit operation. Limits are model-specific (up to 14). |
aspect_ratio | enum | 1:1 / 1:4 / 1:8 / 2:3 / 3:2 / 3:4 / 4:1 / 4:3 / 4:5 / 5:4 / 8:1 / 9:16 / 16:9 / 21:9 / auto |
resolution | enum | 1k / 2k / 4k · model-specific |
idempotency_key | string | May be sent in the body or the Idempotency-Key header |
Response
{
"object": "generation.job",
"job_id": "job_...",
"model": "gpt-image-2",
"status": "running",
"artifacts": [],
"error": null,
"price": {
"amount_micros": 50000,
"amount": "0.050000",
"currency": "usd"
}
}/v1/videos/generationsCreate video job
Video models share one async endpoint. Omni Flash accepts image_urls and reference_video_urls through one Gateway contract; ZexAPI and KIE map them to their own upstream fields, with at most 7 total references.
| Field | Type | Notes |
|---|---|---|
model | string | Any listed video model; call GET /v1/models for capabilities |
prompt | string | Required, up to 20,000 characters |
image_urls | string[] | Optional reference images. Limits are model-specific. |
reference_video_urls | string[] | Optional reference videos. Omni Flash accepts image/video references as one combined set of at most 7. |
aspect_ratio | enum | 16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9 |
resolution | enum | 480p / 720p / 1080p |
duration | integer | Model-specific duration |
generate_audio | boolean | Whether to generate audio too; true by default |
curl https://gateway.example.com/v1/videos/generations \
-H "Authorization: Bearer sk-gw-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-flash-v1",
"prompt": "Create a bright product video from the references",
"image_urls": ["https://cdn.example.com/product.png"],
"reference_video_urls": ["https://cdn.example.com/demo.mp4"],
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 10
}'/v1/audio/generationsCreate audio job
Audio models use the same asynchronous job lifecycle. The selected model controls all accepted fields.
| Field | Type | Notes |
|---|---|---|
model | string | Any listed audio model; call GET /v1/models for the active catalog |
generation_mode | enum | simple (default) / custom |
prompt | string | Required in simple mode; 1–20000 chars |
title, style, lyrics | string | Required in custom mode; max 80 / 1000 / 5000 chars |
instrumental | boolean | Optional in simple mode; custom mode is lyric-driven |
model_version | enum | V5 / V5_5; defaults by mode |
include_timed_lyrics | boolean | Custom mode only. The completed audio artifact includes verified word timing for karaoke. |
idempotency_key | string | May be sent in the body or the Idempotency-Key header |
curl https://gateway.example.com/v1/audio/generations
-H "Authorization: Bearer sk-gw-your-key"
-H "Content-Type: application/json"
-d '{
"model": "sunoai",
"generation_mode": "custom",
"title": "Late Summer Road",
"style": "Warm acoustic folk, intimate vocal, gentle strings",
"lyrics": "[Verse 1]\nWe drove until the sunset...",
"model_version": "V5_5",
"include_timed_lyrics": true
}'/v1/chat/completionsCreate completion
Completions remain synchronous by default and return an OpenAI-compatible result in the same request. text-generation-v1, palm-reading-v1, and fortune-reading-v1 can opt into async job polling; async images must use publicly reachable HTTP(S) URLs, and streaming is not supported.
| Field | Type | Notes |
|---|---|---|
model | string | OpenRouter provider/model (default: openai/gpt-5.6-luna) / text-generation-v1 / palm-reading-v1 / fortune-reading-v1 / prompt-text-v1 / prompt-vision-v1 |
messages | array | OpenAI-compatible messages; prompt-vision-v1, text-generation-v1, and palm-reading-v1 may include image_url parts in content arrays. |
max_tokens | integer | text-generation-v1: 64–16384; palm-reading-v1: 64–6500; fortune-reading-v1: 64–7000; Prompt models: 64–4096. Completion-capability models also accept max_completion_tokens. |
temperature | number | 0–2 |
response_format | object | text-generation-v1 and report models: { type: "json_object" } |
reasoning_effort | enum | text-generation-v1 / OpenRouter model: none / low / medium / high; omitted means no reasoning parameter is sent |
async | boolean | text-generation-v1, palm-reading-v1, and fortune-reading-v1. Default false; true returns a job for /v1/jobs/:job_id polling. Async images must use HTTP(S) URLs. |
idempotency_key | string | May be sent in the body or the Idempotency-Key header |
curl https://gateway.example.com/v1/chat/completions \
-H "Authorization: Bearer sk-gw-your-key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: prompt-copy-2026-001" \
-d '{
"model": "openai/gpt-5.6-luna",
"messages": [
{ "role": "user", "content": "Return a JSON object with three concise product tagline options." }
],
"max_tokens": 512,
"response_format": { "type": "json_object" },
"reasoning_effort": "medium"
}'Async + vision
curl https://gateway.example.com/v1/chat/completions \
-H "Authorization: Bearer sk-gw-your-key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: async-vision-2026-001" \
-d '{
"model": "openai/gpt-5.6-luna",
"async": true,
"messages": [{
"role": "user",
"content": [
{ "type": "text", "text": "Analyze this image and return JSON." },
{ "type": "image_url", "image_url": { "url": "https://cdn.example.com/input.jpg" } }
]
}],
"max_completion_tokens": 12000,
"response_format": { "type": "json_object" },
"reasoning_effort": "high"
}'/v1/jobs/:job_idQuery job
The public status is limited to queued, running, succeeded, and failed. After success, artifacts contains image, video, or audio URLs, and completion contains text or vision completion results; polling stops at a terminal state.
curl https://gateway.example.com/v1/jobs/job_... \ -H "Authorization: Bearer sk-gw-your-key"
/v1/modelsModels
Returns active logical models, capabilities, and minimum–maximum price ranges without exposing their execution-node mapping. Successful jobs settle at the price of the route actually used.
Error codes
invalid_requestunauthorizedaccount_unavailablekey_limit_exceededinsufficient_balancemodel_unavailableprovider_unavailablegeneration_failedtask_timeoutinternal_error