npx ccusage
<a href="https://github.com/hesreallyhim/awesome-claude-code"></a>
<a href="https://技術者倫理.com"></a>
Analyze coding (agent) CLI token usage and costs from local data.
</picture>
</a>
<a href="https://blacksmith.sh">
</a>
npx ccusage@latestccusage reads local usage data from coding agent CLIs and turns it into daily, weekly, monthly, and session reports.
| Source | Focused command example |
|---|---|
| Claude Code | ccusage claude daily |
| Codex | ccusage codex daily |
| OpenCode | ccusage opencode daily |
| Amp | ccusage amp daily |
| Droid | ccusage droid daily |
| Codebuff | ccusage codebuff daily |
| Hermes Agent | ccusage hermes daily |
| pi-agent | ccusage pi daily |
| Goose | ccusage goose daily |
| OpenClaw | ccusage openclaw daily |
| Kilo | ccusage kilo daily |
| Kimi | ccusage kimi daily |
| Qwen | ccusage qwen daily |
| GitHub Copilot CLI | ccusage copilot daily |
| Gemini CLI | ccusage gemini daily |
| Antigravity | ccusage antigravity daily |
| Grok Build CLI | ccusage grok daily |
| ZCode | ccusage zcode daily |
Use ccusage daily, ccusage weekly, ccusage monthly, or ccusage session to include every detected source in one report.
You can run ccusage directly without a global installation:
# npm
npx ccusage@latest
# Nix
nix run github:ccusage/ccusage -- daily
# Alternative package runners
bunx ccusage
pnpm dlx ccusage
pnpx ccusage
# PR preview builds
bunx -p https://pkg.pr.new/ccusage/ccusage@<pr-number> ccusage --offlinebunx caches the downloaded package, so repeated runs are faster after the first launch.
…--breakdown flag--since and --until--last 1 on any daily, weekly, or monthly report--compact flag to force compact table layout, perfect for screenshots and sharing--json--no-cost--offlineccusage.json without rebuilding--instances and filter by specific projects--timezone optionFull documentation is available at ccusage.com
Further reading (Japanese): how ccusage began
Contributor setup uses the Nix flake development environment with nix-direnv for pinned tools, and just for everyday development tasks. Install Nix with the nix-command and flakes experimental features enabled, then let nix-direnv load the dev shell automatically when you enter the directory:
# Clone the repository
git clone https://github.com/ccusage/ccusage.git
cd ccusage
# Allow direnv to load the Nix dev shell
direnv allowThe dev shell provides the pinned pnpm, Rust toolchain, GitHub CLI, git hooks, generated local agent skills, package tooling, and project utilities from flake.nix. Run pnpm install --frozen-lockfile only when a task needs workspace node_modules.
Run project tasks with just from inside the Nix environment (just --list shows every recipe):
just fmt
just test
just checkThe flake exposes ccusage as the default package and app:
nix run github:ccusage/ccusage
nix run github:ccusage/ccusage -- codex daily --offline
nix build github:ccusage/ccusageNix builds embed the LiteLLM pricing file from the locked litellm flake input, so sandboxed builds do not fetch pricing at build time. To update the locked pricing snapshot:
Non-Nix Cargo builds read the same locked LiteLLM revision from flake.lock and fetch the pricing file from that revision at build time.
just update-litellm-pricingThe scheduled update pricing workflow runs the same update and validation, then opens a PR when the pricing snapshot changes.