Course outline
The CTO's playbook for AI coding agents · Module 5: Token economics
Cost levers that don't hurt quality
Cut AI spend where it is wasted, not where it pays off: model routing, context hygiene, caching, loop caps and killing low-value usage, judged by cost per merged change.
Lesson 19 / 20 · ⏱ 8 min
When the bill gets attention, the reflex is a blunt instrument: a cheaper model for everyone, or a spending freeze. Both save money and quietly cost more, in slower reviews, more rework and engineers who stop trusting the tools. The better move is to cut the waste and protect the work that pays off.
✕ Blunt cuts
- –Downgrade every team to the cheapest model
- –Freeze new seats until next quarter
- –Track total spend as the only number
- –Ban CI agents after one bad month
✓ Targeted cuts
- +Route by task: small model for simple work, top tier where it earns it
- +Fix context bloat and runaway loops first
- +Track cost per merged change next to quality
- +Cap and tune automations, then keep the useful ones
Six levers, ranked by safety
| Lever | What you do | Typical effect | Quality risk |
|---|---|---|---|
| Kill runaway loops | Turn caps per task, stop after repeated identical failures | Removes the worst spikes | Very low: those runs were producing nothing |
| Context hygiene | Targeted file loading, trimmed logs, fresh sessions with summaries | Smaller input on every call | Low, often positive: less noise, sharper output |
| Caching | Keep system prompts and instruction files stable so repeats hit the cache | Cheaper repeated input | None, if the prefix stays correct |
| Kill low-value usage | Retire automations nobody reads, unused seats, duplicate tools | Straight savings | Low, if you check with owners first |
| Model routing | Small or mid model for lookups, renames, boilerplate; top tier for design and hard bugs | Large, on high-volume tasks | Medium: measure before and after |
| Batch and schedule | Run non-urgent background jobs off-peak or in batches where pricing rewards it | Moderate | Low, but slower feedback |
Start at the top. The first three are nearly free wins; model routing saves the most but is the one that can bite if you skip measurement.
The number that keeps you honest
Total spend tells you how much. It doesn’t tell you whether it was worth it. Pair it with:
Cost per merged change = AI spend for a team in a period ÷ changes merged in that period that stayed merged (not reverted within, say, two weeks).
Read it next to your quality signals from Module 2: change failure rate, review time, rework. A lever is good when cost per merged change drops and quality holds. If cost drops and reverts climb, you moved the cost into your engineers’ week.
Worth it or waste?
🎮 Worth the spend or waste?
1 / 10 · Score: 0
Sort each usage pattern.
For tooling decisions on the review side, see Choosing AI code review tools.
Before you move on
✅ Key takeaways
0 / 4 completed