How to check Claude Code token usage

Claude Code shows the current session with /usage. Everything else is already on your disk: every reply is logged with its token counts. Here is where to look, what the numbers mean, and how to see all of it at once.

Updated 28 September 2026 · Serkan Korkut

Inside Claude Code

Run /usage. The Session block lists input, output, cache read and cache write tokens per model, with an estimated cost at list price. Recent versions add a prompt cache line with the share of input served from cache and the number of misses. On a Pro or Max plan, the same screen shows your plan usage bars and a breakdown of the last 24 hours or 7 days on this machine.

The Session block covers the current session only and resets on /clear. For history across weeks and projects, read the logs.

Where the logs are

ToolLocationFormat
Claude Code~/.claude/projects/<project>/<session>.jsonlOne JSON object per line
Codex~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonlJSON lines with token_count and token_usage_record events
GitHub Copilot CLI~/.copilot/session-store.dbSQLite

Claude Code reads CLAUDE_CONFIG_DIR and Codex reads CODEX_HOME if you have moved them.

What one Claude Code record contains

Every assistant reply carries a usage object:

"usage": {
  "input_tokens": 2,
  "cache_read_input_tokens": 44416,
  "cache_creation_input_tokens": 28104,
  "cache_creation": { "ephemeral_1h_input_tokens": 28104, "ephemeral_5m_input_tokens": 0 },
  "output_tokens": 390
}
  • input_tokens: fresh input that was not cached.
  • cache_read_input_tokens: context read from the cache, the cheapest kind.
  • cache_creation_input_tokens: context written to the cache, split into 1-hour and 5-minute writes. After a cache miss this number jumps.
  • output_tokens: what the model wrote, thinking included.

Why the four are priced so differently is explained in how much Claude Code costs.

Add it up with jq

This totals every Claude Code reply on your machine. A reply can appear on more than one line, so it keeps one record per message id:

cat ~/.claude/projects/*/*.jsonl \
  | jq -c 'select(.type == "assistant" and .message.usage) | {id: .message.id, u: .message.usage}' \
  | jq -s 'unique_by(.id) | map(.u) | {
      turns: length,
      input: (map(.input_tokens // 0) | add),
      cache_read: (map(.cache_read_input_tokens // 0) | add),
      cache_write: (map(.cache_creation_input_tokens // 0) | add),
      output: (map(.output_tokens // 0) | add)}'

It gives totals, not a timeline, and it does not price anything. For that, use a dashboard.

Codex and Copilot CLI

Codex writes a token_count event after each turn. Besides token counts it records your rate limit windows, the 5-hour and the weekly one, with the percentage used and the reset time. Newer Codex versions add token_usage_record events. Codex counts cached tokens inside input_tokens, so subtract cached_input_tokens to get fresh input.

GitHub Copilot CLI keeps its sessions in a SQLite database. Its input count also includes cache reads.

All of it in one dashboard

Tokenmeter reads all three sources and shows every prompt with its tokens split into cached, fresh and output, its cost, the cache misses, cost per git commit, and your usage windows. It runs on localhost and sends nothing anywhere.

brew install serkankorkut/tap/tokenmeter
tokenmeter start

On Windows and Linux, pipx install tokenmeter-dashboard, or try it without installing: uvx --from tokenmeter-dashboard tokenmeter --open.

Questions

Where does Claude Code store token usage?

In JSON lines files under ~/.claude/projects, one file per session, grouped by project folder. Every assistant reply includes a usage object with its token counts.

Does /usage show all my Claude Code sessions?

The Session block covers the current session. On a subscription, the breakdown below it covers the last 24 hours or 7 days on this machine. For per-prompt history across weeks, read the logs or use Tokenmeter.

How do I check Codex token usage?

Codex logs each turn's token counts and your 5-hour and weekly limit windows to ~/.codex/sessions. Tokenmeter reads them and shows the limits with their reset times.

Can I track token usage for a whole team?

Yes. Run one Tokenmeter as a team server and point each laptop at it with --export. Only token counts, models, project paths and timestamps are sent. Prompt text stays on each laptop.