Claude Code cost analyzer
betaClaude Code writes every session to a JSONL transcript with the token usage of each API call. Open one, with its subagent transcripts if you like, and the analyzer prices every call at the current API rates: input, cache writes, cache reads, output and web searches. You get the total, the cost of each prompt, the tools and subagents that drove it, how much the prompt cache saved, and the running cost over time.
How to use it
- Find the transcript: ~/.claude/projects/<project folder>/<session id>.jsonl. Subagent transcripts sit in <session id>/subagents/.
- Drop the .jsonl files on the page or pick them with the file button.
- Read the total, then the charts: cost by token type, by model, over time, by prompt, by tool and by subagent.
Questions
- Why does the total differ from what Claude Code showed?
- The analyzer prices the tokens recorded in the transcript at API list prices. Claude Code's own figure covers the whole process, including calls that never reach the transcript, and a subscription (Pro, Max) is not billed per token at all. When the transcript holds Claude Code's running total, the page shows both.
- How are cache writes priced?
- Writes to the 5-minute cache cost 1.25 times the input price, writes to the 1-hour cache twice the input price. Cache reads cost a fraction of the input price that depends on the model (0.1 for most, 0.05 for Opus 5.5 and Sonnet 5.5).
- How is the cost of a tool computed?
- Each API call is shared evenly between the tools it requested. It shows which tools the spending went to, not an exact bill per tool.