- How you use it
- A setting in your project
- What it can do
- installs software · writes files · network · runs shell
- What's inside
The option
| Option | AConfig · v20.0.34+wwfix.1ccusage CLI: token and cost reports from agent logs |
|---|---|
| How you use it | A setting in your project |
| What it can do | installs software · writes files · network · runs shell |
| What's inside |
What this thread does
As of November 2026, use ccusage 20.1.1 for local token and estimated-cost reports; older releases can miscount requests or underprice recorded Codex Ultrafast usage.
Do first: run the versioned CLI for a baseline report:
npx ccusage@20.1.1 daily
The repository README, read November 3, documents the npx ccusage invocation and daily; this command pins that invocation to the November 23 release. Compare the same date range and agent selection before and after a cost-saving change.
What it is
ccusage is a command-line report over the JSONL logs agent CLIs already write locally (for Claude Code under ~/.claude/projects/ or ~/.config/claude/projects/). As of November 2026, ccusage 20.1.1 sends a daily usage ping after a first-run notice; nothing from agent logs is sent. Collection is off with --offline and in CI; opt out with ccusage telemetry disable or DO_NOT_TRACK=1, per the README. @MahmutGundogdu described using it to measure his spend before moving to OpenTelemetry (8 September 2026, in Turkish).
Useful commands:
ccusage daily,weekly,monthly,session: all detected agents togetherccusage claude daily,ccusage codex daily, and the same for OpenCode, Gemini CLI, Copilot CLI, Amp and othersccusage blocks: Claude Code's 5-hour usage windows--jsonfor scripts,--mode calculate|display|autoto choose how cost is computed
When to use it
Before you try a token-saving technique (a compression proxy, terser replies, a different harness), record a baseline, then compare a similar week afterwards. Most advice skips that step.
Alternatives
/usageinside Claude Code for the current session and its cache hit ratio.- Claude Code's OpenTelemetry metrics for a whole team.
- Claude-Code-Usage-Monitor (MIT) for a live terminal view.
Caveats
- Dollar figures are estimates at API list prices. On a Claude subscription they are not your bill, and they can differ from what
/usageshows. - Without
--offline(-O), each run downloads a model price table. That matters if you poll it every minute, for example in a status line. - From version 20 the npm package installs a prebuilt native binary through optional platform packages.
- GitHub now identifies the licence as MIT; 20.1.0 makes the root MIT license detectable.
For a source-focused report, use ccusage claude daily --mode display; use --offline (-O) to avoid fetching pricing, per the README, read November 3.
Material fixes since 20.0.34
| Release | Date | Effect on a report |
|---|---|---|
| 20.0.46 | October 30 | Uses Ultrafast pricing for recorded Codex Ultrafast requests |
| 20.0.47 | November 1 | Counts OpenCode Claude Agent turns once in unified reports; retains sessions last active on the --until day |
| 20.0.48 | November 2 | Release; its notes list no significant changes |
Sources: 20.0.46, 20.0.47, 20.0.48. The intervening release history also includes request deduplication and configuration fixes; re-generate a baseline with the same version rather than mixing historical report outputs.
Evidence: rzv-me's October 28 issue #1987 provides a synthetic rollout showing recorded Ultrafast traffic falling back to Standard pricing in 20.0.45. The shipped fix is documented in 20.0.46. The reproduction is upstream evidence, not a WhatWorks lab run.
Limits
API-equivalent dollars are not the invoice for a Claude subscription. Report completeness depends on the local records available, and cost comparisons depend on both the pricing table and parser version.
Not for: collecting organization-wide telemetry from many machines; see claude-code-opentelemetry-token-cost-metrics.
checked 2026-11-23
Started from a post by @MahmutGundogdu, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.