Measuring Your Claude Code Spend
Updated October 2026
When I started tracking token usage across Claude Code sessions, I expected costs to spread roughly evenly across my projects. They didn’t. One project accounted for the bulk of the spend.
The tool I use is token-audit, a local CLI that reads directly from the session transcripts Claude Code writes to ~/.claude/projects/. No API key, no upload; it parses the JSONL files you already have.
What it measures
Four efficiency metrics matter more than raw token counts: cache hit rate, output yield, cost per turn, and cost per session. The two actionable ones day to day:
- Cache hit rate tells you whether your prompt prefix is actually stable. If this is near zero across repeated sessions, something in your system prompt is changing per request; timestamps are the usual culprit.
- Cost per session tells you whether sessions are accumulating stale context. Every turn re-sends the full history as input; a session that never gets cleared grows quadratically in cost.
The breakdown commands (by-project, by-model, by-day) let you slice the same data to find where concentration is happening.
Two habits the data validated
I change models based on the task: lighter models for quick lookups and classification, heavier ones for harder reasoning and longer agent runs. The by-model breakdown makes this visible: you can see what each tier actually cost and whether the routing held in practice rather than in theory.
I also use /clear frequently. This shows up directly in cost per session. It’s not the same tool as /compact: /clear starts a new conversation with empty context, while /compact keeps the conversation and summarizes it to free space (and the summarizing pass is itself one large request). Clear between unrelated tasks, compact when you need the continuity; the metric makes the difference concrete across real sessions rather than hypothetical ones.
What a dashboard doesn’t show
Claude Code’s own /cost (an alias for /usage) shows the current session: tokens and an estimated dollar figure per model, plus cache hit statistics, and it resets when you /clear. The Console usage page is the authoritative bill. Neither breaks spend down by project directory, model tier, or day across every session you’ve run, in a way that answers “which project is expensive and why.” That’s what the audit adds. The CLI format also lets you diff time ranges, pipe to JSON, or filter by date, in ways a web dashboard doesn’t support.
Running token-audit by-project once is usually enough to surface something you didn’t expect.