Intelligent routing
Select models automatically without silently widening privacy constraints.
Use model: "/auto" when AnonRouter should choose an eligible model for the
request. The values auto and anonrouter/auto are accepted aliases, and any
model string containing a * glob (for example meta-llama/*) also triggers
automatic selection over the matching routes.
{
"model": "/auto",
"messages": [
{
"role": "user",
"content": "Review this distributed system design."
}
],
"routing": {
"strategy": "balanced",
"max_cost_usd": 0.02
}
}The ticket you issue must also be automatic. Request a ticket with the same
/auto or glob model, then send the completion with the matching value.
The routing object
The optional routing object shapes the candidate set and the choice:
| Field | Values | Purpose |
|---|---|---|
strategy | cost, balanced, quality | Trade off model quality against price. Defaults to balanced. |
privacy_classes | array of anonymous, private, tee, e2ee | Restrict eligible privacy tiers. |
max_cost_usd | number | Drop candidates whose worst-case cost exceeds this. |
allow | array of glob patterns | Restrict candidates to matching models or providers. |
exclude | array of glob patterns | Remove matching models or providers. |
strategy controls quality and price, not privacy. cost prefers cheaper,
lower-tier models, quality prefers the highest quality tier, and balanced
sits between them and can step up for complex prompts.
{
"model": "meta-llama/*",
"messages": [
{
"role": "user",
"content": "Analyze this TypeScript API."
}
],
"routing": {
"exclude": ["*/*-guard"],
"strategy": "cost"
}
}Exclusions always win, and allow/exclude patterns match against both the
provider/model form and the bare model id.
Privacy is never widened
When privacy_classes is omitted, the eligible set defaults to the
privacy-preserving tiers (private, tee, e2ee). Automatic routing never
silently adds a weaker tier. To let /auto also consider Anonymous routes, you
must ask for it explicitly:
{
"model": "/auto",
"messages": [{ "role": "user", "content": "Summarize this text." }],
"routing": {
"privacy_classes": ["anonymous", "private"]
}
}If no model satisfies the constraints, the request fails closed rather than downgrading to a route you did not allow.
TEE and E2EE are not auto-selected
Confidential (TEE) and end-to-end encrypted (E2EE) routes require a client
attestation handshake, so /auto never selects them. Address a TEE or E2EE
model by its explicit id. In practice /auto chooses a Private route by
default, or an Anonymous route if you opt in.
Response headers
Successful requests report the actual selection:
x-anonrouter-selected-modelis the chosenprovider/model.x-anonrouter-routingisautowhen a model was selected automatically, orexactwhen you named a single model.
The response body's model field is also rewritten to the selected model. Any
classification the router computes to make the choice is used in memory and is
not stored as durable usage metadata.
Saved routing preferences
An account can save default routing behavior that applies when a request does not override it. Preferences are managed with a session.
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/routing/effective | List models the caller's saved preferences allow. |
GET | /v1/routing/preferences | Read saved routing preferences. |
PUT | /v1/routing/preferences | Replace saved routing preferences. |
POST | /v1/routing/preview | Preview a routing decision for a sample prompt. |
POST | /v1/routing/eligible-models | List models eligible for draft preferences. |
Preferences carry a privacy_level that maps to a default privacy set:
openallowsanonymous,private,tee, ande2ee.balancedallowsprivate,tee, ande2ee.maximumallows onlyteeande2ee.
A pool_mode of all, include, or exclude with model_patterns narrows the
default candidate pool, and strategy sets the default quality tradeoff.