Auto Routing sends easy requests to a cheap model and hard ones to a capable model, behind one name. Your client calls "model": "smart-chat"; the gateway classifies the turn, picks the tier, and walks a chain of targets that falls back and escalates on failure. It is the complexity strategy of a virtual model, so it shares the same admin API, retry policy, per-target overrides and streaming guarantee. In the console, create it under Gateway → Routing → Add Virtual Model and choose Auto Routing. The config belongs to one workspace and serves requests made in it.

How it works

Configuration structure

Key fields

string
required
simple, medium or complex. A model (including through an alias) can sit in only one tier. Array order is the order within a tier; any number of targets per tier is allowed and tiers may be empty. A tier that has no target sends its requests to the next tier up that has one.
string
required
A concrete chat, completion or responses model, by its gateway name or account/model address. Another routing config cannot be a target, and weight is refused.
object
Omit for the heuristic classifier. llm-classifier requires model and a fallback_strategy; a static fallback requires default_tier.
Every other target field — when, override_params, override_headers, retry, fallback_status_codes, fallback_candidate — behaves as on Virtual Models.

Classifiers

Deterministic, in-process, no network. It reads only the last user message (first 8,000 characters) and the last system/developer message (first 2,000). Each signal adds or subtracts points:A score of 1 or less is simple, 2–4 medium, 5 or more complex. Empty input is simple.

Conversation pinning

A conversation can move up a tier and never back down while active.
  • Identity: X-Session-Id when sent; otherwise a fingerprint of the first system and first user message, read only on multi-turn requests (ones with an assistant message).
  • Scope: organization, routing config and caller. The pin holds no prompt text.
  • Rule: effective tier is max(classified, pinned). A conversation pinned at complex skips classification. A pinned target leads its tier when still eligible.
  • Write: only after a successful, uninterrupted response; failed turns leave the pin alone.
  • Lifetime: 10 minutes of inactivity. With Redis the pin is shared across replicas; without it, it lives in process memory.

Target chain

For effective tier T the chain is: T’s targets in order, then higher tiers ascending, then lower tiers descending. Retry repeats the same target on retry.on_status_codes, up to attempts. Fallback moves to the next entry on fallback_status_codes (default 400 401 403 404 408 413 422 429 500 502 503 504 plus retry codes). A target with fallback_candidate: false serves only when its own tier selects it first.

Response headers

string
complexity
string
The effective tier routing started from.
string
heuristic, llm-classifier, pinned, heuristic-fallback or static-fallback.
string
The full target chain, comma-separated.
string
The tier of the target that answered.
string
The concrete model that served.
All are suppressed when the config sets strict_openai_compliance.

Traces and cost

Each request trace in Gateway → Request Traces has an Auto Routing section: the classification (tier, method, matched signal names, latency, and classifier usage), the pin as read and written, the chain, every attempt, and filtered targets with a reason (metadata_mismatch, not_allowed, model_restriction, unresolvable, ambiguous, budget_exceeded, rate_limited, unsupported_feature). unsupported_feature marks a target whose provider cannot honour the tools, forced tool_choice or JSON output the request needs. Cost is priced from the served model as for any request, plus: Savings are omitted when either model has no price.

Failure behaviour

Examples

Limits and budgets that apply to the requested name are checked once. Limits and budgets written for a target’s own model are checked per target: a target with no room is skipped (rate_limited or budget_exceeded) and the next one is tried. Spend is metered against the model that served. A team with an explicit model list must include smart-chat, and each target is checked separately too.

Next steps

Virtual Models

The other routing strategies and the full config schema.

Budgets & cost tracking

How the served model’s cost is computed.