LLM router by complexity: what the classifier costs and when routing pays
A complexity router sends easy requests to a cheap model and hard ones to a strong one, but the classifier is a model call too. Measured on AIVAX's Complexity Router: the classifier cost more than the answer to a one-word question. When routing per request pays, and when one model is the better choice.
I asked a routed gateway "What is the capital of Portugal? One word." It classified the question as low complexity, sent it to GPT-6 Luna, and Luna answered with 6 output tokens for a fraction of a thousandth of a cent. The classification that picked Luna cost $0.000161. The answer cost $0.000005. For that request the router spent about 34 times more deciding than answering.
That number is the most useful thing I can tell you about LLM routers. A complexity router sits in front of your models, reads each request, and sends simple work to a cheap model and hard work to a strong one, so you stop paying frontier prices for "reformat this JSON". The saving is real when the requests are big enough and mixed enough. The classifier is a model call too, though, and on short requests it can be most of the bill.
Measured: one classifier call per request
AIVAX's Complexity Router is a gateway whose model is @model-router/complexity. You give it a model for each of three tiers and, optionally, a reasoning effort per tier:
{
"name": "routed-support",
"parameters": {
"baseAddress": "@integrated",
"modelName": "@model-router/complexity",
"modelRoutingParameters": {
"lowComplexityModelName": "@openai/gpt-6-luna",
"lowComplexityModelReasoningEffort": "low",
"mediumComplexityModelName": "@openai/gpt-6.1-terra",
"mediumComplexityModelReasoningEffort": "medium",
"highComplexityModelName": "@openai/gpt-6-sol",
"highComplexityModelReasoningEffort": "high"
}
}
}
The three model names are required and must exist in the catalog; the gateway is rejected at creation otherwise. The effort is optional, and when you set one it replaces the gateway's effort for that tier. I created exactly this gateway through POST /api/v1/ai-gateways and sent it two requests. The response's generation_context.generated_usage lists the classifier and the answer as separate line items, and the Consumed-Credits header has the total:
| Request | Tier and model | Classifier | Answer | Total |
|---|---|---|---|---|
| Capital of Portugal, one word | Low, GPT-6 Luna | 0.000161 (834 in, 372 out) | 0.0000047 (16 in, 6 out) | 0.000166 |
| Postgres failover, 120 words | Medium, GPT-6.1 Terra | 0.000355 (875 in, 1,305 out) | 0.001731 (58 in, 297 out) | 0.002087 |
Two requests show the mechanism, not an average. On the failover question the classifier was 17% of the cost, and that is a small prompt with a short answer. The classifier's input is your conversation plus its own instructions, so it grows with the history it has to read; AIVAX gives it a 32,768-token window and truncates beyond that. Its output in my two runs was 372 and 1,305 tokens, because it is configured to reason at medium effort before it writes {"complexity": "low"}. Both are billed to your account as inference.resolving.routing_complexity.in and .out, at the classifier model's price.
So the arithmetic for whether routing pays is simple to write down. It pays when the money saved by sending requests down a tier is larger than one classifier call per request. With a cheap low tier and a much more expensive high tier, a long conversation that would otherwise all go to the high tier saves a lot per downgraded turn. A stream of one-line questions that would have been cheap on any model saves almost nothing and pays the classifier every time. The Consumed-Credits header and the usage lines give you both sides of that per request, so you can compute it on your own traffic instead of trusting a vendor's savings figure, mine included.
How the classifier decides
The classifier reads the conversation but labels only the last user message. Fact lookups, basic classification, reformatting and greetings are low; comparison, explanation and summarization are medium; deep reasoning, multi-step work, system design and non-trivial debugging are high. Its instructions say to pick medium when it is unsure, and if its output cannot be parsed, AIVAX logs the error and treats the request as medium rather than low. The classifier is not one model: AIVAX tries five small models in order, on zero data retention providers, and fails the request only when none of them is usable. There is no silent fallback to a tier, so treat that error as retryable.
The classifier runs on a small model with no multimodal input. On a non-streamed response its decision comes back in the X-Model-Routed-Complexity response header as Low, Medium or High, and the response's model field names the model that answered. After the model is chosen, a separate step picks the provider for it, using the gateway's routing preset (Balanced, Cheapest, Fastest, Quality or Special); provider routing is configured independently of the complexity tiers.
A minimal call, from a server with a private key, reads the tier and the cost together:
const response = await fetch("https://inference.aivax.net/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AIVAX_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: process.env.AIVAX_ROUTING_GATEWAY_ID,
messages: [{ role: "user", content: "Compare these two designs." }],
}),
});
if (!response.ok) throw new Error(`Inference failed: ${response.status}`);
const completion = await response.json();
console.log(
response.headers.get("X-Model-Routed-Complexity"),
completion.model,
response.headers.get("Consumed-Credits"),
);
On stream: true the headers go out when the stream opens, before the router has picked a tier, so X-Model-Routed-Complexity is not sent. Read the model field of the chunks instead: in my streamed run of the Portugal question every chunk named @openai/gpt-6-luna.
Where I would not route
Manifest removed the router from its LLM gateway after four months, and their write-up is the best argument against routers I have read. Their main point is that the prompt is only the trigger: "improve the tests for this repo" is trivial on a static site and enormous on the Linux kernel, and the classifier only sees the sentence. They also note that prompt caching can beat routing on cost, because cache reads are 75 to 90% cheaper and every model switch starts a new cache.
I agree with both, and I think they draw the line in the right place. For a coding agent in a long session, where each turn carries a large shared prefix and the difficulty is discovered through tool calls, I would pin one model and spend the effort on caching; why a prompt cache hit rate is low covers what breaks the prefix. For evals and for any workflow whose behaviour you need to reproduce, a model that changes per request is one more variable to control.
Routing earns its place in front of short, independent, mixed requests: a support or internal assistant where most messages are lookups and a few are real investigations, and where every message starts a fresh, small context. That is where the gap between the low and high tiers is large compared with the classifier, and where a wrong tier costs one bad answer rather than a derailed session. Formatting a legal clause takes little reasoning and deserves a careful model, so put that kind of rule in application code or in a dedicated gateway, not in the hope that the classifier understands risk.
Measure accepted work, not token prices
The comparison that matters is the cost of a completed, accepted task, not the price per million tokens. OpenAI's GPT-6 Sol and Luna announcement shows why: it reports Sol at xhigh effort scoring 33.2% on AutomationBench at $0.27 per task, and Claude Opus 5 at max effort scoring 26.9% at 11.1 times that cost, and on DeepSWE it reports Luna at max effort at 66.6%, close to models costing far more per task. Those are vendor-reported numbers, and the competitor scores come from published reports rather than OpenAI's own runs. They still show that a cheaper model at higher effort can beat a frontier model on cost per success, which is why cost per accepted task is the number to compare when you set a tier's model and effort.
To find out whether it holds for your traffic, log the request, the tier from the header, the configured model and effort, the outcome and the cost from Consumed-Credits together, and keep the gateway configuration version next to them; a tier label without the model it mapped to that day explains nothing later. Compare cost per accepted answer against a single-model gateway on the same sample. A rising share of low-tier answers is good news only if accepted answers hold steady. Replay the failures through the same configuration before you change it, and test whether a higher tier would have fixed them.
If you would rather not configure tiers, the @model-router/* aliases are a different tool: each names a single model per family and size, such as @model-router/openai:budget (GPT-6 Luna today), @model-router/openai:mid (GPT-6.1 Terra today) and @model-router/claude:frontier (Claude Opus 5.5). They move when the catalog moves, they do not classify anything, and pinning a model ID versus using an alias covers when that is what you want. The AI Gateway concepts page documents both.
Ran against the live AIVAX API on 10 November 2026: a temporary gateway with the configuration above and two requests, deleted afterwards. Classifier settings were checked in the AIVAX source the same day. On 18 November I ran the Portugal question again on the same configuration: the classifier cost $0.000179 and $0.000146 in two runs, against $0.0000046 for the answer, so its cost moves from run to run with the length of its reasoning. A streamed run carried no complexity header.