Most apps pay strong-model prices for tasks a cheap model does perfectly. Here's how to route by task type instead.

If you're sending every request to the same flagship model, you're probably overpaying by half. The trick isn't picking a cheaper model — it's noticing that your workload is not homogeneous.

Classification, extraction, formatting, and routing decisions are easy. Reasoning, code generation, and nuanced writing are hard. Yet most pipelines hit the same model for both.

The three-tier pattern

incoming task │ ├─ classifier (fast model, ~$0.10/M tokens) │ decides: SIMPLE / MEDIUM / HARD │ ├─ SIMPLE → fast model (trimming summaries, tags, extraction) ├─ MEDIUM → mid model (standard Q&A, short rewrites) └─ HARD → flagship model (multi-step reasoning, code, long context) 

A classifier call costs a fraction of a cent and pays for itself the moment it sends one "summarize this tag" request to a fast model instead of a flagship.

Routing rules that work in practice

Not "model X is smart" — rules you can implement in an afternoon:

Signal Route to
Input < 200 tokens, single-turn, extraction/tagging fast
Multi-step reasoning, code gen, or > 4k context flagship
Previous answer failed quality check (retry) flagship
Provider returned 429/5xx next healthy provider, same tier

The last row matters: routing and failover are the same subsystem. If you're tracking endpoint health anyway (latency, success rate over a rolling window), the router should simply skip endpoints that are currently degraded. One health probe, two benefits.

The retry ladder

TIERS = ["fast", "mid", "flagship"] def complete(task, hints): tier = classify(task) # fast model call for attempt in range(3): ep = pick_endpoint(tier, exclude=dead_endpoints()) try: return call(ep, task, timeout=20) except RateLimited: backoff(attempt) # 1s, 2s, 4s except ServerError: tier = TIERS[min(TIERS.index(tier)+1, 2)] # escalate raise AllTiersFailed 

Two ideas in one loop:

  1. Exponential backoff on 429 — most people retry immediately and make throttling worse.
  2. Escalate tier on 5xx — if the mid model's provider is having a bad day, try the flagship tier's provider rather than sitting in a retry loop. You pay more for that one request, but the job finishes.

What this looks like in real numbers

A typical mixed workload (my own usage, a week):

  • 70% of calls: extraction / classification / short summaries
  • 25%: standard Q&A and rewriting
  • 5%: hard reasoning and code

Flat flagship pricing: 100% × flagship_rate. Routed: 70% × fast_rate + 25% × mid_rate + 5% × flagship_rate. With typical price gaps of 10–20× between tiers, the blended rate lands at 40–60% of flat — and quality on the 5% that matters is untouched, because those calls still go to the flagship.

Don't skip: the trace

Every routed run should append a JSONL line: task id, tier decision, endpoint chosen, attempts, latency, tokens. When something looks wrong weeks later ("why did this batch cost 3×?"), the trace answers it in minutes. Without it, you're guessing.

This is the second half of a system I build for clients: health probe → router → failover, wired to whatever endpoints you already have. If your stack is n8n, Node.js, or Python, the whole thing is a week of my evenings — or an afternoon of yours with the patterns above.

Next post: agent workflows that survive flaky providers — JSONL traces, replayable runs, and why "just retry" isn't error handling.