Gateway
Routing with Conifer Router
Let a router pick the model for each message: the workspace’s default, one you saved, or one you send with the request.
LLM routing is choosing which model answers each request. In Conifer Gateway, a request asks Conifer Router to choose by sending a router’s name where a model id goes. This page covers the names, how a router decides and the settings it weighs, saved routers and their versions, fallbacks, and how an answer says which model served it. Conifer Router says what the router is for.
Ask a router
| In the model field | Who chooses |
|---|---|
auto | The workspace’s default router. |
custom-router-<name> | A router saved in the console, at its live version. The name after custom-router- is 1 to 32 lowercase letters, digits and hyphens, starting with a letter or a digit. |
manual-router | A router whose settings the request sends in its body, below. |
beta-auto | Another of Conifer’s routing systems, with the settings of the workspace’s auto. |
A router is called by its name alone: one with a version after an @ answers 400, and a saved router that isn’t deployed yet, or was deleted, answers 404 router_not_found. beta-auto asks Jev, below, on every message and at every level, among its whole pool, and answers as beta-auto at the version of the workspace’s auto.
How the router decides
auto, every saved router and manual-router decide the same way. For each message, the router asks Jev, a routing model, which of the models it may pick to use. From the automatic pool it offers the models that no other beats on both Conifer Intelligence and Conifer Cost Per Task; from a pool picked by hand, every model the request can use. It sends Jev a bounded excerpt of the conversation, the router’s level and what it optimizes for, and for each model its maker, its Conifer Intelligence, its cost per task and whether the conversation’s prompt cache is warm on it. Jev’s pick answers, and the others follow in Jev’s order. Jev has two seconds to answer, and asking it adds nothing to what the request costs.
Level 1 takes the cheapest model offered and level 10 the most intelligent, without asking. Below level 5, the lower the level, the more each model’s cost per task weighs; from 5 to 9 it weighs the same. The console calls levels 1 to 3 cost first, 4 to 7 balanced and 8 to 10 quality first.
Where Jev isn’t asked, or doesn’t answer in time, the router’s own rules decide. They read no prompt text: each model is scored as its intelligence less a penalty for its price, which the level weighs, from price alone at level 1 to intelligence alone at 10, and Optimize for tilts the penalty, or, for speed, favours the models that start answering sooner. They decide for a router held to a region; for a pool picked by hand where fewer than two models have a Conifer Intelligence score, which keeps the order written; for a workspace whose balance wouldn’t hold the request on the dearest model it may go to; and for a workspace past its pace of decisions.
A router on the automatic pool answers 404 router_not_found where fewer than two of that pool’s models have a Conifer Intelligence score for the reasoning effort the request asks.
Router settings
These are a router’s settings as the console names them, with the field a manual-router request sends where it can set one.
| Setting | Field | What it does |
|---|---|---|
| Cost / intelligence chart | level | From 1, the cheapest models that do the job, to 10, the smartest. 5 unless set. |
| Optimize for | optimize | balanced, the best quality for the price; quality; cost; or speed, the model that starts answering sooner. |
| Models | pool | The models it may pick, up to 64; or, with Automate model selection on a saved router, the automatic pool: the catalog’s text models that Conifer has marked routable. |
| Custom instructions | instructions | Up to 2,000 characters, added to every request as a system message before routing, and billed as input. |
| Sort providers by | sort | The order of a model’s providers: price (the default), latency or uptime. A saved router may also set its own order and block providers. |
| Data policy | data | Skip providers that may train on prompts, or hold to a region, US only or EU only. See Data handling for what each can reach today. |
| Your provider keys | A saved router only: Use my provider keys first, off unless set. Billing says how they serve. | |
| Fallback | fallback | Up to three models, below; on a saved router, Automate model selection lets the router choose them. |
| Access | A saved router only: up to 32 allowed addresses its requests must come from, and a number of requests a minute of its own. | |
| Pause this router | A saved router only: while paused, every request answers 503 router_paused. |
A workspace that never saved its auto gets level 5, balanced, the automatic pool, an automatic fallback chain, providers sorted by price, no data policy, and its own provider keys off. A request that names a model, or sends manual-router, is still held to the data policy and blocked providers of the workspace’s saved auto.
Save a router in the console
In the console, open Routers and choose New router. Changes wait in a draft: Deploy makes the draft live as a new numbered version on every server within a second, and a router not deployed yet keeps its draft with Save draft. Versions lists the router’s last 100 versions: load one into the draft and deploy it to roll back. A request calls the live version by name, and the answer names the version that served it. Owners and editors make and deploy routers.
curl https://gateway-api.conifer.build/v1/chat/completions \
-H "Authorization: Bearer $CONIFER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "custom-router-coding", "messages": [{"role": "user", "content": "Hi"}]}'Send settings with the request
With manual-router, a request brings its router in a router object: pool is required, from 1 to 64 models, and the other settings are optional. A plain models list of 1 to 64 models works in its place, routed at level 5. Sending both, or either beside another model’s name, answers 400. The gateway never sends either field to the provider.
curl https://gateway-api.conifer.build/v1/chat/completions \
-H "Authorization: Bearer $CONIFER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "manual-router",
"router": {
"pool": ["claude-haiku-5-5", "gpt-6-luna", "gemini-3.8-flash"],
"fallback": ["gpt-6-luna"],
"level": 3,
"optimize": "cost"
},
"messages": [{"role": "user", "content": "Hi"}]
}'Fallbacks
When a router’s pick fails before its first token, the request moves to the next model of its chain: at most three, the listed fallbacks in order, or, when the chain is automatic, the best model of each other lab first. A manual-router request lists them in router.fallback, from its pool; a saved router lists them in its settings. There is no header for fallbacks. Once the first token is sent, the model stays.
A request that names a model never moves to another model. The gateway still moves it between that model’s providers when one fails, as Models explains.
Every message is routed afresh
The router chooses again for each message of a conversation, told which models hold the conversation in a live prompt cache. The gateway recognises a conversation by an id the request carries (Messages’ metadata.user_id, or the prompt_cache_key, user or safety_identifier of Chat Completions and Responses), else a coding tool’s session header (x-claude-code-session-id, x-session-affinity, x-session-id, session-id, session_id, thread-id or conversation_id), else the stored response it goes on from, else by its opening.
Which model answered
A routed answer names the model and the router in its headers and in its body. The version here is an example; an auto nobody has saved answers as auto@0.
x-conifer-model: claude-haiku-5-5
x-conifer-router: custom-router-coding@3
{"model": "claude-haiku-5-5", "choices": [ … ],
"router": {"router": "custom-router-coding@3",
"served": {"model": "claude-haiku-5-5", "provider": "anthropic"},
"fallback": false, "cost_nanousd": 5800}}x-conifer-model: the model that answered, by its catalog id; the body’smodelis the same model as its provider names it.x-conifer-router: the router and its version, absent when the request named a model.- The body’s
routerobject: who served it, whether a fallback answered and why, and the cost. The API reference lists every field.