codai docs
Gateway

Models

What `codai` resolves to, the other aliases you can address, and how effort and thinking work.

You address the gateway by alias, not by upstream vendor name. An alias is a stable identity that the gateway resolves to a concrete model at request time, so your code never changes when the upstream does.

codai — the one name to remember

model: "codai" is the primary identity. Today it routes to Anthropic's current Claude models (the Opus, Fable, Sonnet and Haiku families), with automatic failover between approved deployments when one is unavailable. The chain behind the name can change. The x-codai-routed-to response header tells you which model served every request, and the live routing distribution on codai.ro shows where production traffic actually went. Models from other providers are not in this route; address them by name (see direct upstream names). Pin codai-max (or codai-fable) when you want Fable 5.1 first.

codai is also the alias with the most protection built in:

  • Prompt caching is always on. The X-Codai-Cache: 0 opt-out is ignored for codai* aliases (it is honoured on direct upstream names). Cache reads cost roughly a tenth of fresh input.
  • Every request is metered in micro-USD against your key, including any sub-calls the gateway makes on your behalf.
  • Effort is a dial you control. The raw API defaults to medium; the VS Code config ships high (max is one dial step away). See effort and thinking.

`codai` (auto) or a pinned model

codaiPinned name (codai-fast, codai-max, claude-sonnet-5-5, …)
What answersToday, a chain of current Claude models; the first healthy deployment winsAlways that model (or its own listed failover)
When a deployment is downFails over to the next entry in the chainFails over only within that alias's chain; direct names have none
CostVaries with the model that answeredPredictable per model
How to checkx-codai-routed-to, plus x-codai-cost-micro-usd when knownSame headers

Use codai unless you need the same model on every call. Direct upstream names need a plan that allows them.

`codai` (auto) or `codai-1` (beta, pinned)

codaicodai-1-beta
What it isThe default name; today a chain of Anthropic's current Claude models with failovercodai's own model, in beta: an RL fine-tune of DeepSeek-V4.1-Flash (MIT licence), served by codai
How you get itAny key, every clientOpt-in: ask for codai-1-beta by name. It is not listed in GET /v1/models and is never part of the codai chain
Input and toolsText, images, tool callingText only; tool calling is off during the beta
StabilityStable name; the models behind it can changeBeta: the checkpoint behind the name can change without notice, and availability can be limited
How to checkx-codai-routed-toSame header

Use codai for real work. Pick codai-1-beta only to try codai's own model.

Public aliases

These appear in GET /v1/models for every key.

AliasServesUse it for
codaiToday, Anthropic's current Claude models, with automatic failover (the served model is in x-codai-routed-to)Everything. The default.
codai-labsSame routing as codai today, plus frontier-research features as they land (execution-verified code answers, exec-ranked best-of-N, new open-weight models)Trying what is next. Behaviour may change without notice — pin codai for stability.

Workload aliases

Hidden from /v1/models listings but resolvable by any key that can address codai. They exist so IDE integrations can pin a role to a model without inventing their own names.

AliasServesNotes
codai-fastClaude Haiku 5.5 (failover: Haiku 4.5)Utility work: titles, intent detection, commit messages. Task-free when sent with X-Codai-No-Task: 1.
codai-explorerClaude Sonnet 5.5 (failover: Sonnet 5)Codebase reading and search — many short turns where latency beats deliberation.
codai-agentSame as codaiTool-heavy implementation.
codai-deepSame as codaiDeep reasoning.
codai-maxClaude Fable 5.1 (failover: Opus 5.5)Escalation pin: demanding, long-horizon reasoning.
codai-visionSame as codaiImage input enabled.
codai-smartClaude Sonnet 5Balanced tier.
codai-opusClaude Opus 5.5Explicit Opus-class pin.
codai-flashGemini 2.5 FlashCheap multimodal.
codai-latestSame as codaiLegacy name kept for old configs.

codai-agent, codai-deep and codai-vision all share codai's chain today; codai-max is the one that leads with Fable 5.1. The effort dial covers what these used to distinguish, which is why the VS Code picker now publishes only codai, codai-fast and codai-explorer.

codai Max (preview)

codai-max-n is an opt-in hard-task mode, separate from the codai-max pin. It is off unless the gateway operator enables it; while it is off the name is rejected like any unknown model (HTTP 400). It is never listed in /v1/models and is addressable by any key that can address codai.

For each request the gateway:

  1. generates several candidate answers in parallel (4 by default, at most 8);
  2. drops broken candidates and, when code can be executed in the sandbox, prefers the candidates whose code actually runs;
  3. asks one judge to compare all remaining candidates at once and pick one, with a confidence score;
  4. when the judge is unsure, re-asks a frontier model once and serves that answer. An execution-verified answer is never escalated.
Response headerMeaning
x-codai-max-nCandidates requested
x-codai-max-escalated1 when the frontier re-ask answered
x-codai-max-methodjudge, exec, deterministic, escalated or single
x-codai-routed-toModel that produced the served answer
x-codai-cost-micro-usdSum of every candidate, judge and escalation call

Cost and latency

One request costs roughly N + 1 to N + 2 single calls, and every call is metered on your key. Answers are buffered: with stream: true nothing is sent until selection finishes, then the chosen answer arrives as one streamed sequence. Expect the first byte after the slowest candidate plus the judge. Use it for hard, self-contained problems, not for agent loops.

Special-purpose aliases

AliasSurfaceServes
codai-embedPOST /v1/embeddingsvoyage-code-3
codai-transcribePOST /v1/audio/transcriptionsWhisper
codai-ttsPOST /v1/audio/speechNeutral TTS voice (alloy default)
codai-tts-expressivePOST /v1/audio/speechgpt-4o-mini-tts — takes instructions
codai-speechPOST /v1/audio/speechGoogle Chirp 3 HD — 30 native Romanian voices (Aoede default), fast
codai-speech-expressivePOST /v1/audio/speechGemini 2.5 Flash TTS — native Romanian, takes instructions
codai-tts-roPOST /v1/audio/speech/streamAzure neural voices (ro-RO Alina / Emil) streamed with visemes and word timing
codai-musicPOST /v1/audio/musicLyria 3 Clip — 30 s with vocals and lyrics
codai-music-proPOST /v1/audio/musicLyria 3 Pro — full song up to 184 s with vocals, lyrics, bpm
codai-music-legacyPOST /v1/audio/musicLyria 2 — 30 s instrumental WAV
codai-sfxGET /v1/studio/sfxStudio sound-effects library — curated CC0 sounds + Freesound CC0 fallback, free (details)
codai-realtimeWSS /v1/realtimegpt-realtime-2.1 (OpenAI Realtime protocol)
codai-transcribe-liveWSS /v1/realtimeStreaming STT only, no model reply; ?language=ro runs on Deepgram Nova-3 when configured
codai-voiceWSS /v1/realtimeGemini Live native audio (Gemini Live protocol)

Details and examples are on the embeddings, audio & realtime page.

Direct upstream names

You can bypass aliases and name a concrete model — claude-sonnet-5-5, gpt-6.1-sol, gemini-3.8-flash, grok-4.6 and so on — when your plan allows it. GET /v1/models returns exactly what your key may address, aliases and concrete models alike:

curl https://ai.codai.ro/v1/models -H "Authorization: Bearer $CODAI_API_KEY"
{
  "object": "list",
  "data": [
    {
      "id": "codai",
      "object": "model",
      "created": 0,
      "owned_by": "codai",
      "codai": {
        "kind": "alias",
        "type": "chat",
        "routesTo": ["claude-opus-5-5", "claude-fable-5-1", "claude-opus-5", "claude-sonnet-5-5", "claude-sonnet-5", "claude-haiku-5-5", "claude-haiku-4-5"],
        "capabilities": { "tools": true, "vision": true, "streaming": true, "maxInputTokens": 1000000, "maxOutputTokens": 128000 }
      }
    }
  ]
}

The codai object is a non-standard extension; OpenAI-compatible clients ignore it, IDEs read it to size their context indicators. owned_by is codai for aliases and codai-upstream for concrete models.

Public catalog

GET /v1/public/models needs no key. It returns the curated list of models codai names publicly, filtered by what the gateway routes right now: a model that is dropped from routing disappears from the response within minutes. It also lists codai's own open-weight models, which run on your device and are never routed by the gateway. CORS is open (*) and responses are cacheable for an hour, so websites can read it directly.

curl https://ai.codai.ro/v1/public/models
{
  "object": "list",
  "updated": "2026-10-11T12:00:00.000Z",
  "live": true,
  "aliases": [
    { "id": "codai", "description": "The default. Routes each request across Anthropic's current Claude models by task tier: …", "routesTo": ["claude-opus-5-5", "claude-fable-5-1", "claude-sonnet-5-5", "claude-haiku-5-5"] },
    { "id": "codai-fast", "description": "…", "routesTo": ["claude-haiku-5-5", "claude-haiku-4-5"] }
  ],
  "data": [
    { "id": "claude-opus-5-5", "name": "Claude Opus 5.5", "provider": "Anthropic", "family": "Claude Opus", "via": ["Google Vertex AI", "Microsoft Azure AI Foundry"], "tier": "large", "kind": "chat", "released": "2026-09-22", "own": false, "highlight": true, "aliases": ["codai"] },
    { "id": "gpt-6.1-sol", "name": "GPT-6.1 Sol", "provider": "OpenAI", "family": "GPT-6", "via": ["Microsoft Azure AI Foundry"], "tier": "large", "kind": "chat", "own": false, "highlight": true, "aliases": [] },
    { "id": "codai-nano", "name": "codai-nano", "provider": "codai", "family": "codai-nano", "via": ["on-device"], "tier": "small", "kind": "chat", "own": true, "highlight": true, "aliases": [], "base": "google/gemma-4-E2B-it", "note": "Runs on your Android phone in the codai app (LiteRT-LM). …" }
  ]
}
FieldMeaning
livefalse when the gateway could not read its routing table; data is then the full curated list and the response is cached for 5 minutes only.
aliases[].routesToThe live chain of each public alias, lane duplicates removed.
data[].aliasesWhich public aliases can route to the model. An empty list means you reach it by name, on plans that allow it.
data[].tiersmall, medium, large or frontier.
data[].previewtrue while the upstream still labels the model preview.
data[].own, base, notecodai's own models: open-weight base and where it runs.

Whether your key may call a model is decided by GET /v1/models, not by this list.

How resolution works

Each alias carries a chain of { provider, upstreamModel } entries. On every request the gateway walks the chain, skips adapters currently marked unhealthy, and dispatches to the first healthy one. The chain is data, refreshed from the registry every minute — adding or swapping an upstream changes no client code. Your key's allowlist (if the tier sets one) is applied to the resolved model, not the alias, so a tier that allows codai also allows codai-fast.

Effort and thinking

Reasoning depth is a dial, not a model. Set it per request in either of two equivalent ways:

curl https://ai.codai.ro/v1/chat/completions \
  -H "Authorization: Bearer $CODAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Codai-Effort: high" \
  -d '{ "model": "codai", "messages": [{ "role": "user", "content": "Prove that √2 is irrational." }] }'

The header wins when both are present. When neither is set, the gateway uses medium. Tiers, from cheapest to most expensive:

TierThinking budgetWhen
minimalnoneLookups, formatting, classification.
low4 096 tokensSmall edits.
medium8 192 tokensThe default. Everyday coding and writing.
high16 384 tokensHard bugs, design questions.
max32 768 tokensProofs, long multi-step plans. max is a codai extension over OpenAI's low/medium/high; the Responses API maps xhigh to it.

You can also enable extended thinking directly: X-Codai-Thinking: 1 turns it on, X-Codai-Thinking-Budget: <tokens> sets the budget (default 16 384).

Continuation dampening

In an agent loop, most turns are the model consuming a tool result rather than starting a task. On those tool-continuation turns the gateway clamps any injected thinking budget to 4 096 tokens so a 30-step loop does not pay the full max bill 30 times. Fresh user turns keep the full budget.

If you need the full budget on every step — a long proof carried across tool calls, for instance — send X-Codai-Thinking-Pin: 1. The response header x-codai-effort-continuation-dampened: 1 tells you when the clamp fired.

What the response tells you

HeaderMeaning
x-codai-effortThe effort tier the gateway resolved.
x-codai-effort-appliedtrue when the tier changed the upstream call; false when the model does not take an effort parameter.
x-codai-effort-continuation-dampened1 when the continuation clamp applied.
x-codai-routed-toThe concrete upstream model.

Last updated:

On this page