ccusage logo

ccusage

Visit

Open-source CLI that analyzes token usage and costs from local coding agent logs across Claude Code, Codex, OpenCode, and more.

Share:

ccusage

ccusage is an open-source CLI that reads local usage data from coding agent CLIs and turns it into daily, weekly, monthly, and per-session reports. It covers Claude Code, Codex, OpenCode, Amp, Goose, OpenClaw, Kilo, Kimi, Qwen, GitHub Copilot CLI, Gemini CLI, Grok Build CLI, and more. The Reddit community consistently recommends it as the first tool to install when coding-agent token bills become hard to explain.

Key Features

  • Local-only analysis: Reads session logs on your machine, so no usage data is uploaded to a server.
  • Time-based reports: Daily, weekly, monthly, and session views show where tokens and costs go.
  • Multi-provider support: One command can report every detected source together.
  • Simple runner: npx ccusage@latest works without a global install; Nix, bun, and pnpm runners are also supported.
  • Cost focus: Reports are built around cost visibility, not just token counts.

Use Cases

  • Cost management: Developers who want to see which sessions, models, or projects burn the most budget.
  • Team governance: Leads who need a simple local view of agent CLI usage before introducing broader tooling.
  • Optimization baseline: Teams that want a measurement step before installing context compression or retrieval tools.
  • Tool selection: Users comparing Claude Code, Codex, OpenCode, or other CLIs and checking which one is cheaper for their workflow.

Pricing

ccusage is free and open source under the MIT license. There is no hosted service or paid tier; it is a local CLI.

Getting Started

  1. Run npx ccusage@latest from a directory where your coding agent CLI has session logs.
  2. Use ccusage daily, ccusage weekly, ccusage monthly, or ccusage session for aggregate reports.
  3. Use a focused command such as ccusage claude daily or ccusage codex daily to inspect one provider.

Frequently Asked Questions

Does ccusage reduce my token usage?

No. It measures usage and costs from local data. It is a dashboard, not an optimizer, which is exactly why it works as a first step.

Where does the data come from?

Local session logs written by the supported coding agent CLIs. No cloud account or API key is required.

What is the main limitation?

It can only see sources it has adapters for, and it reports what the local logs contain, so it will not show usage from cloud-only sessions or agents with no local log integration.

Alternatives

  • Langfuse: Full observability platform for LLM applications, including tracing and analytics.
  • Helicone: Proxy-based LLM monitoring with cost tracking.
  • CodeRabbit: AI code review that adds a different view of engineering workflow costs.

Tips & Best Practices

  1. Measure before optimizing: Run a weekly report first, then install retrieval or compression tools and compare.
  2. Compare providers: Use ccusage weekly to see whether one agent CLI is dramatically more expensive.
  3. Pair with a proxy: For API-level visibility, combine ccusage's local agent view with an LLM observability proxy.

Conclusion

ccusage answers the most common coding-agent question quickly: where did my tokens and money go? It is free, local, and supports the major agent CLIs, making it a sensible first observability tool before adding heavier infrastructure.

Comments

No comments yet. Be the first to comment!