How to track your Claude Code cost, tokens, and usage
If you use Claude Code every day, the bill can creep up faster than you notice. The good news: everything you need to track your Claude Code cost is already sitting in local log files. You do not need a dashboard, an account, or a third-party service to see it. Here is where the data lives, how to read it, and how to spend less without slowing down.
Where Claude Code keeps your usage data
Claude Code writes a full record of every session to disk. On macOS and Linux the logs live under ~/.claude/ (Windows uses the equivalent user directory), stored as JSONL files, one line per event. Each assistant turn records the model used and a token breakdown: input tokens, output tokens, and cache read and write tokens. Because the numbers come straight from the API responses, they are the same figures your usage is billed on.
That is the key insight most people miss: you are not estimating cost, you are reading it. A cost tracker's only real job is to sum those token counts, multiply by the current per-model rates, and present the total in a way you can actually act on.
The fastest way to see cost and tokens
The single-command option is Shippa. It reads the same local logs, totals your tokens and estimated spend per model, and shows streaks and lines shipped alongside the money. Nothing leaves your machine.
$ npx shippaRun it and you get a plain-English breakdown: tokens in, tokens out, cache reads, estimated dollars, and how that trends day over day. If you would rather see it as a shareable card or compare against other developers, that is what the Shippa leaderboard and stats card are for. Prefer to stay in the terminal? The numbers alone are the point.
What actually drives your Claude Code cost
Four things move the number, and understanding them is most of the battle:
- Output tokens. Generated text is billed at a higher rate than input on every current model, so long explanations, large file rewrites, and verbose plans cost the most per token.
- Input and context size. Every turn resends the working context. A bloated conversation or a huge pasted file means you pay to reread it on each step.
- Cache reads. Claude Code caches large stable context so repeated reads are billed at a steep discount. High cache-read counts are usually a good sign, not a bad one.
- Model choice. The frontier model is dramatically more expensive per token than the smaller, faster tiers. Which model handled which turn is recorded in the logs, so you can see where the spend concentrates.
Cache reads versus fresh input
It is worth separating these two. A session with 2M cache-read tokens and 40K fresh input tokens is cheap, because cache reads are discounted heavily. A session with 400K fresh input tokens and no caching is expensive even though the raw number is smaller. If your tracker only shows one lumped 'input' figure, you cannot tell those two sessions apart. Look for a breakdown that splits cache reads out.
ccusage alternative: which tracker should you use?
ccusage is the well-known CLI for parsing Claude Code cost from local logs, and it is genuinely good at the pure number-crunching job. Shippa covers the same core (local logs, per-model token and dollar totals) and adds the parts ccusage deliberately leaves out: lines shipped, streaks, a shareable card, and an optional public leaderboard. Neither uploads your code.
| ccusage | Shippa | |
|---|---|---|
| Reads local logs | Yes | Yes |
| Cost + token totals | Yes | Yes |
| Lines shipped / streaks | No | Yes |
| Shareable stats card | No | Yes |
| Public leaderboard (opt-in) | No | Yes |
| Tracks Codex + Cursor too | No | Yes |
| 100% local, no account | Yes | Yes |
If you only want a monthly dollar figure, either works. If you also want to know what you built for that money, and see how it stacks up, that is where a fuller Claude Code stats view earns its place.
How to actually lower your Claude Code bill
Once you can see the spend, five habits reliably bring it down:
- Clear context often. Use
/clearwhen you switch tasks. A stale, giant conversation is the most common source of quiet overspend. - Route models by task. Let a smaller, cheaper model handle mechanical edits and reserve the frontier model for genuinely hard reasoning.
- Keep pasted context tight. Paste the function, not the whole file. Point the agent at paths instead of dumping contents when you can.
- Lean on caching. Long-lived project context that stays stable gets cached, so structuring work to reuse it beats re-explaining from scratch.
- Review the daily trend, not just the month. A single expensive day is easy to explain and fix. A month-end surprise is not.
Quick answers
Does Claude Code show cost by default?
It records everything needed to compute cost in your local logs, and surfaces some usage inline, but a dedicated tracker gives you clean per-model dollar totals and trends. Running npx shippa is the one-line way to get them.
Is tracking my usage safe?
Reading ~/.claude locally is completely safe: the logs are yours and the parsing happens on your machine. Shippa never uploads your code or prompts. Only the stats you explicitly choose to share ever leave your laptop.
Try it yourself
See your own stats in one line.
Shippa reads your local Claude Code, Codex, and Cursor logs and turns them into lines shipped, tokens, spend, and a streak. 100% local, no account.
