Analyze coding (agent) CLI token usage and costs from local data.
ccusage 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 |
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:
# Recommended
bunx ccusage
# Nix
nix run github:ryoppippi/ccusage -- daily
# Alternative package runners
pnpm dlx ccusage
pnpx ccusage
npx ccusage@latest
# PR preview builds
bunx -p https://pkg.pr.new/ryoppippi/ccusage@<pr-number> ccusage --offlinebunx caches the downloaded package, so repeated runs are faster after the first launch.
# Basic usage
bunx ccusage # Show all detected sources by day (default)
bunx ccusage daily # All detected sources by day
bunx ccusage weekly # All detected sources by week
bunx ccusage monthly # All detected sources by month
bunx ccusage session # All detected sources by session
bunx ccusage blocks # Claude Code 5-hour billing windows
bunx ccusage statusline # Claude Code status line for hooks (Beta)
# Source-focused reports and options
bunx ccusage claude daily --mode display
bunx ccusage codex daily --speed fast
bunx ccusage opencode weekly
bunx ccusage amp session
bunx ccusage droid daily
bunx ccusage codebuff daily
bunx ccusage hermes daily
bunx ccusage goose daily
bunx ccusage openclaw daily
bunx ccusage kilo daily
bunx ccusage kimi daily
bunx ccusage qwen daily
bunx ccusage copilot daily
bunx ccusage gemini daily
bunx ccusage pi daily --pi-path /path/to/sessions
bunx ccusage pi daily --pi-path /path/to/sessions,/archive/pi/sessions
# Explicit unified report
bunx ccusage daily --all
# Filters and options
bunx ccusage daily --since 2026-04-25 --until 2026-05-16
bunx ccusage daily --json # JSON output
bunx ccusage daily --timezone UTC # Use UTC timezone
# Project analysis
bunx ccusage claude daily --instances # Group Claude Code by project/instance
bunx ccusage claude daily --project myproject # Filter to specific Claude project
bunx ccusage claude daily --instances --project myproject --json # Combined usage
# Compact mode for screenshots/sharing
bunx ccusage --compact # Force compact table mode
bunx ccusage monthly --compact # Compact monthly report- π Daily Report: View token usage and costs aggregated by date
- π Monthly Report: View token usage and costs aggregated by month
- π¬ Session Report: View usage grouped by conversation sessions
- π€ Unified CLI Reports: View Claude Code, Codex, OpenCode, Amp, Droid, Codebuff, Hermes Agent, pi-agent, Goose, OpenClaw, Kilo, Kimi, Qwen, GitHub Copilot CLI, and Gemini CLI usage from one CLI
- β° 5-Hour Blocks Report: Track usage within Claude's billing windows with active block monitoring
- π Statusline Integration: Compact usage display for Claude Code status bar hooks (Beta)
- π€ Model Tracking: See which models are used across supported sources
- π Model Breakdown: View per-model cost breakdown with
--breakdownflag - π
Date Filtering: Filter reports by date range using
--sinceand--until - π Custom Paths: Support for custom local data directory locations
- π¨ Beautiful Output: Colorful table-formatted display with automatic responsive layout
- π± Smart Tables: Automatic compact mode for narrow terminals (< 100 characters) with essential columns
- πΈ Compact Mode: Use
--compactflag to force compact table layout, perfect for screenshots and sharing - π Enhanced Model Display: Model names shown as bulleted lists for better readability
- π JSON Output: Export data in structured JSON format with
--json - π° Cost Tracking: Shows costs in USD for each day/month/session
- π Cache Token Support: Tracks and displays cache creation and cache read tokens separately
- π Offline Mode: Use pre-cached pricing data without network connectivity with
--offline - ποΈ Claude Instance Support: Group Claude Code usage by project with
--instancesand filter by specific projects - π Timezone Support: Configure timezone for date grouping with
--timezoneoption - βοΈ Configuration Files: Set defaults with JSON configuration files, complete with IDE autocomplete and validation
Full documentation is available at ccusage.com
Nix-based contributor setup
Use the Nix flake development environment. Install Nix with the nix-command and flakes experimental features enabled, then use nix-direnv so the repository dev shell loads automatically when you enter the directory:
# Clone the repository
git clone https://github.com/ryoppippi/ccusage.git
cd ccusage
# Allow direnv to load the Nix dev shell
direnv allowThe dev shell provides the pinned pnpm, Rust toolchain, GitHub CLI, and project utilities from flake.nix. It also installs package dependencies from pnpm-lock.yaml when needed.
If you do not use direnv, enter the shell manually:
nix developRun the usual checks from inside the Nix environment:
pnpm run format
pnpm typecheck
pnpm run testThe flake exposes ccusage as the default package and app:
nix run github:ryoppippi/ccusage
nix run github:ryoppippi/ccusage -- codex daily --offline
nix build github:ryoppippi/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 and refresh the non-Nix Cargo fallback JSON:
nix flake update litellm
nix run .#update-pricing-fallback
nix flake checkThe scheduled update pricing workflow runs the same commands and opens a PR when the locked input changes.
Check out ccusage: The Claude Code cost scorecard that went viral
MIT Β© @ryoppippi
