GitHunt
FU

functicons/ccusage

A CLI tool for analyzing Claude Code usage from local JSONL files.

ccusage logo

ccusage

npm version NPM Downloads install size DeepWiki ClaudeLog - A comprehensive knowledge base for Claude. Mentioned in Awesome Claude Code

Analyze your Claude Code token usage and costs from local JSONL files โ€” incredibly fast and informative!

Installation

Thanks to ccusage's incredibly small bundle size (install size), you can run it directly without installation:

# Using bunx (recommended for speed)
bunx ccusage

# Using npx
npx ccusage@latest

# Using deno (with security flags)
deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest

๐Ÿ’ก Tip: We recommend using bunx instead of npx for a massive speed improvement!

Local Installation (Optional)

Since ccusage has such a small bundle size, installation is entirely optional:

npm install -g ccusage

Usage

# Basic usage
ccusage          # Show daily report (default)
ccusage daily    # Daily token usage and costs
ccusage monthly  # Monthly aggregated report
ccusage session  # Usage by conversation session
ccusage blocks   # 5-hour billing windows
ccusage statusline  # Compact status line for hooks (Beta)

# Live monitoring
ccusage blocks --live  # Real-time usage dashboard

# Filters and options
ccusage daily --since 20250525 --until 20250530
ccusage daily --json  # JSON output
ccusage daily --breakdown  # Per-model cost breakdown
ccusage daily --timezone UTC  # Use UTC timezone
ccusage daily --locale ja-JP  # Use Japanese locale for date/time formatting

# Project analysis
ccusage daily --instances  # Group by project/instance
ccusage daily --project myproject  # Filter to specific project
ccusage daily --instances --project myproject --json  # Combined usage

# Compact mode for screenshots/sharing
ccusage --compact  # Force compact table mode
ccusage monthly --compact  # Compact monthly report

Features

  • ๐Ÿ“Š Daily Report: View token usage and costs aggregated by date
  • ๐Ÿ“… Monthly Report: View token usage and costs aggregated by month
  • ๐Ÿ’ฌ Session Report: View usage grouped by conversation sessions
  • โฐ 5-Hour Blocks Report: Track usage within Claude's billing windows with active block monitoring
  • ๐Ÿ“ˆ Live Monitoring: Real-time dashboard showing active session progress, token burn rate, and cost projections with blocks --live
  • ๐Ÿš€ Statusline Integration: Compact usage display for Claude Code status bar hooks (Beta)
  • ๐Ÿค– Model Tracking: See which Claude models you're using (Opus, Sonnet, etc.)
  • ๐Ÿ“Š Model Breakdown: View per-model cost breakdown with --breakdown flag
  • ๐Ÿ“… Date Filtering: Filter reports by date range using --since and --until
  • ๐Ÿ“ Custom Path: Support for custom Claude data directory locations
  • ๐ŸŽจ Beautiful Output: Colorful table-formatted display with automatic responsive layout
  • ๐Ÿ“ฑ Smart Tables: Automatic compact mode for narrow terminals (< 100 characters) with essential columns
  • ๐Ÿ“ธ Compact Mode: Use --compact flag to force compact table layout, perfect for screenshots and sharing
  • ๐Ÿ“‹ Enhanced Model Display: Model names shown as bulleted lists for better readability
  • ๐Ÿ“„ JSON Output: Export data in structured JSON format with --json
  • ๐Ÿ’ฐ Cost Tracking: Shows costs in USD for each day/month/session
  • ๐Ÿ”„ Cache Token Support: Tracks and displays cache creation and cache read tokens separately
  • ๐ŸŒ Offline Mode: Use pre-cached pricing data without network connectivity with --offline (Claude models only)
  • ๐Ÿ”Œ MCP Integration: Built-in Model Context Protocol server for integration with other tools
  • ๐Ÿ—๏ธ Multi-Instance Support: Group usage by project with --instances flag and filter by specific projects
  • ๐ŸŒ Timezone Support: Configure timezone for date grouping with --timezone option
  • ๐ŸŒ Locale Support: Customize date/time formatting with --locale option (e.g., en-US, ja-JP, de-DE)
  • โš™๏ธ Configuration Files: Set defaults with JSON configuration files, complete with IDE autocomplete and validation
  • ๐Ÿš€ Ultra-Small Bundle: Unlike other CLI tools, we pay extreme attention to bundle size - incredibly small even without minification!

Documentation

Full documentation is available at ccusage.com

Sponsors

Check out ccusage: The Claude Code cost scorecard that went viral

ccusage: The Claude Code cost scorecard that went viral

Claude Code Resources

ClaudeLog ย  by ย  InventorBlack
A comprehensive knowledge base with detailed breakdowns of advanced topics, including:

Star History

Star History Chart

License

MIT ยฉ @ryoppippi

Languages

TypeScript99.8%JavaScript0.1%Shell0.0%
MIT License
Created August 23, 2025
Updated August 23, 2025
functicons/ccusage | GitHunt