Model routing
Definition
Choosing which model handles each request, often sending easy requests to a small, cheap model and hard ones to a larger model.
In more detail
Routing can be rule-based (by feature, input length or customer tier), learned (a classifier predicts which model will succeed), or a cascade, where a cheap model answers first and the request escalates if a check fails. Gateways also route for reliability, falling back to another provider when one is down.
The savings can be large, because many requests in a typical app are simple. The cost is complexity and quality risk, so measure each route against the same eval set and watch the share of traffic that escalates.
Related terms
AI gateway
A proxy between apps and model providers that gives one API for many models and adds keys, logging, budgets, caching and fallbacks.
Routing (agent pattern)
A workflow pattern where a first step classifies the input and sends it on to a specialised prompt, tool or model for that type.
Small language model
A language model small enough, usually up to a few billion parameters, to run cheaply on a laptop, phone or modest GPU.
Reasoning model
A model trained to spend extra tokens thinking through a problem before it answers, trading speed and cost for accuracy on hard tasks.
Read more about Model routing
- LLM cost optimisation
Cutting LLM costs with caching, model routing, batching and budgets.
- LiteLLM
Open-source SDK and AI gateway that calls 100+ providers through one OpenAI-style API.
- OpenRouter
One API and bill for models from many providers, with routing and fallbacks.