Gateway API reference

A single REST API for image, video, audio and chat models across fal.ai, Replicate, WaveSpeedAI, KIE AI, APIMart, EvoLink, AtlasCloud, Vercel AI Gateway and OpenRouter.

Base URL: https://01router.com/api/v1

Authentication

Send your API key as a Bearer token. Requests are billed to the key owner's credits. Get an API key

Authorization: Bearer sk_xxxxxxxxxxxxxxxx

Endpoints

MethodPathDescription
POST/generationsCreate a generation (charges credits)
GET/generations/{id}Get a generation; polls the provider while running
GET/generationsList your generations (page, pageSize)
POST/chat/completionsChat completion (OpenAI-compatible, stream or not)
POST/quotePrice a request on every provider (no charge, no key needed)
GET/modelsList models with parameters and prices (?type=video|image|audio|chat)
GET/models/{slug}Get one model
GET/providersList providers and the models they serve

Create a generation

Pass the model id, its unified input parameters and optionally a provider slug. The response returns immediately with the task id; image models on synchronous providers may already be succeeded.

curl https://01router.com/api/v1/generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2.5",
    "provider": "fal",            // optional: omit to auto-route
    "input": {
      "prompt": "A red fox running through fresh snow, cinematic",
      "duration": 5,
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "generate_audio": true
    }
  }'
{
  "id": "gen_6f1c…",
  "object": "generation",
  "model": "seedance-2.5",
  "type": "video",
  "provider": "kie",
  "status": "processing",        // queued | processing | succeeded | failed
  "input": { "prompt": "…", "duration": 5, "resolution": "720p", "aspect_ratio": "16:9", "generate_audio": true },
  "outputs": [],
  "error": null,
  "credits": 512,
  "price_usd": 2.0475,
  "created_at": "2026-10-23T08:00:00.000Z",
  "completed_at": null
}

Get the result

Poll every few seconds until status is succeeded or failed. Output URLs are provider-hosted and may expire — download them promptly.

curl https://01router.com/api/v1/generations/gen_6f1c… -H "Authorization: Bearer $API_KEY"

{ "id": "gen_6f1c…", "status": "succeeded", "outputs": ["https://…/video.mp4"], … }

Audio models

Music (Suno) and text-to-speech (Gemini TTS) models use the same /generations flow as images and video: create a task, then poll it. Outputs are audio file URLs.

curl https://01router.com/api/v1/generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash-tts",
    "input": { "prompt": "Welcome back, let us get started.", "voice": "Kore", "style_instructions": "warm and upbeat" }
  }'

{ "id": "gen_9a2d…", "type": "audio", "status": "succeeded", "outputs": ["https://…/speech.wav"], … }

Chat completions

Chat models (GPT, Claude, Gemini, Grok, DeepSeek…) use the OpenAI Chat Completions format, so the official OpenAI SDKs work with base URL https://01router.com/api/v1. Set "stream": true for server-sent events. Credits for the prompt plus max_tokens (4,096 when unset) are held first, then settled to the real token usage once the reply ends; the same request id appears in the X-Gateway-Request-Id header and the task log.

curl https://01router.com/api/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5.5",
    "messages": [{ "role": "user", "content": "Write a haiku about routers" }],
    "max_tokens": 512,
    "stream": true
  }'
from openai import OpenAI

client = OpenAI(base_url="https://01router.com/api/v1", api_key="sk_…")
res = client.chat.completions.create(
    model="gpt-6-sol",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(res.choices[0].message.content, res.usage)

Provider routing

Without provider we validate the input against every provider's supported values, price it, and submit to the cheapest one. If submission fails we refund and try the next provider (up to 3). With provider the request goes only there.

Quote

Same body as creating a generation. Returns every available provider sorted by price, plus the ones that cannot serve the request and why.

curl https://01router.com/api/v1/quote -H "Content-Type: application/json" \
  -d '{ "model": "nano-banana-pro", "input": { "prompt": "poster", "resolution": "2K" } }'

{
  "model": "nano-banana-pro",
  "providers": [
    { "provider": "kie", "provider_name": "KIE AI", "unit": "image", "quantity": 1, "price_usd": 0.117, "credits": 30 },
    { "provider": "openrouter", … }
  ],
  "unavailable": [{ "provider": "atlascloud", "reason": "resolution must be one of 1K, 2K" }]
}

Billing

Credits are charged when the task is submitted, based on the chosen provider's price for your parameters (per second of video, per image or per request). Failed or timed-out tasks are refunded automatically.

Errors

{ "error": { "message": "Insufficient credits: this request costs 512 credits", "code": "insufficient_credits" } }
400invalid_requestInvalid body or parameter value
401unauthorizedMissing or invalid API key
402insufficient_creditsNot enough credits
404not_foundUnknown model or generation
429rate_limitedToo many requests — retry after the given seconds
502upstream_errorEvery provider rejected the task (credits refunded)
503no_providerNo provider supports these parameters

All model ids and parameters: Models