Short answer: most of it usually isn't the model writing code. As an agentic-coding session grows, the entire context is re-sent on every turn — so you pay to re-read the same files, tool output, and history again and again. tokenscope shows you the split.
Every API call in a session is priced in four buckets. Dashboards show you the total; tokenscope shows the attribution — which bucket your money is really going to:
The conversation so far, re-sent every turn so the model can "remember" it. On long sessions this is often the single biggest line — and it grows the longer you go.
Newly added context (files you open, tool results) written into the prompt cache the first time.
The tokens the model actually generates. Often a surprisingly small slice of a big bill.
Uncached prompt tokens. Usually small once caching kicks in.
The fix is usually mundane: trim what stays in context — /compact or a fresh
session when the window gets large, and don't keep huge files/tool output resident. tokenscope's
insights point at the specific turns and tools doing the damage.
--json and the report + shareable card are rendered locally with JavaScript. There is no
server, no analytics, and no network request — you can disconnect your machine and it still works.
npx @wartzar-bee/tokenscope --json in your terminal
Plain-English explainers on what Claude Code actually costs and how to spend less — the mechanics are accurate and the advice is concrete.
Is this affiliated with Anthropic? No. tokenscope is an independent, open-source tool.
Are the prices exact? They're documented defaults (incl. Anthropic's cache multipliers: write 1.25×/2×, read 0.1× of input). Token counts are read straight from your local logs; you can override prices in .tokenscope.json. Unknown models are flagged, never silently counted as $0.
Does the website see my data? No. The CLI reads ~/.claude/projects/**/*.jsonl locally; this page only parses text you paste, in your browser. The shareable summary is aggregate numbers only — no file paths and no prompt/response content.