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-...
Never put an API key in public browser code or a Git repository. One account can create multiple keys with independent limits.
POST/v1/images/generations

Create image job

FieldTypeNotes
modelstringgpt-image-2 or a listed Nano Banana model; call GET /v1/models for the active catalog
promptstringmodel-specific · GET /v1/models
image_urlsstring[]Optional; any image URL uses the model's edit operation. Limits are model-specific (up to 14).
aspect_ratioenum1: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
resolutionenum1k / 2k / 4k · model-specific
idempotency_keystringMay 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"
  }
}
POST/v1/videos/generations

Create 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.

FieldTypeNotes
modelstringAny listed video model; call GET /v1/models for capabilities
promptstringRequired; length limit depends on the selected model (2500–30000 characters).
image_urlsstring[]Optional reference images. Limits are model-specific.
reference_video_urlsstring[]Public video URLs sent directly to the provider. Model-specific media limits apply.
reference_video_durationsnumber[]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_modeenumtext_to_video / image_to_video / first_last_frame / reference_to_video / video_to_video / motion_control
reference_audio_urlsstring[]model-specific
aspect_ratioenum16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9 / auto / adaptive
resolutionenum480p / 720p / 768p / 1080p / 2k / 4k
durationintegerAllowed integer seconds from the model catalog. Omit for Motion Control and Omni video-only modes.
generate_audiobooleanModel-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
  }'
POST/v1/audio/generations

Create audio job

Audio models use the same asynchronous job lifecycle. The selected model controls all accepted fields.

FieldTypeNotes
modelstringAny listed audio model; call GET /v1/models for the active catalog
generation_modeenumsimple (default) / custom
promptstringRequired in simple mode; 1–3000 chars
stylestring1–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, lyricsstringRequired in custom mode; max 80 / 5000 chars
durationintegerCustom mode only; target length 10–360 seconds, default 180. The full track is generated in one request.
instrumentalbooleanOptional in simple mode; custom mode is lyric-driven
model_versionenumOmit 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_lyricsbooleanCustom mode only. The completed audio artifact includes verified word timing for karaoke.
idempotency_keystringMay 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
  }'
POST/v1/chat/completions

Create 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.

FieldTypeNotes
modelstringOpenRouter provider/model (default: openai/gpt-5.6-luna) / text-generation-v1 / palm-reading-v1 / fortune-reading-v1 / prompt-text-v1 / prompt-vision-v1
messagesarrayOpenAI-compatible messages; prompt-vision-v1, text-generation-v1, and palm-reading-v1 may include image_url parts in content arrays.
max_tokensintegertext-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.
temperaturenumber0–2
response_formatobjecttext-generation-v1 and report models: { type: "json_object" }
reasoning_effortenumtext-generation-v1 / OpenRouter model: none / low / medium / high; omitted means no reasoning parameter is sent
asyncbooleantext-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_keystringMay 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"
  }'
GET/v1/jobs/:job_id

Query 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"
GET/v1/models

Models

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