ccusage 18.0.11 → 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 +55 -49
- package/config-schema.json +1667 -173
- package/dist/cli.js +3 -0
- package/dist/data-loader-DT2qlJ97.js +13 -0
- package/dist/data-loader.js +1 -4
- package/dist/index.js +2 -3618
- package/dist/main-CoxUe6C7.js +21 -0
- package/dist/main.bun.js +3 -0
- package/dist/main.node.js +3 -0
- package/package.json +5 -10
- package/dist/_types-DY3gqCWm.js +0 -608
- package/dist/calculate-cost-DWGfKMSD.js +0 -23
- package/dist/calculate-cost.d.ts +0 -74
- package/dist/calculate-cost.js +0 -3
- package/dist/data-loader-9ESMosno.js +0 -5966
- package/dist/data-loader-CdGrTB0Q.d.ts +0 -2360
- package/dist/data-loader.d.ts +0 -2
- package/dist/debug-DvI5DUKR.js +0 -148
- package/dist/debug.d.ts +0 -64
- package/dist/debug.js +0 -5
- package/dist/index.d.ts +0 -1
- package/dist/logger-D9FuoYJ7.js +0 -873
- package/dist/logger.d.ts +0 -25
- package/dist/logger.js +0 -2
- package/dist/prompt-XEKR514o.js +0 -843
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
|
|
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) -
|
|
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
|
-
|
|
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
|
-
|
|
32
|
+
### 🤖 [@ccusage/codex](https://www.npmjs.com/package/@ccusage/codex) - Codex Compatibility Wrapper
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Compatibility wrapper for OpenAI Codex usage. Prefer `ccusage codex` or `ccusage codex daily`.
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
### 🚀 [@ccusage/opencode](https://www.npmjs.com/package/@ccusage/opencode) - OpenCode Compatibility Wrapper
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Compatibility wrapper for [OpenCode](https://github.com/opencode-ai/opencode) usage. Prefer `ccusage opencode`.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
### 🥧 [@ccusage/pi](https://www.npmjs.com/package/@ccusage/pi) - pi-agent Compatibility Wrapper
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
Compatibility wrapper for [pi-agent](https://github.com/badlogic/pi-mono) usage. Prefer `ccusage pi`.
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
### ⚡ [@ccusage/amp](https://www.npmjs.com/package/@ccusage/amp) - Amp Compatibility Wrapper
|
|
43
45
|
|
|
44
|
-
|
|
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 ([](https://packagephobia.com/result?p=ccusage)), you can run it directly without installation:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
# Recommended
|
|
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
|
-
> 💡 **
|
|
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
|
-
###
|
|
67
|
+
### Compatibility Packages
|
|
70
68
|
|
|
71
69
|
```bash
|
|
72
|
-
npx @ccusage/codex@latest #
|
|
73
|
-
npx @ccusage/opencode@latest #
|
|
74
|
-
npx @ccusage/pi@latest #
|
|
75
|
-
npx @ccusage/amp@latest #
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
104
|
-
|
|
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
|
|
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
|
|
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`
|
|
126
|
-
-
|
|
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
|
|