ccusage 18.0.10 → 19.0.0

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,37 @@
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!
24
+ > Analyze coding (agent) CLI token usage and costs from local data.
21
25
 
22
26
  ## ccusage Family
23
27
 
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.
28
+ ### 📊 [ccusage](https://www.npmjs.com/package/ccusage) - Coding (Agent) CLI Usage Analyzer
27
29
 
28
- ### 🤖 [@ccusage/codex](https://www.npmjs.com/package/@ccusage/codex) - OpenAI Codex Usage Analyzer
30
+ 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.
29
31
 
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.
32
+ ### 🤖 [@ccusage/codex](https://www.npmjs.com/package/@ccusage/codex) - Codex Compatibility Wrapper
31
33
 
32
- ### 🚀 [@ccusage/opencode](https://www.npmjs.com/package/@ccusage/opencode) - OpenCode Usage Analyzer
34
+ Compatibility wrapper for OpenAI Codex usage. Prefer `ccusage codex` or `ccusage codex daily`.
33
35
 
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.
36
+ ### 🚀 [@ccusage/opencode](https://www.npmjs.com/package/@ccusage/opencode) - OpenCode Compatibility Wrapper
35
37
 
36
- ### 🥧 [@ccusage/pi](https://www.npmjs.com/package/@ccusage/pi) - Pi-agent Usage Analyzer
38
+ Compatibility wrapper for [OpenCode](https://github.com/opencode-ai/opencode) usage. Prefer `ccusage opencode`.
37
39
 
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.
40
+ ### 🥧 [@ccusage/pi](https://www.npmjs.com/package/@ccusage/pi) - pi-agent Compatibility Wrapper
39
41
 
40
- ### [@ccusage/amp](https://www.npmjs.com/package/@ccusage/amp) - Amp Usage Analyzer
42
+ Compatibility wrapper for [pi-agent](https://github.com/badlogic/pi-mono) usage. Prefer `ccusage pi`.
41
43
 
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.
44
+ ### [@ccusage/amp](https://www.npmjs.com/package/@ccusage/amp) - Amp Compatibility Wrapper
43
45
 
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.
46
+ Compatibility wrapper for [Amp](https://ampcode.com/) usage. Prefer `ccusage amp`.
47
47
 
48
48
  ## Installation
49
49
 
@@ -52,56 +52,63 @@ Model Context Protocol server that exposes ccusage data to Claude Desktop and ot
52
52
  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
53
 
54
54
  ```bash
55
- # Recommended - always include @latest to ensure you get the newest version
56
- npx ccusage@latest
55
+ # Recommended
57
56
  bunx ccusage
58
57
 
59
58
  # Alternative package runners
60
59
  pnpm dlx ccusage
61
60
  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
61
+ npx ccusage@latest
65
62
  ```
66
63
 
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.
64
+ > 💡 **Runtime**: `bunx ccusage` is recommended for everyday use. If you use `npx`, include `@latest` and use Node.js 22+.
65
+ > 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.
68
66
 
69
- ### Related Tools
67
+ ### Compatibility Packages
70
68
 
71
69
  ```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
70
+ npx @ccusage/codex@latest # Deprecated wrapper for: ccusage codex
71
+ npx @ccusage/opencode@latest # Deprecated wrapper for: ccusage opencode
72
+ npx @ccusage/pi@latest # Deprecated wrapper for: ccusage pi
73
+ npx @ccusage/amp@latest # Deprecated wrapper for: ccusage amp
77
74
  ```
78
75
 
79
76
  ## Usage
80
77
 
81
78
  ```bash
82
79
  # 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)
80
+ bunx ccusage # Show all detected sources by day (default)
81
+ bunx ccusage daily # All detected sources by day
82
+ bunx ccusage weekly # All detected sources by week
83
+ bunx ccusage monthly # All detected sources by month
84
+ bunx ccusage session # All detected sources by session
85
+ bunx ccusage blocks # Claude Code 5-hour billing windows
86
+ bunx ccusage statusline # Claude Code status line for hooks (Beta)
87
+
88
+ # Source-focused reports and options
89
+ bunx ccusage claude daily --mode display
90
+ bunx ccusage codex daily --speed fast
91
+ bunx ccusage opencode weekly
92
+ bunx ccusage amp session
93
+ bunx ccusage pi daily --pi-path /path/to/sessions
94
+ bunx ccusage pi daily --pi-path /path/to/sessions,/archive/pi/sessions
95
+
96
+ # Explicit unified report
97
+ bunx ccusage daily --all
89
98
 
90
99
  # 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
100
+ bunx ccusage daily --since 2026-04-25 --until 2026-05-16
101
+ bunx ccusage daily --json # JSON output
102
+ bunx ccusage daily --timezone UTC # Use UTC timezone
96
103
 
97
104
  # 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
105
+ bunx ccusage claude daily --instances # Group Claude Code by project/instance
106
+ bunx ccusage claude daily --project myproject # Filter to specific Claude project
107
+ bunx ccusage claude daily --instances --project myproject --json # Combined usage
101
108
 
102
109
  # Compact mode for screenshots/sharing
103
- npx ccusage --compact # Force compact table mode
104
- npx ccusage monthly --compact # Compact monthly report
110
+ bunx ccusage --compact # Force compact table mode
111
+ bunx ccusage monthly --compact # Compact monthly report
105
112
  ```
106
113
 
107
114
  ## Features
@@ -109,12 +116,13 @@ npx ccusage monthly --compact # Compact monthly report
109
116
  - 📊 **Daily Report**: View token usage and costs aggregated by date
110
117
  - 📅 **Monthly Report**: View token usage and costs aggregated by month
111
118
  - 💬 **Session Report**: View usage grouped by conversation sessions
119
+ - 🤖 **Unified CLI Reports**: View Claude Code, Codex, OpenCode, Amp, and pi-agent usage from one CLI
112
120
  - ⏰ **5-Hour Blocks Report**: Track usage within Claude's billing windows with active block monitoring
113
121
  - 🚀 **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.)
122
+ - 🤖 **Model Tracking**: See which models are used across supported sources
115
123
  - 📊 **Model Breakdown**: View per-model cost breakdown with `--breakdown` flag
116
124
  - 📅 **Date Filtering**: Filter reports by date range using `--since` and `--until`
117
- - 📁 **Custom Path**: Support for custom Claude data directory locations
125
+ - 📁 **Custom Paths**: Support for custom local data directory locations
118
126
  - 🎨 **Beautiful Output**: Colorful table-formatted display with automatic responsive layout
119
127
  - 📱 **Smart Tables**: Automatic compact mode for narrow terminals (< 100 characters) with essential columns
120
128
  - 📸 **Compact Mode**: Use `--compact` flag to force compact table layout, perfect for screenshots and sharing
@@ -122,11 +130,9 @@ npx ccusage monthly --compact # Compact monthly report
122
130
  - 📄 **JSON Output**: Export data in structured JSON format with `--json`
123
131
  - 💰 **Cost Tracking**: Shows costs in USD for each day/month/session
124
132
  - 🔄 **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
133
+ - 🌐 **Offline Mode**: Use pre-cached pricing data without network connectivity with `--offline`
134
+ - 🏗️ **Claude Instance Support**: Group Claude Code usage by project with `--instances` and filter by specific projects
128
135
  - 🌍 **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
136
  - ⚙️ **Configuration Files**: Set defaults with JSON configuration files, complete with IDE autocomplete and validation
131
137
  - 🚀 **Ultra-Small Bundle**: Unlike other CLI tools, we pay extreme attention to bundle size - incredibly small even without minification!
132
138