Where AI coding money actually goes
The instinct is to blame the code the model writes. But an agent spends most of its tokens reading — your repository, its own earlier work, the context re-sent every turn. Understand that and the bill stops being a mystery.

Coding with an AI agent produces a small, visible artifact — a diff, a pull request, a handful of new lines. It is natural to assume that artifact is what you pay for. It mostly isn't.
Before an agent writes anything, it reads. It opens files, searches the repository, inspects dependencies, runs the tests, reads the failures, and carries all of that context forward into every following turn. On a real task the input an agent consumes dwarfs the output it produces — often by two orders of magnitude. That single fact rearranges most cost intuitions: writing less code barely moves the bill, because the code was never the expensive part.
Once you see the cost as the price of understanding rather than the price of generation, the levers change too. A smaller, clearer repository costs less to work in. Caching a stable prefix stops you paying to re-read the same context every turn. Routing routine turns to a cheaper model keeps the expensive one for the work that needs it. None of those are visible in the generated diff, and all of them show up on the invoice.
The guides below trace where the tokens go and what actually lowers the bill — so the next time your AI coding spend climbs, you know which lever to reach for.
- The Hidden Economics of AI CodingAI coding costs come from more than generated code. See how context, prompt caching, model routing, gateways, and observability shape the real bill.
- Why Cutting Generated Code Barely Lowers Your AI BillAI coding agents spend most of their tokens reading and re-reading your repo, not writing code. See where the tokens really go — and what lowers the bill.
About the author
Joubert Berger builds CostCompass, a spend-intelligence dashboard that pulls usage from AI and compute providers into one month-to-date total, a forecast, and a per-provider breakdown. This guide reflects how CostCompass reads each provider's own usage API — see the security model for how your keys are handled.
Track what your coding agents actually cost
Connect each model provider once, then pull one running month-to-date total and a forecast across all of them whenever you look — nothing wired into your code.