ccusage  by ryoppippi

CLI tool for Claude Code usage analysis

Created 3 months ago
8,061 stars

Top 6.4% on SourcePulse

GitHubView on GitHub
Project Summary

This CLI tool, ccusage, analyzes Claude Code token usage and costs from local JSONL files, providing daily, monthly, session-based, and 5-hour billing block reports. It's designed for developers and researchers who want to understand and manage their spending on Anthropic's Claude models.

How It Works

ccusage parses local JSONL files containing Claude conversation data. It aggregates token counts and applies pricing information (either cached or fetched) to calculate costs. Key features include real-time monitoring of active sessions, cost projections, and detailed breakdowns by model and date range, all presented in a user-friendly, colorized table format with smart resizing for different terminal widths.

Quick Start & Requirements

  • Install/Run: npx ccusage@latest or npm install -g ccusage
  • Prerequisites: Node.js. No specific Claude API keys or hardware required, as it processes local files.
  • Documentation: ccusage.com

Highlighted Details

  • Real-time monitoring dashboard with token burn rate and cost projections.
  • Detailed cost breakdown per Claude model (Opus, Sonnet, etc.).
  • Offline mode for cost tracking using cached pricing.
  • Built-in Model Context Protocol (MCP) server for integration.
  • Smart table formatting adapts to terminal width.

Maintenance & Community

  • Developed by @ryoppippi.
  • Star History available.

Licensing & Compatibility

  • MIT License. Permissive for commercial use and integration with closed-source projects.

Limitations & Caveats

The tool relies on the local JSONL files generated by Claude's usage logging. Accuracy is dependent on the completeness and format of these local files.

Health Check
Last Commit

12 hours ago

Responsiveness

1 day

Pull Requests (30d)
60
Issues (30d)
29
Star History
1,145 stars in the last 30 days

Explore Similar Projects

Starred by Dan Guido Dan Guido(Cofounder of Trail of Bits), Joe Walnes Joe Walnes(Head of Experimental Projects at Stripe), and
4 more.

opcode by winfunc

2.1%
17k
GUI for Claude Code
Created 3 months ago
Updated 1 week ago
Feedback? Help us improve.