A coding agent can look productive while quietly turning every pull request into a mystery invoice.

The dangerous part is not one large model call. It is the normal-looking session that rereads the same context, waits on blocked approvals, retries weak plans, jumps between tools, and still ships a tiny diff. If you build AI features, internal agents, or developer platforms, you need more than a monthly model bill. You need a cost ledger that explains which agent sessions were worth it, which ones drifted, and which patterns should never become default.

This guide shows how to design that ledger without buying into hype or turning every developer into an accountant.

Why agent cost is harder than API cost

Classic API spend is usually simple: