ccusage 18.0.11 → 19.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,37 +13,19 @@
13
13
  <a href="https://github.com/hesreallyhim/awesome-claude-code"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Claude Code" /></a>
14
14
  </p>
15
15
 
16
+ <p align="center">
17
+ <a href="https://trendshift.io/repositories/18533" target="_blank"><img src="https://trendshift.io/api/badge/repositories/18533" alt="ryoppippi%2Fccusage | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
18
+ </p>
19
+
16
20
  <div align="center">
17
21
  <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/screenshot.png">
18
22
  </div>
19
23
 
20
- > Analyze your Claude Code token usage and costs from local JSONL files — incredibly fast and informative!
21
-
22
- ## ccusage Family
23
-
24
- ### 📊 [ccusage](https://www.npmjs.com/package/ccusage) - Claude Code Usage Analyzer
25
-
26
- The main CLI tool for analyzing Claude Code usage from local JSONL files. Track daily, monthly, and session-based usage with beautiful tables.
27
-
28
- ### 🤖 [@ccusage/codex](https://www.npmjs.com/package/@ccusage/codex) - OpenAI Codex Usage Analyzer
29
-
30
- 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.
31
-
32
- ### 🚀 [@ccusage/opencode](https://www.npmjs.com/package/@ccusage/opencode) - OpenCode Usage Analyzer
33
-
34
- Companion tool for analyzing [OpenCode](https://github.com/opencode-ai/opencode) usage. Track token usage and costs from OpenCode sessions with the same reporting capabilities as ccusage.
35
-
36
- ### 🥧 [@ccusage/pi](https://www.npmjs.com/package/@ccusage/pi) - Pi-agent Usage Analyzer
24
+ > Analyze coding (agent) CLI token usage and costs from local data.
37
25
 
38
- Companion tool for analyzing [pi-agent](https://github.com/badlogic/pi-mono) session usage. Track token usage and costs from your pi-agent sessions with daily, monthly, and session-based reports.
26
+ ## Supported Sources
39
27
 
40
- ### [@ccusage/amp](https://www.npmjs.com/package/@ccusage/amp) - Amp Usage Analyzer
41
-
42
- Companion tool for analyzing [Amp](https://ampcode.com/) session usage. Track token usage, costs, and credits from your Amp CLI sessions with daily, monthly, and session-based reports.
43
-
44
- ### 🔌 [@ccusage/mcp](https://www.npmjs.com/package/@ccusage/mcp) - MCP Server Integration
45
-
46
- 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.
28
+ The main CLI tool for analyzing Claude Code, Codex, OpenCode, Amp, and pi-agent usage from local data. Track daily, weekly, monthly, and session-based usage with beautiful tables.
47
29
 
48
30
  ## Installation
49
31
 
@@ -52,56 +34,54 @@ Model Context Protocol server that exposes ccusage data to Claude Desktop and ot
52
34
  Thanks to ccusage's incredibly small bundle size ([![install size](https://packagephobia.com/badge?p=ccusage)](https://packagephobia.com/result?p=ccusage)), you can run it directly without installation:
53
35
 
54
36
  ```bash
55
- # Recommended - always include @latest to ensure you get the newest version
56
- npx ccusage@latest
37
+ # Recommended
57
38
  bunx ccusage
58
39
 
59
40
  # Alternative package runners
60
41
  pnpm dlx ccusage
61
42
  pnpx ccusage
62
-
63
- # Using deno (with security flags)
64
- deno run -E -R=$HOME/.claude/projects/ -S=homedir -N='raw.githubusercontent.com:443' npm:ccusage@latest
43
+ npx ccusage@latest
65
44
  ```
66
45
 
67
- > 💡 **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.
68
-
69
- ### Related Tools
70
-
71
- ```bash
72
- npx @ccusage/codex@latest # OpenAI Codex usage tracking
73
- npx @ccusage/opencode@latest # OpenCode usage tracking
74
- npx @ccusage/pi@latest # Pi-agent usage tracking
75
- npx @ccusage/amp@latest # Amp usage tracking
76
- npx @ccusage/mcp@latest # MCP Server
77
- ```
46
+ > 💡 **Runtime**: `bunx ccusage` is recommended for everyday use. If you use `npx`, include `@latest` and use Node.js 22+.
47
+ > Because the published CLI shebang targets Node.js, package runners can start ccusage under Node.js even when launched through `bunx`. When ccusage finds `bun` in `PATH`, it automatically re-runs the bundled entrypoint with Bun for better warm runtime performance. Set `CCUSAGE_BUN_AUTO_RUN=0` to force Node.js.
78
48
 
79
49
  ## Usage
80
50
 
81
51
  ```bash
82
52
  # Basic usage
83
- npx ccusage # Show daily report (default)
84
- npx ccusage daily # Daily token usage and costs
85
- npx ccusage monthly # Monthly aggregated report
86
- npx ccusage session # Usage by conversation session
87
- npx ccusage blocks # 5-hour billing windows
88
- npx ccusage statusline # Compact status line for hooks (Beta)
53
+ bunx ccusage # Show all detected sources by day (default)
54
+ bunx ccusage daily # All detected sources by day
55
+ bunx ccusage weekly # All detected sources by week
56
+ bunx ccusage monthly # All detected sources by month
57
+ bunx ccusage session # All detected sources by session
58
+ bunx ccusage blocks # Claude Code 5-hour billing windows
59
+ bunx ccusage statusline # Claude Code status line for hooks (Beta)
60
+
61
+ # Source-focused reports and options
62
+ bunx ccusage claude daily --mode display
63
+ bunx ccusage codex daily --speed fast
64
+ bunx ccusage opencode weekly
65
+ bunx ccusage amp session
66
+ bunx ccusage pi daily --pi-path /path/to/sessions
67
+ bunx ccusage pi daily --pi-path /path/to/sessions,/archive/pi/sessions
68
+
69
+ # Explicit unified report
70
+ bunx ccusage daily --all
89
71
 
90
72
  # Filters and options
91
- npx ccusage daily --since 20250525 --until 20250530
92
- npx ccusage daily --json # JSON output
93
- npx ccusage daily --breakdown # Per-model cost breakdown
94
- npx ccusage daily --timezone UTC # Use UTC timezone
95
- npx ccusage daily --locale ja-JP # Use Japanese locale for date/time formatting
73
+ bunx ccusage daily --since 2026-04-25 --until 2026-05-16
74
+ bunx ccusage daily --json # JSON output
75
+ bunx ccusage daily --timezone UTC # Use UTC timezone
96
76
 
97
77
  # Project analysis
98
- npx ccusage daily --instances # Group by project/instance
99
- npx ccusage daily --project myproject # Filter to specific project
100
- npx ccusage daily --instances --project myproject --json # Combined usage
78
+ bunx ccusage claude daily --instances # Group Claude Code by project/instance
79
+ bunx ccusage claude daily --project myproject # Filter to specific Claude project
80
+ bunx ccusage claude daily --instances --project myproject --json # Combined usage
101
81
 
102
82
  # Compact mode for screenshots/sharing
103
- npx ccusage --compact # Force compact table mode
104
- npx ccusage monthly --compact # Compact monthly report
83
+ bunx ccusage --compact # Force compact table mode
84
+ bunx ccusage monthly --compact # Compact monthly report
105
85
  ```
106
86
 
107
87
  ## Features
@@ -109,12 +89,13 @@ npx ccusage monthly --compact # Compact monthly report
109
89
  - 📊 **Daily Report**: View token usage and costs aggregated by date
110
90
  - 📅 **Monthly Report**: View token usage and costs aggregated by month
111
91
  - 💬 **Session Report**: View usage grouped by conversation sessions
92
+ - 🤖 **Unified CLI Reports**: View Claude Code, Codex, OpenCode, Amp, and pi-agent usage from one CLI
112
93
  - ⏰ **5-Hour Blocks Report**: Track usage within Claude's billing windows with active block monitoring
113
94
  - 🚀 **Statusline Integration**: Compact usage display for Claude Code status bar hooks (Beta)
114
- - 🤖 **Model Tracking**: See which Claude models you're using (Opus, Sonnet, etc.)
95
+ - 🤖 **Model Tracking**: See which models are used across supported sources
115
96
  - 📊 **Model Breakdown**: View per-model cost breakdown with `--breakdown` flag
116
97
  - 📅 **Date Filtering**: Filter reports by date range using `--since` and `--until`
117
- - 📁 **Custom Path**: Support for custom Claude data directory locations
98
+ - 📁 **Custom Paths**: Support for custom local data directory locations
118
99
  - 🎨 **Beautiful Output**: Colorful table-formatted display with automatic responsive layout
119
100
  - 📱 **Smart Tables**: Automatic compact mode for narrow terminals (< 100 characters) with essential columns
120
101
  - 📸 **Compact Mode**: Use `--compact` flag to force compact table layout, perfect for screenshots and sharing
@@ -122,11 +103,9 @@ npx ccusage monthly --compact # Compact monthly report
122
103
  - 📄 **JSON Output**: Export data in structured JSON format with `--json`
123
104
  - 💰 **Cost Tracking**: Shows costs in USD for each day/month/session
124
105
  - 🔄 **Cache Token Support**: Tracks and displays cache creation and cache read tokens separately
125
- - 🌐 **Offline Mode**: Use pre-cached pricing data without network connectivity with `--offline` (Claude models only)
126
- - 🔌 **MCP Integration**: Built-in Model Context Protocol server for integration with other tools
127
- - 🏗️ **Multi-Instance Support**: Group usage by project with `--instances` flag and filter by specific projects
106
+ - 🌐 **Offline Mode**: Use pre-cached pricing data without network connectivity with `--offline`
107
+ - 🏗️ **Claude Instance Support**: Group Claude Code usage by project with `--instances` and filter by specific projects
128
108
  - 🌍 **Timezone Support**: Configure timezone for date grouping with `--timezone` option
129
- - 🌐 **Locale Support**: Customize date/time formatting with `--locale` option (e.g., en-US, ja-JP, de-DE)
130
109
  - ⚙️ **Configuration Files**: Set defaults with JSON configuration files, complete with IDE autocomplete and validation
131
110
  - 🚀 **Ultra-Small Bundle**: Unlike other CLI tools, we pay extreme attention to bundle size - incredibly small even without minification!
132
111