Estimate what a Claude Code session costs from its tokens
Claude Code counts every token a session uses: what goes in, what comes out, and what it writes to or reads from its cache. Multiply those tokens by Anthropic's published API prices and you get an estimate of what the session cost. On the API, the Claude Console has your actual bill. On a Pro or Max plan you are not billed per token, so the estimate shows what the same work would cost on the API.
Where the token counts come from
Claude Code saves each session as a JSONL file in %USERPROFILE%\.claude\projects, one folder per project, and keeps them for 30 days by default. Tools that estimate cost read the token counts in these files and multiply them by the price of the model that did the work.
Cache tokens make a big difference. Writing to the cache costs more than normal input, and reading from it usually costs about a tenth, so a long session that reuses its context can use millions of tokens and still cost less than the total suggests. Anthropic describes the file format as internal and subject to change, so tools that read it can lag behind a Claude Code update.
Check it in Claude Code or with ccusage
In Claude Code, /usage (or its alias /cost) shows the session's cost and tokens. Claude Code works the dollar figure out from token counts at list price, so it is an estimate too. Anthropic says that figure is meant for API users; on a Pro or Max plan the same screen also shows your plan usage.
For past sessions, ccusage reads the same local files. It needs Node.js, and its documentation says the costs are estimates and may not match your bill. The codex form does the same for Codex sessions, which ccusage marks as experimental.
npx ccusage@latest claude session
npx ccusage@latest codex sessionSee it per session in RepoYard
Start Claude Code from RepoYard: choose New terminal, pick a repo, then Claude Code. The panel beside the terminal shows Cost so far, Prompts, Tokens in, Tokens out and how much of the context window is used, and the page header adds up every terminal open now. The numbers move while Claude Code works.
Cost so far is an estimate: the token counts in Claude Code's own session log multiplied by Anthropic's published API prices for that model, with cache writes and cache reads priced separately. On a subscription it is what the same work would cost on the API, not a bill. Hover over Tokens in to see how many were new, read from the cache or written to it. A model with no published price shows its tokens and no estimate.
Codex sessions show their tokens, context and plan limits, such as the 5-hour and weekly windows, read from Codex's own log. RepoYard reads these files on your PC.

Further reading
Try the workflow in RepoYard.
Windows 10 and 11, x64. Every feature for 7 days, then US$39.99 once. No RepoYard account needed.