Break-even math for 20-turn agent loops: caching and routing cut API burn 76%

TokenMarginDev · reddit · 2026-11-17

Auditing real token logs from multi-turn coding agents (Claude Code, Kilo Code, OpenCode, LangGraph/MCP), the author shows a single 20-turn task consumes 620K cumulative input tokens vs 12K output, making single-turn $/1M tables misleading. Break-even analysis: uncached frontier API at $1.35-2.05/task only makes sense under 15 tasks/month; Claude Max flat $100-200 fits solo heavy CLI use but locks quotas and can't serve CI/CD or SaaS; BYOK + 90% prefix cache + 80/20 routing lands at $0.14-0.26/task for 15-1,200 tasks/month; a dedicated H100 needs >45M tokens/day sustained. Three fixes cut burn 76%: pin provider.order on OpenRouter to preserve KV cache, keep volatile state out of the system prompt, and batch parallel read-only tool calls.

Original post →

More from coding & agent

coding & agent channel →