Stop Funding the Frontier
Intelligent Model Routing. Real-World Validation. Frontier-Class Margins.
Your AI bill keeps climbing and you cannot prove a cheaper model keeps up. Build the trace logger, the eval harness, the router, and the one-page swap you can defend. Measured on your own work, not a vendor's benchmark.
Every “cut your AI costs” book measures its own system, not yours. This one hands you the measurement: a trace logger, an evaluation harness, a ranked shortlist scored on your tasks, and a router that sends each job to the cheapest model that still wins. 242 pages of runnable code, from first trace to defended swap.
The trace logger, eval harness, router, and analysis tools all ship as a free companion repo, organized by the chapter that builds each file. It runs the moment you clone. No key, nothing to install.
What You'll Build
The frontier tax: money you hand the most expensive model for work it never needed to do.
Break your own bill into four line items. Thinking tokens bill at the output rate.
The only two units that matter: cost per finished task and the quality delta.
Forty minutes wrapping your client in a logger that records real cost with a task tag.
Replay your own traces on a cheaper model and score exactly what changed.
Ollama, vLLM, OpenRouter, LiteLLM, open-weight hosted. Three candidates behind one interface.
A lookup, not an oracle. Route the easy work cheap, keep the hard work on the frontier.
A tiered agent where the frontier plans and verifies while cheap models do the work.
Put every token-savings trick through a scorer. Keep what survives, bin the rest.
The one page that ends the argument. Subscription or API, settled in your own numbers.
The keep-list and the guardrail that catches a cheap model failing before your users do.
One command, a fresh recommendation. The monthly re-measure that survives the next price change.
Free Articles from this Book
Can DeepSeek Replace Claude on Your Code Reviews?
Replay 40 of your own code reviews against DeepSeek, score both models with the same pass test, and you get the sentence nobody in any thread can produce: it passed 22 where Claude passed 31, at 4.5% of the cost. Score Claude on the same traces or the number is worthless.
from: Stop Funding the Frontier
Route Changelogs to DeepSeek, Keep Claude on Code Review
Generate the routing table from your own scorecards and every rule carries the number that justifies it: the changelog moves at 0.6% of the cost with the pass rate held, and code review stays on Claude because no candidate cleared the bar. The rule that makes it safe is 5 words: no number, no route.
from: Stop Funding the Frontier
Claude Plans, DeepSeek Works: Is a Tiered Agent Actually Cheaper?
Split one agent so Claude plans and verifies while DeepSeek workers carry the volume, and you can price the bill per role instead of guessing which tier to tune. The saving is not the cheaper model, it is that Claude stopped reading things, which is also why the same split costs some teams 15x more.
from: Stop Funding the Frontier
OpenRouter vs LiteLLM vs Ollama: Which One Should You Use?
All 3 answer how to reach a cheap model, not which one can do your job. Wire them behind one function, score the whole cheap tier on your own tasks by changing one string, and check the 3 things that disqualify a provider before price: context fit, data terms, and a free tier that stops dead at 50 requests a day.
from: Stop Funding the Frontier
How DeepSeek Can Fail 19 Times in 20 and Still Beat Claude on Cost
One line of arithmetic gives you the maximum failure rate a routed task can carry, and at a wide enough price gap that number is 95.5%. Narrow the gap and the same setup starts losing money at 3 misses in 10, which is why the model to reach for is the cheapest acceptable one, not the cheapest good one.
from: Stop Funding the Frontier