Virtual Models & Routing
When smart routing is enabled, three virtual model names become available. The proxy classifies each request and routes it to a configured model. When the routing judge is enabled, an ambiguous first turn may also make one short call to a judge model. The judge is off by default and starts in shadow mode.
| Virtual model | Intent |
|---|---|
fast | Cheapest capable model; strong cost pressure |
auto | Balanced (default bias) |
best | Quality first; cost secondary |
Names are case-insensitive. GET /v1/models lists them with "provider": "routing".
Enabling
Two settings are required:
- Enable smart routing under Settings → Advanced → Smart Routing (
server_config.smart_routing). - Mark at least one model with
auto_eligible: trueso it enters the candidate pool.
Configure the candidate pool with these model fields:
| Field | Effect |
|---|---|
auto_eligible | Includes the model in the routing pool (default false) |
quality_tier | economy, balanced, or premium; missing or invalid values default to economy |
context_length | Excludes the model if estimated input + max output does not fit |
supports_images | Required for requests containing image content |
routing_assignments | Restricts a model to specific modes (e.g. ["fast", "auto"]); unset allows all modes |
| Pricing | Predicted cost is a primary scoring signal |
If smart routing is enabled with no eligible models, requests to auto, fast, or best fail with a configuration error.
Request classification
Each request is scored from its metadata (tool use, images, token limits, model hints) and message text, producing a complexity score and a public tier: SIMPLE (below 0.33), MEDIUM (below 0.67), or COMPLEX. Every decision is recorded in log metadata (routing_complexity, routing_confidence, routing_reasoning, routing_cost_estimate, routing_savings, routing_tier, resolved_model).
Routing judge
Optional and off by default. A routing judge is a System One decision model consulted when the built-in classifier is uncertain. When the judge returns a verdict, that verdict sets the tier for the request.
Operational behavior:
- Only first turns are judged, and background requests (
background: trueon/v1/responses) are never judged. The judge sees the current user prompt, a configured number of earlier user turns, and capability flags, never assistant or tool output. - By default, only
autoandbestconsult the judge.fastis excluded to avoid extra latency and cost. - A configurable gate controls which first turns call the judge: a confidence threshold, a half-open complexity band, and
not_low_anchor(skip turns already placed at complexity0.0). All gate predicates are off by default so shadow mode can collect data before enabling live overrides. - Optional consumption thresholds (
apply_min_confidenceandapply_min_escalation) control which verdicts are applied. When set, verdicts that clear neither threshold are logged in full while the built-in tier stands (judge-held=in routing reasoning). When both are unset (default), every non-abstaining verdict is applied. - Capability floors (vision, structured output, final verification) and routine caps still apply after the judge sets the tier.
- Any failure (timeout, HTTP error, unparseable response,
ambiguousverdict, or open circuit breaker) falls back to the built-in classifier. - Shadow mode (the default when enabled) records what the judge would have chosen without changing the routed model. It also samples a small share of turns that did not trigger the gate.
- Each judged turn makes one upstream call billed as input tokens on the judge model.
deadline_smust cover the judge model's response time, including cold start for local models. Timeouts fall back to the built-in classifier and record the reason inrouting.judge.error. - Each judge call is logged as its own row under the
judgelog type, attributed to the triggering request and API key budget. It appears under the Judge Calls tab in Logs and does not increment client request counts. The triggering request stores the verdict underrouting.judge.
Configure the judge under Settings → Advanced → Smart Routing → Routing Judge (server_config.smart_routing.judge). The picker lists models marked supports_systemone.
Training data export
Export routing feedback and judge shadow verdicts as JSONL via the admin API:
GET /api/routing/export/dataset?format=feedback|judge_shadow|allfeedback: explicit user feedback labels with the routed prompt and tier decision.judge_shadow: recorded judge verdicts with the built-in decision, verdict distribution, and user feedback when present.
Responses stream in ascending time order. Paginate large exports by passing since with the newest timestamp seen and limit up to 50,000 rows per corpus.
Model selection
Candidates must pass hard gates first: key/user allowlist, context length, image capability, and budget. Remaining candidates are scored by:
- Predicted cost from the model's effective pricing.
- Quality alignment between the request complexity and each model's
quality_tier. Per-mode quality weights (fast0.35,auto0.65,best1.0; configurable) control the quality-vs-cost tradeoff. A relative quality gate excludes candidates below 50% (fast), 60% (auto), or 85% (best) of the best available quality. - Historical performance: observed reliability, latency, cache hit rate, and explicit user feedback.
- Conversation continuity: prefers the model used in earlier turns of the same conversation (requires Redis, 30-minute window), accounting for retained prompt cache savings.
- New or under-sampled models receive occasional traffic so the router can measure their performance; this is disabled during tool/agent steps.
If no model qualifies, the request fails with a structured 4xx error:
400 no_available_models: no image-capable or context-feasible model.403 allowlist_exhausted: no model permitted by the key's allowlist.400 routing_constraints_unmet: other routing constraints could not be met.429 budget_exceeded(insufficient_quota): exceeds the configuredmax_costcap.
With Graceful Degradation (smart_routing.graceful_degradation) enabled, two preferences relax instead of failing the request (recorded as degraded=... in routing reasoning): a routing_assignments filter that empties the pool is ignored, and if no model fits input plus output, a model that fits input tokens alone is used. Image capability, allowlists, and budget caps are never relaxed.
Feedback
Rate a smart-routed decision via POST /api/me/feedback or from the log detail view:
| Signal | Meaning |
|---|---|
ok | Right model |
weak | Too weak for this request |
strong | Stronger than necessary |
Feedback applies only to smart-routed requests: 422 if the request was not routed, 409 if feedback was already recorded (one rating per request), and 404 for non-admins rating a request that is not their own.
Diagnostics
Enable Routing Diagnostics in Settings → Advanced → Smart Routing to include candidate scorecards, signal details, weights used, and guardrail notes in request logs. Every smart-routed request includes the routing block, and routing.judge (gate, shadow flag, verdict, distribution, latency, input tokens, cost, error) is always recorded when the judge runs, even with diagnostics off. See Judge Calls.
Operational notes
- Virtual models are chat-only: embeddings, images, and audio endpoints reject them.
- Allowlists are checked against the resolved concrete model, so a key restricted to specific models can still use
autowithin its allowlist. - Conversation continuity and sticky-provider state require Redis; without it, each request is scored independently.
GET /api/routing/export/dataset?format=feedback|judge_shadow|all