Calculator
What does a Claude Code session
cost in tokens?
Every request an agent makes sends the whole conversation again. So a session costs far more than its context size suggests. Put in a few numbers from your own work and see where the money goes.
An estimate of input cost at the price you enter. It counts input only, and assumes the context grows evenly, stays in the prompt cache and is never compacted. Real sessions also pay to rebuild the cache after pauses and edits, so re-reading is a smaller share in practice: about three quarters for Claude Code in our sessions. On a flat subscription (Claude Pro or Max, ChatGPT) tokens are not billed this way.
Why it adds up
The model re-reads everything, every turn.
A coding agent works in a loop. It asks the model what to do, runs the tool the model picks, adds the result to the conversation, and asks again. Each of those requests carries the whole conversation so far: your instructions, every file it opened, every command's output.
Prompt caching makes the repeated part cheaper, about a tenth of the normal input price, but not free. A session of a few hundred requests that grows to a large context sends that context again and again. In our own longest sessions, the content the model was sent added up to hundreds of times the largest context the session ever held.
That is why about three quarters of what Claude Code costs is re-reading context it already sent, and why long sessions cost much more than short ones. What fills that context is mostly tool output, not your conversation.
Ways to lower it
- Start fresh sessions for unrelated tasks, so old context stops being re-sent.
- Keep tool output short: ask for
head, line ranges and quiet flags rather than whole files and full logs. - Compact early on long tasks, before the context is at its largest.
- Trim old output automatically. That is what Densilo does: it runs on your machine between the agent and the model, sends a short form of old tool output it has already sent, and keeps the full text, which the model can fetch back exactly when it needs it.
See your own number.
Install Densilo and run densilo benchmark in a repository you work in. It replays your recent Claude Code and Codex sessions offline: no model is called and nothing leaves your machine.