Check how many tokens Claude Code used this week and how much it cost, without logging into any dashboard.
Export daily usage data as JSON to feed into a spreadsheet or cost-tracking script.
Monitor whether you are staying within Claude's five-hour billing windows using the blocks report.
Compare token costs across Claude Code, Codex, and Gemini CLI in one combined report.
ccusage is a command-line tool that reads the local usage logs that AI coding tools save to your computer and turns them into easy-to-read reports. If you use Claude Code, Codex, Gemini CLI, GitHub Copilot CLI, or any of more than a dozen other AI coding assistants, ccusage can tell you exactly how many tokens each tool used and what those tokens cost in dollars, broken down by day, week, month, or conversation session. There is no account or API key required. The tool reads log files that already exist on your machine, produced by the AI tools you already run. A single command, npx ccusage@latest, is all it takes to see your first report. You can run focused reports for just one tool at a time, for example ccusage claude daily for Claude Code usage by day, or combine all detected tools into one unified view with ccusage daily. Reports show token counts for input, output, and cached tokens separately, along with costs in USD for each period. Filtering by date range is supported with date flags. A compact mode adjusts the table layout for narrow terminal windows, and a JSON output option lets you pipe the data into other scripts or dashboards. A dedicated blocks command tracks Claude's five-hour billing windows specifically, which is useful if you are trying to manage usage within a particular time period. The tool also supports grouping Claude Code usage by project folder with an instances flag, and lets you filter to a specific project. You can override pricing per model in a local config file without needing to rebuild the tool, and an offline mode avoids network calls by using pre-cached pricing data. ccusage is written in TypeScript and runs on Node.js. It can also be invoked from a Nix flake for reproducible use across different machines. It is MIT-licensed and open source.
← ryoppippi on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.