💡

A CLI tool that analyzes your Claude Code token usage and cost across daily, monthly, session, and 5-hour billing windows.

Token usage and cost analytics Experience
Installation · npx
$ npx ccusage@latest

What it does

ccusage reads the local JSONL files Claude Code writes per session and turns them into readable reports — daily, weekly, monthly, per-session, and per 5-hour billing window — so you can actually see how tokens and cost are trending.

Features

  • Multiple report views — daily, weekly, monthly, session, 5-hour billing window
  • Per-model breakdown — see token spend by Opus vs. Sonnet vs. Haiku
  • Cost estimation — USD cost based on current pricing
  • Zero setup — reads local JSONL, no auth or API needed
  • Fastnpx ccusage@latest and you have a report

Use cases

  1. Check monthly token usage and cost for budget planning.
  2. Monitor per 5-hour block consumption to avoid hitting limits.
  3. Compare session-by-session consumption to refine your prompting strategy.

When to use it

  • Monitor daily spend during a heavy coding push
  • Compare model usage ratios before switching defaults
  • Spot anomalies (e.g. a runaway session) after the fact

Frequently Asked Questions

What is ccusage?

A CLI that analyzes Claude Code's local JSONL session files to report token usage and cost across daily, weekly, monthly, per-session, and 5-hour billing windows.

Where does it run?

Wherever you use Claude Code.

How do I install it?

Run `npx ccusage@latest` — no install required.

What can it do?

Multiple report views (daily/weekly/monthly/session/5-hour billing window), per-model token tracking (Opus, Sonnet, etc.), USD cost calculation, separate tracking of cache-create vs cache-read tokens, JSON output, and MCP server integration.

When is it most useful?

Budget management with monthly token spend, 5-hour block monitoring to avoid limit overruns, and per-session comparisons to refine prompting strategy.