What an agent session actually costs, per response
Input, output, cache writes and cache reads are priced differently, and long sessions are dominated by re-read context. Where the money actually goes.
The cost of an agent response is the sum of four separately priced quantities: input tokens, output tokens, cache writes and cache reads. Most surprise bills come from the third and fourth, because a long session re-sends its entire context on every turn.
The arithmetic
A session with 60,000 tokens of accumulated context that takes 40 more turns sends roughly 2.4 million input tokens across those turns, even if the model writes only a few thousand tokens of code. Output is the number people watch and input is usually the number that costs. Prompt caching changes the shape: a cache write costs more than a plain input token once, and subsequent cache reads cost a fraction of one, so a stable prefix is much cheaper on the second and later turns.
| Quantity | When it is charged | Relative cost |
|---|---|---|
| Input | Every token you send | Baseline |
| Output | Every token generated | Several times input |
| Cache write | First time a prefix is cached | Above input |
| Cache read | Every reuse of that prefix | A small fraction of input |
Where the money goes in practice
- Re-reading files. An agent that reads a 2,000-line file three times pays for it three times unless the prefix is cached.
- Failed searches. Broad greps return a lot of context that turns out to be irrelevant, and it stays in the window.
- Long tool output. A verbose test runner can cost more than the code that fixed the test.
- Restarts. A session that loses its context and rebuilds it pays the whole prefix again as a cache write.
Reducing it without hurting the work
Give the agent a precise starting point rather than making it search. Use structural queries instead of repeated text searches. Keep tool output short. Hand off cleanly at the end of a unit of work instead of letting a session sprawl, which is what a handover payload is for. Each of these reduces input tokens, which is where the bill is.
Measuring it
Providers report token counts per response, including cache reads and writes. Multiplying those by a local rate table gives a per-response figure and a running total, which is the number worth showing while the session is happening rather than at the end of the month. Aura keeps a local spend ledger and a rate table on disk for this, so the accounting does not depend on a dashboard.
How much does an AI coding session cost?
It depends on context far more than on output. Long sessions re-send a growing conversation on every turn, so cost climbs with session length even when the replies stay short. The code produced is usually the cheapest part of the bill.
Why are agent sessions more expensive than they look?
Because every turn pays for the whole context again. Input tokens dominate, output is a rounding error, and a session that has read a dozen files carries those files into every subsequent request until it is compacted or restarted.
How do you calculate the real cost of an agent response?
Price the four token classes separately — input, output, cache writes and cache reads — at the rate for that model, then sum them per response. Cached reads are much cheaper than fresh input, so a run without caching and one with it are not comparable.
How do you reduce the cost of AI coding agents?
Keep sessions short and start new ones with a written handover instead of carrying a long transcript. Use prompt caching. Do not paste files the agent can read on demand. And send cheap mechanical work to a smaller model.
Aura Crew vs Claude Code Loops: the autonomous work-loop, compared
Claude Code names four loop types: turn-based, goal, time, proactive. Aura Crew is the same idea with proof, collision-safety and any agent you like.
Autonomous coding agent loops, explained: turn-based, goal, time, and proactive
An agent repeating cycles of work until a stop condition is met. The four loop types explained, when to use each, and how to keep the quality up.
How to run multiple coding agents in parallel without merge conflicts
Several AI agents at once collide on shared files. The fix: a worktree per agent, a live team radar, and zone claims so no two ever touch one symbol.
Goal-based agent loops: giving a coding agent a definition of done
A goal-based loop iterates until a success criterion is met. The trick is a deterministic definition of done — tests, a score, a proof — not a guess.