ccusage  by ryoppippi

CLI tool for Claude Code usage analysis

created 2 months ago
5,582 stars

Top 9.3% 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

20 hours ago

Responsiveness

Inactive

Pull Requests (30d)
110
Issues (30d)
34
Star History
5,770 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Joe Walnes Joe Walnes(Head of Experimental Projects at Stripe), and
2 more.

prompttools by hegelai

0.3%
3k
Open-source tools for prompt testing and experimentation
created 2 years ago
updated 11 months ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Anil Dash Anil Dash(Former CEO of Glitch), and
13 more.

cline by cline

0.8%
48k
VS Code extension for autonomous coding agent
created 1 year ago
updated 21 hours ago
Feedback? Help us improve.