"Save your strongest magic for the problems that need it. Routine work deserves a good tool, not your last reserve." Professor Synapse
AI model routing means choosing which AI system should handle each piece of work, instead of sending every job to the same one. Our router is task-first: it decides how much judgment a task needs before it checks which subscription has allowance to spare, then names a model, its backups, and a one-line reason. This post walks through how we built it, the numbers it uses, and what it still cannot see.
A few words first, because the rest of the post leans on them. An AI model is the system underneath an AI tool, the part that reads your request and writes the answer. The models behind tools like Claude or ChatGPT are large language models, or LLMs: systems trained on huge amounts of text and code so they can read and write both. The company that offers a model is its provider. Many providers also let you set how much effort a model puts in, meaning how long it thinks before it answers.
Hitting the overnight quota wall
Several of our scheduled overnight jobs stopped. They had reached a provider's weekly usage limit, and the work ended there.
That limit comes from how our AI subscriptions work. We do not pay per question. Each monthly plan comes with usage windows, which are timed allowances: a short allowance that resets every few hours (every five hours on some of our plans), and a weekly allowance that has to last all seven days. Your quota is how much of an allowance you have left. When it runs out, work on that account stops until the window resets.
We run AI agents on three machines. An AI agent is an AI assistant that works through a multi-step job on its own: reading files, making changes, checking the results, and reporting back. Some agents act as orchestrators, the managers of the group, which split a big job into pieces and coordinate the work. An orchestrator can start subagents, helper agents that each take one piece so several pieces move forward at the same time. Scheduled background jobs, subagents, and the sessions where a person works with an agent directly all draw on a small set of pooled accounts, which are shared team subscriptions that every agent uses.
Before we had a router, whoever started a task picked its model, one decision at a time, and nothing tracked how fast each weekly allowance was emptying or what might need it later. (We wrote about how we direct a crew of agents, with people approving each stage, in Directing AI Agents Like a Small Animation Studio.)
That overnight stop made the gap concrete. We needed something to decide, for every task, which model should do it and whether that model's allowance could afford it.
Why cheapest-first LLM routing was the wrong default for us
LLM routing is the same idea applied to large language models, and most writing about it starts from cost: send each request to the cheapest model that can probably handle it, and step up to a stronger model when the answer falls short. That works well when requests are many and alike.
Our work is not alike. One day can hold a decision about how a piece of software should be structured, an article a client will read, a change to how a database stores information, and dozens of small formatting jobs. A cheaper model that gets a design trade-off slightly wrong does not save anything. Someone pays for it later in review and rework.
Our constraint was different too. Most of our model access comes through subscriptions with usage windows, so the scarce resource is not dollars per request. It is how much of our flagship model's weekly allowance is left when a hard problem shows up late in the week. The flagship is the strongest model we use, the one we want free for the hardest thinking.
How our task-first model routing works
Our model routing starts with a question a person can answer in a few seconds: how much judgment does this task need? Every task goes into one of seven classes, and each class has its own ordered list of candidate models: a first choice, then backups to try in order.
Where the table uses an engineering term, the plain meaning comes first and the term follows in parentheses.
| Task class | Typical work | First choice |
|---|---|---|
| Favored | Complex design, subtle trade-offs, deciding how software is structured, high-craft writing | Flagship reasoning model |
| General | Clear, well-defined edits, starter code (scaffolding), docs, research summaries | A second provider whose short window resets every five hours |
| Backend | Connections between software (APIs), databases, scripts, command-line tools, automated data handoffs | Coding specialist model |
| Audit | Code audits, security and correctness reviews, checking finished work | Coding specialist at an extra-high effort setting |
| Fix | Problems an audit found, bug fixes, repairs to automated tests | Coding specialist model |
| Hard-backend | High-risk rewrites of existing code (refactors) and timing bugs where two actions collide (concurrency bugs) | A separate model kept for that work |
| Quick | Formatting, quick lookups, simple sorting of requests, mechanical edits | A low-effort setting on the shield provider |
The general class changed how we think about quota. Routine work makes up much of what agents do, and if it all lands on the flagship model, the weekly allowance is gone before the hard problems arrive. Sending it first to a provider whose short window resets every five hours turns that window into a shield. It absorbs the everyday load and refills in hours instead of days, so the flagship's weekly allowance stays available for favored work.
Favored tasks get one more protection. When the flagship's allowance passes its early-warning line (we explain those lines below), the router keeps favored work on it anyway and moves away only at the hard stop line. For every other class, an early warning is a reason to try the next candidate.
The quick class is the only one allowed to switch based on pace alone. The router gives each account a load score, a number for how heavily it is being used. If another option has spare allowance that would otherwise go unused, and its load score sits at least 20 points below the first choice, quick work can move there. That switch never moves quick work onto the flagship model.
Every pick comes back with the chosen model and its settings, the backups in order, and a sentence explaining the choice. When the router moves away from the first choice, the agent mentions it to the person it is working with. An audit request can also name the provider that built the work, so the review goes to a different one (more on that below).

How our AI model router reads quota pace
Usage alone is a poor signal. Using 60% of a weekly allowance is fine on day six and worrying on day two. So the router asks a better question: is this allowance being spent faster than the clock is moving? It compares how much of each window's allowance has been used with how much of that window's time has passed. We call the difference the pace delta.
Think of it like a weekly budget. If 40% of the week has passed and you have already spent 62% of the money, you are 22 points ahead of pace (62 minus 40). In router terms, that provider has a pace delta of +22: it is burning through its allowance faster than the week is passing.
Every number the router uses lives in one settings file. It is a JSON file, a plain-text format that both people and programs can read:
"thresholds": {
"session_soft_pct": 72,
"session_hard_pct": 90,
"weekly_soft_pct": 80,
"weekly_hard_pct": 95,
"weekly_hot_pace_delta": 18,
"weekly_surplus_pace_delta": -8,
"session_surplus_pct": 40,
"lease_session_weight_pct": 6,
"lease_weekly_weight_pct": 1.5,
"default_lease_ttl_seconds": 900,
"stale_snapshot_minutes": 180
}
In plain English: "session" means the short window, such as five hours, and "weekly" means the seven-day one. "Soft" is an early-warning line and "hard" is a stop line. The lease numbers and the 900 seconds (15 minutes) come up in the next section, and the 180 minutes comes up near the end.
Exhausted, hot, healthy, or surplus
Each provider lands in one of four states. It helps to picture traffic lights. The soft cap is a yellow light, an early warning: 72% for the short window and 80% for the weekly window. The hard cap is a red light, the stop line: 90% for the short window and 95% for the weekly window.
- Exhausted (red): a short window at 90% or more, or a weekly window at 95% or more. The router picks an exhausted provider only when every other candidate is exhausted or unavailable.
- Hot (yellow): a short window at 72% or more, a weekly window at 80% or more, or a weekly window at least 35% used with a pace delta of +18 or higher.
- Surplus: weekly use at or below 70% and short-window use at or below 60%, plus either a weekly pace delta 8 or more points under pace, or short-window use at or below 40%. This is allowance that will go unused if nobody claims it.
- Healthy (green): anything that is not exhausted, hot, or surplus.
Short holds (leases) stop parallel agents from piling on
Pace math has a blind spot when work starts all at once. Picture five shoppers who spot the last two items on a shelf at the same moment. Each one sees stock available, and all five reach for it. Agents do the same thing. If an orchestrator sends out five subagents in the same minute, each one reads the same usage check-in, each one sees a healthy provider, and all five land on it.
Our fix is a lease, a temporary hold like the timer an online store puts on your cart at checkout. When an agent picks a model, it can place a lease on that provider. A shared coordinator, a small service that every machine talks to, records the hold. While the lease is active, the router counts it as extra load: 6 percentage points on the short window and 1.5 points on the weekly window. The next agent to ask sees a busier provider than the raw numbers show. Leases expire on their own after 15 minutes, and an agent can release one early when its work finishes.

Cross-model audits and an LLM router policy we can swap
One smaller feature is the cross-model audit. An audit here is a review that checks finished work for mistakes. Letting the same AI check its own draft is like grading your own homework, so we ask a different family of AI models to do it. When one provider's model wrote the code, the agent asking for a review can tell the router to avoid that provider. The avoided provider drops behind every other candidate with healthy quota, so the review goes to a model from a different family whenever one has room.
Another feature is that routing lives in a settings file, not in code. We call that file the policy. Model profiles (a saved name for a model plus its settings), the candidate order for each task class, and every threshold sit in one JSON file. When a new model version ships, swapping it in is one command that updates the profile and pushes the new policy to every machine. The scoring code stays the same, and its core uses only the Python standard library, the toolkit built into the Python programming language, so it needs no extra packages.
The policy also carries guardrails. One provider account offers some allowances and models we do not want routed through it, so the policy leaves those allowances out of scoring and blocks those models on that provider. A profile that points at a blocked model fails the check the router runs on the policy.
Routing honestly when usage data has blind spots
When we connected live usage reporting, the router started reading a usage feed for our pooled accounts: regular check-ins from each provider on how much of each allowance had been used. Engineers call this kind of data telemetry, and each check-in a snapshot. The weekly reading for our pooled account came through. The short-window readings did not.
Real usage data is usually partial, and the router is built for that:
- The router marks a provider with no readings as unknown rather than healthy. The policy then says how to treat unknown. Ours currently treats it as healthy so work keeps moving, which is a visible choice we can change, not a fact about the provider.
- It flags any snapshot older than 180 minutes (three hours) as stale, meaning out of date.
- When two machines report on the same provider, the router keeps the snapshot that has real usage windows over one that has none, and otherwise keeps the fresher one.
The lesson we took from this: give the router usage evidence with its gaps stated, and check scheduled outputs separately instead of assuming a backup choice worked. Whether the next overnight run picks a usable provider when its preferred account hits a weekly limit is the question we are watching now.
How to optimize LLM costs with model routing on a small team
You do not need our code to use the idea. If your team pays for two or three AI subscriptions, a few habits cover most of it:
- Sort work by judgment before you sort it by price. Write down which tasks need your best model, and treat everything else as routine.
- Give routine work a home that is not your best model. Any model with its own fast-resetting allowance can act as the shield.
- Watch pace, not just usage. Ask how much of the week is gone, not only how much of the allowance is gone.
- Keep the builder and the reviewer on different models.
- Write the rules where you can change them, so a new model release means editing a setting instead of rebuilding a workflow.
- Say what you cannot see. A missing usage number is a gap to check, not good news.
For a small nonprofit or business, the same logic protects the one paid AI account everyone shares. If you want help sorting your team's AI work this way, book a call with us or start with our AI readiness assessment.
Frequently Asked Questions
What is model routing in AI?
Model routing in AI is choosing which AI model should handle each task or request, instead of sending everything to one default. A router can weigh how hard the task is, cost, remaining allowance, or speed. Ours weighs the judgment a task needs first and how fast each allowance is being spent second.
What is an LLM router?
An LLM router is the software that makes that choice for large language models, the systems behind AI chat and coding tools. It takes a task or request, applies rules or a scoring method, and returns which model to use, usually with backups. Ours returns a model, its settings, an ordered list of backups, and a one-line reason.
How can I route AI models efficiently?
Sort tasks by how much judgment they need, then give each kind of task an ordered list of models. Compare how much of each allowance is used with how much of its time window has passed, and move to the next model on the list when a provider is running hot. If several agents start at once, have each one place a short hold on its provider so they do not all pick the same one.
How do you optimize cost using AI model routing?
Send routine work to cheaper or fast-resetting models, and save your most capable model for tasks where its judgment changes the result. On subscriptions with usage windows, cost shows up as used allowance, so track pace against the window rather than spend per request. Sending hard work to a weaker model to save money can cost more in rework.
How do you route LLM requests by cost vs latency?
Latency is the wait between sending a request and getting an answer. Treat cost and latency as separate rules. Our router does not measure latency at all; it routes by task class and quota pace. If speed matters for a kind of work, put a faster model first in that class's list, and let cost or remaining allowance decide among the models that are fast enough.
Which AI model routing tools reduce infrastructure costs?
We have not tested commercial routing tools for this post, so we will not rank them. Whatever you choose, check that it can route by task type, read your real usage limits, explain each decision, and tell you when its data is missing. Without those, a router can hide a cost problem instead of solving it.