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 | model-specific · GET /v1/models |
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. Kling 3.0 Omni, Seedance 2.5, Kling Motion Control/Turbo, Wan 3.0 and MiniMax H3 expose mode-specific contracts through GET /v1/models. Select tab_mode to distinguish frame inputs, references and editing. Reference video duration is validated before billing.
| Field | Type | Notes |
|---|---|---|
model | string | Any listed video model; call GET /v1/models for capabilities |
prompt | string | Required; length limit depends on the selected model (2500–30000 characters). |
image_urls | string[] | Optional reference images. Limits are model-specific. |
reference_video_urls | string[] | Public video URLs sent directly to the provider. Model-specific media limits apply. |
reference_video_durations | number[] | Seconds per reference video, in URL order; decimals are accepted. Required when pricing depends on input duration. Gateway uses the submitted values without reading the videos. |
tab_mode | enum | text_to_video / image_to_video / first_last_frame / reference_to_video / video_to_video / motion_control |
reference_audio_urls | string[] | model-specific |
aspect_ratio | enum | 16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9 / auto / adaptive |
resolution | enum | 480p / 720p / 768p / 1080p / 2k / 4k |
duration | integer | Allowed integer seconds from the model catalog. Omit for Motion Control and Omni video-only modes. |
generate_audio | boolean | Model-specific audio switch. Omit for H3, Turbo and Motion Control; Omni reference generation with video requires false. |
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–3000 chars |
style | string | 1–1000 chars. Required in custom mode and explicit V6 simple requests. Legacy/default simple requests may omit it; Gateway then follows the style described in the prompt. Explicitly blank values are rejected. |
title, lyrics | string | Required in custom mode; max 80 / 5000 chars |
duration | integer | Custom mode only; target length 10–360 seconds, default 180. The full track is generated in one request. |
instrumental | boolean | Optional in simple mode; custom mode is lyric-driven |
model_version | enum | Omit to use the Gateway-managed default, currently V6. V5 / V5_5 are accepted as aliases for V6 (case-insensitive). New jobs freeze V6; historical jobs retain their original version. |
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...",
"duration": 180,
"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