model: "auto".
This page covers how the pick is actually made, and the one knob you can turn.
Two layers
A routing decision goes through two layers, and the word “weight” means something different in each:- Which algorithm chain runs — traffic is split across named paths by traffic weights. Operator-configured; you observe the result, you don’t set it.
- Which model that algorithm picks — the
weightedalgorithm scores every candidate with scoring weights over quality, cost, and latency. You can influence this per request, withweight_profile.
The algorithms
Each path is an ordered waterfall. Algorithms run in sequence and the first one that returns a model wins; an algorithm that declines (“abstains”) costs nothing and falls through to the next. Every algorithm has its own timeout, and none of them can fail your request — see Nothing here can fail a request.
Which algorithms run, and in what order, is set by the active configuration. See
Traffic weights.
heuristic is deliberately conservative. Any hint of task work, recency, code, links,
more than six digits, more than one line or length over 140 characters makes it
decline. So does a reference to an attachment the fast-lane model can’t read, or a
prompt that is neither a question nor small talk. The request then takes the full path instead. Over-declining is harmless;
a wrong fast-lane pick is not.What the pool is
Every algorithm picks from the same candidate pool: the models the gateway currently serves for that surface, already filtered by your key’s model policy and the request’s capability requirements. An algorithm can only ever return a model you were entitled to call directly.Traffic weights
The active configuration names one or more paths, each with a relative weight, and a path is chosen per request by weighted random.[90, 10] and
[9, 1] are identical. The shape above is illustrative; the live split is an
operating decision and changes without an API change.
Scoring weights
When theweighted algorithm runs, it scores every candidate in the pool:
The three signals
All three are normalised so higher is always better, which is why cost and latency are inverted — a cheap model scores high onC, a fast one scores high on L.
Only the order of a measured index matters, never its magnitude, and a candidate
with no measured score keeps its curated position rather than dropping. Nothing falls
out of the pool for want of a benchmark.
Missing signals degrade, they don’t error
A candidate missing a signal drops that term, and its remaining weights are renormalised to sum to 1. A candidate with neither cost nor latency data is scored on quality alone — so when the whole pool has no cost or latency data,weighted returns
exactly what benchmark would have.
Weight profiles
The(w_q, w_c, w_l) vector is named. Four profiles ship:
Because each candidate’s present weights are renormalised, only the ratio between
w_q, w_c and w_l affects the outcome, not the absolute sum. The table shows the
shipped vectors; the gateway operator can adjust a profile’s vector without an API
change.
Choosing a profile
Sendweight_profile on a chat completions request:
- curl
- Header
- Python
Precedence
The effective profile is resolved highest-first:- Request — the
weight_profilebody field, or theX-Mesh-Weight-Profileheader - API key — the
weight_profileentry in the key’s routing policy - Team / organization — the same entry on the key’s routing-policy template, else your org’s default template
- Gateway default —
balanced
weight_profile applies to POST /v1/chat/completions only, and only while
weighted is the algorithm serving the request. On /v1/responses and
/v1/router/select it is ignored and the gateway default applies. Sending it is
always safe — it is stripped before your request reaches the upstream provider.Previewing a decision
POST /v1/router/select returns the model the Auto Router would pick, without
running inference or billing you for one. Useful for pinning a model yourself, or for
checking what a prompt classifies as.
X-Mesh-Router-Version header. The key needs the router:read scope.
Optional request fields:
The classifier still runs, so a select call takes roughly as long as the routing stage
of a real request.
reasoning_effort is a hint: the benchmark and weighted
algorithms set it from the classification, heuristic returns "none", and it is
null otherwise.Nothing here can fail a request
model: "auto" always resolves to a concrete model. Every layer is fail-soft by
design:
- An algorithm that declines, times out, or errors falls through to the next in the chain.
- A chain that exhausts every algorithm falls through to the configured default model.
- A missing scoring signal drops that term instead of dropping the candidate.
- An unknown
weight_profileon a request degrades tobalanced. - A settings-store outage falls back to the built-in defaults rather than refusing to route.
x_auto_routed_fallback and x_auto_routed_fallback_reason on the
body, or X-Auto-Routed-Fallback and X-Auto-Routed-Fallback-Reason on a stream. A pick
made by a later algorithm in the chain is not a fallback. See
Fallback behavior for the reasons,
and Debug → Auto Routing when a pick surprises you.