A router is the middleware layer between your application and every model provider. It inspects each request and decides which model handles it, so your application never talks to a provider SDK directly (the MLflow routing guide). That placement matters: routing decisions happen at two points in the request lifecycle. Pre-generation routing picks a model before any tokens are generated, based on prompt length, detected intent, keyword matches or embedding similarity. Post-generation routing (a cascade) lets a cheap model answer first, then escalates only if the output fails a confidence or correctness check (the MLflow routing guide).
Before you write thresholds, decide what the policy is optimizing for. Three goals pull against each other:
| Goal | What it pushes you to do | What it costs |
|---|---|---|
| Cost per resolved task | Route routine work to the cheapest tier | Wrong answers on hard cases |
| Latency budget | Skip cascades on interactive paths | Frontier prices on chat traffic |
| Reliability | Prefer proven models and fallbacks | Higher spend, less experimentation |
The rule that survives most case studies: a wrong cheap answer costs more than an unnecessary frontier call, so bias thresholds toward quality until production evidence says otherwise (the routing economics analysis). Optimize cost only on traffic where a cheap answer is verifiably good.



