Analyze coding (agent) CLI token usage and costs from local data.
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 |
Use ccusage daily, ccusage weekly, ccusage monthly, or ccusage session to include every detected source in one report.
The per-turn Codex Fast/Standard reporting changes are available on the
DOUIF/ccusage fork. Until those changes are
published to npm, bunx ccusage continues to run the official npm release.
These source installs require Git,
Rust, and Bun. Cargo builds the native
binary and installs it into Bun's bin directory, so use ccusage directly after
installation.
git clone https://github.com/DOUIF/ccusage.git
cd ccusage
cargo install --path rust/crates/ccusage --locked --force --root "$HOME/.bun"
ccusage --versiongit clone https://github.com/DOUIF/ccusage.git
cd ccusage
cargo install --path rust/crates/ccusage --locked --force --root "$HOME/.bun"
ccusage --versiongit clone https://github.com/DOUIF/ccusage.git
Set-Location ccusage
cargo install --path .\rust\crates\ccusage --locked --force --root "$env:USERPROFILE\.bun"
ccusage.exe --versionIf ccusage is not found after installation, ensure Bun's bin directory is on
PATH: $HOME/.bun/bin on macOS/Linux or
$env:USERPROFILE\.bun\bin on Windows.
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.
The installed fork reads each Codex thread_settings_applied event and assigns
the effective Standard or Fast tier to following token events. With the default
--speed auto, only legacy or headless usage without recorded tier metadata
falls back to the current Codex config.toml setting.
# Combined daily totals, priced from each turn's effective tier
ccusage codex daily --timezone Asia/Taipei --speed auto --speed-view all
# Split every date into non-empty Standard and Fast rows
ccusage codex daily --timezone Asia/Taipei --speed-view detailed
# Show only Fast or only Standard usage by date
ccusage codex daily --timezone Asia/Taipei --speed-view fast
ccusage codex daily --timezone Asia/Taipei --speed-view standard
# Weekly, monthly, and per-session detailed reports
ccusage codex weekly --timezone Asia/Taipei --speed-view detailed
ccusage codex monthly --timezone Asia/Taipei --speed-view detailed
ccusage codex session --timezone Asia/Taipei --speed-view detailed
# Limit the report to a date range
ccusage codex daily --since 2026-07-01 --until 2026-07-15 \
--timezone Asia/Taipei --speed-view detailed
# Include Standard/Fast token and cost breakdowns in JSON
ccusage codex daily --timezone Asia/Taipei --speed-view detailed --json--speed controls pricing policy, while --speed-view controls filtering and
presentation:
| Option | Behavior |
|---|---|
--speed auto |
Use recorded per-turn tiers; use config.toml only for unknown usage |
--speed standard |
Force all usage to Standard pricing |
--speed fast |
Force all usage to Fast pricing |
--speed-view all |
Show combined rows while retaining per-turn pricing |
--speed-view standard |
Show only usage whose effective tier is Standard |
--speed-view fast |
Show only usage whose effective tier is Fast |
--speed-view detailed |
Show separate Standard and Fast rows and JSON breakdowns |
# 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 codex session --speed-view detailed
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
bunx ccusage daily --sections daily,monthly,session --json
bunx ccusage daily --by-agent --json
# Filters and options
bunx ccusage daily --since 2026-04-25 --until 2026-05-16
bunx ccusage daily --json # JSON output
bunx ccusage daily --no-cost # Hide cost columns and JSON cost fields
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
- 🔒 Cost Hiding: Remove cost columns and JSON cost fields with
--no-cost - 🔄 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 - 🧩 Custom Pricing Overrides: Override token pricing per raw model name in
ccusage.jsonwithout rebuilding - 🏗️ 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
Contributor setup
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.
