Skip to content
All patterns
Cost & Reliability

Model router

Route requests to the cheapest model that can handle the query, falling back to stronger models as needed.

How a model router picks the cheapest model that can answer

Step 1 of 5

Request

A request arrives, for example "what are your opening hours?". The router has not picked a model yet.

Cheap models answer the easy traffic; the expensive one is the safety net, not the default.

Request
Classifier
Small model
Large model
Fallback
clientservicemodeldatabaseagentexternal
Explanation

A lightweight classifier scores query complexity. Simple queries go to a cheap fast model. Complex queries go to a frontier model. If the cheap model's confidence is low, fall back to the expensive model.

Components
Query classifier (rules or small LLM)Model registryConfidence scorerFallback chainCost telemetry
When to use
  • High-volume production traffic
  • Mixed query complexity
  • Cost-sensitive products
When NOT to use
  • Low volume — savings don't justify complexity
  • Uniform query difficulty — just pick one model
Failure modes
  • Classifier mis-routes complex queries to weak model
  • Fallback storms during outages
  • Behavioural inconsistency across models
  • Cold start on new model versions
Production checklist
  • Classifier accuracy monitored
  • Per-model cost and quality dashboards
  • Graceful fallback with circuit breaker
  • A/B testing framework for routing rules
  • Model version pinning