Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

ccusage

$ ccusage Community Low Risk
ccusage · Agent Bridges & Meta · MIT · macos / linux / windows

ccusage reads local AI coding CLI session logs (Claude Code, Codex, OpenCode, etc.) and generates daily, weekly, monthly, session, and blocks usage and cost reports. Supports --json, --compact, --no-cost, --instances, and --timezone.

FCRS-1.0 Score
92 /100
Excellent
High Confidence
Zero-Friction Install
brew install ccusage
CLI vs MCP Decision Hybrid (CLI + MCP)

ccusage is fastest as a read-only CLI (ccusage daily --json) for cost audits and scripts; an optional @ccusage/mcp server is also available.

Agent-Readiness Checklist

Local Probe Evidence
✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md
Version
16.1.2
Startup
134 ms
Exit Codes (help / invalid)
0 / 1
NO_COLOR Clean / Non-TTY Safe
Yes / Safe
Captured --help excerpt
USAGE:
  ccusage [daily] <OPTIONS>
  ccusage <COMMANDS>

COMMANDS:
  daily               Show usage report grouped by date  
  monthly             Show usage report grouped by month  
  weekly              Show usage report grouped by week  
  session             Show usage report grouped by conversation session  
  blocks              Show usage report grouped by session billing blocks  
  mcp                 Start MCP server with usage reporting tools  
  statusline          Display compact status line for Claude Code hooks with hybrid time+file caching (Beta)  

For more info, run any command with the `--help` flag:
  ccusage daily --help
  ccusage monthly --help
  ccusage weekly --help
  ccusage session --help
  ccusage blocks --help
  ccusage mcp --help
  ccusage statusline --help

OPTIONS:
  -s, --since <since>                          Filter from date (YYYYMMDD format)
  -u, --until <until>                          Filter until date (YYYYMMDD format)
  -j, --json                                   Output in JSON format (default: false)
  -m, --mode [mode]                            Cost calculation mode: auto (use costUSD if exists, otherwise calculate), calculate (always calculate), display (always use costUSD) (default: auto, choices: auto | calculate | display)
  -d, --debug                                  Show pricing mismatch information for debugging (default: false)
  --debug-samples [debug-samples]              Number of sample discrepancies to show in debug output (default: 5) (default: 5)
  -o, --order [order]                          Sort order: desc (newest first) or asc (oldest first) (default: asc, choices: desc | asc)
  -b, --breakdown                              Show per-model cost breakdown (default: false)
  -O, --offline                                Use cached pricing data for Claude models instead of fetching from API (default: false)
  --no-offline                                 Negatable of -O, --offline
  --color                                      Enable colored output (default: auto). FORCE_COLOR=1 has the same effect.
  --no-color                                   Disable colored output (default: auto). NO_COLOR=1 has the same effect.
  -z, --timezone <timezone>                    Timezone for date grouping (e.g., UTC, America/New_York, Asia/Tokyo). Default: system timezone
  -l, --locale [locale]                        Locale for date/time formatting (e.g., en-US, ja-JP, de-DE) (default: en-CA)
  -q, --jq <jq>        

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 24 / 25

Clean non-interactive reporting (daily, weekly, monthly, session) with --json, --no-cost, --instances, and --timezone.

  • --json, --compact, --no-cost, --instances, and --timezone across report subcommands
Trust & Safety 24 / 25

Strictly read-only analysis of local JSONL log files with zero network mutations or credential storage.

  • Read-only local JSONL log parsing (cached LiteLLM pricing optional/offline fallback)
Setup & Portability 14 / 15

Runs everywhere via npx ccusage@latest, npm install -g ccusage, or brew install ccusage.

  • Available on Homebrew, npm, and npx ccusage@latest
Utility & Efficiency 14 / 15

Instant visibility into cache hit rates, per-model token burn, and 5-hour billing blocks.

  • Covers input/output/cache-read/cache-create tokens and multi-CLI subcommands
Maintenance & Lineage 8 / 10

Active MIT-licensed community tool (ccusage/ccusage) with dedicated docs and companion packages.

  • Active ccusage/ccusage repository under MIT
Docs & Verifiability 8 / 10

Clear documentation site (ccusage.com/guide/) detailing JSON schemas, flags, and subcommands.

  • Official docs at ccusage.com/guide/

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Reads local session JSONL logs (e.g., ~/.claude/projects/); requires no API keys or login.

Side Effects
Read-Only
Cost & Quotas

100% free and MIT open-source.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# ccusage Agent Rules
- Always pass `--json` when querying usage reports from agents or scripts.
- Use `daily`, `weekly`, `monthly`, or `session` (avoid live `blocks --live` watch loops in non-interactive runs).

Agent-Ready Command Recipes

Safe Read-Only Queries

Export daily token and cost usage as JSON
ccusage daily --json --timezone UTC

Parses local JSONL session logs and outputs daily input/output/cache token totals and estimated USD cost in JSON.

Inspect per-project instances without cost estimates
ccusage session --instances --no-cost --json

Breaks down session token counts per project instance in JSON while omitting monetary fields.

Strengths for Agents

  • + Zero-setup read-only audit of local AI coding CLI token and cache spend.
  • + Clean --json output across daily, weekly, monthly, and session reports.
  • + Supports --no-cost, --instances, and --timezone for exact reporting.

Caveats & Pitfalls

  • ! Estimated USD costs rely on upstream LiteLLM pricing data and may differ slightly from final invoice billing.
  • ! blocks --live starts a continuous terminal monitor that blocks unless omitted.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI