Analyze your Claude Code token usage and costs from local JSONL files β incredibly fast and informative!
π ccusage - Claude Code Usage Analyzer
The main CLI tool for analyzing Claude Code usage from local JSONL files. Track daily, monthly, and session-based usage with beautiful tables and live monitoring.
π€ @ccusage/codex - OpenAI Codex Usage Analyzer
Companion tool for analyzing OpenAI Codex usage. Same powerful features as ccusage but tailored for Codex users, including GPT-5 support and 1M token context windows.
π @ccusage/mcp - MCP Server Integration
Model Context Protocol server that exposes ccusage data to Claude Desktop and other MCP-compatible tools. Enable real-time usage tracking directly in your AI workflows.
Thanks to ccusage's incredibly small bundle size (), you can run it directly without installation:
# Recommended - always include @latest to ensure you get the newest version
npx ccusage@latest
bunx ccusage
# Alternative package runners
pnpm dlx ccusage
pnpx ccusage
# Using deno (with security flags)
deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest
π‘ Important: We strongly recommend using
@latest
suffix with npx (e.g.,npx ccusage@latest
) to ensure you're running the most recent version with the latest features and bug fixes.
Analyze OpenAI Codex usage with our companion tool @ccusage/codex:
# Recommended - always include @latest
npx @ccusage/codex@latest
bunx @ccusage/codex@latest # β οΈ MUST include @latest with bunx
# Alternative package runners
pnpm dlx @ccusage/codex
pnpx @ccusage/codex
# Using deno (with security flags)
deno run -E -R=$HOME/.codex/ -S=homedir -N='raw.githubusercontent.com:443' npm:@ccusage/codex@latest
β οΈ Critical for bunx users: Bun 1.2.x's bunx prioritizes binaries matching the package name suffix when given a scoped package. For@ccusage/codex
, it looks for acodex
binary in PATH first. If you have an existingcodex
command installed (e.g., GitHub Copilot's codex), that will be executed instead. Always usebunx @ccusage/codex@latest
with the version tag to force bunx to fetch and run the correct package.
Integrate ccusage with Claude Desktop using @ccusage/mcp:
# Start MCP server for Claude Desktop integration
npx @ccusage/mcp@latest --type http --port 8080
This enables real-time usage tracking and analysis directly within Claude Desktop conversations.
# Basic usage
npx ccusage # Show daily report (default)
npx ccusage daily # Daily token usage and costs
npx ccusage monthly # Monthly aggregated report
npx ccusage session # Usage by conversation session
npx ccusage blocks # 5-hour billing windows
npx ccusage statusline # Compact status line for hooks (Beta)
# Live monitoring
npx ccusage blocks --live # Real-time usage dashboard
# Filters and options
npx ccusage daily --since 20250525 --until 20250530
npx ccusage daily --json # JSON output
npx ccusage daily --breakdown # Per-model cost breakdown
npx ccusage daily --timezone UTC # Use UTC timezone
npx ccusage daily --locale ja-JP # Use Japanese locale for date/time formatting
# Project analysis
npx ccusage daily --instances # Group by project/instance
npx ccusage daily --project myproject # Filter to specific project
npx ccusage daily --instances --project myproject --json # Combined usage
# Compact mode for screenshots/sharing
npx ccusage --compact # Force compact table mode
npx ccusage monthly --compact # Compact monthly report
- π 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!
Full documentation is available at ccusage.com
Check out ccusage: The Claude Code cost scorecard that went viral
MIT Β© @ryoppippi