ccusage 19.0.2 → 20.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
@@ -7,7 +7,6 @@
7
7
  <a href="https://socket.dev/api/npm/package/ccusage"><img src="https://socket.dev/api/badge/npm/package/ccusage" alt="Socket Badge" /></a>
8
8
  <a href="https://npmjs.com/package/ccusage"><img src="https://img.shields.io/npm/v/ccusage?color=yellow" alt="npm version" /></a>
9
9
  <a href="https://tanstack.com/stats/npm?packageGroups=%5B%7B%22packages%22:%5B%7B%22name%22:%22ccusage%22%7D%5D%7D%5D&range=30-days&transform=none&binType=daily&showDataMode=all&height=400"><img src="https://img.shields.io/npm/dt/ccusage" alt="NPM Downloads" /></a>
10
- <a href="https://packagephobia.com/result?p=ccusage"><img src="https://packagephobia.com/badge?p=ccusage" alt="install size" /></a>
11
10
  <a href="https://deepwiki.com/ryoppippi/ccusage"><img src="https://img.shields.io/badge/DeepWiki-ryoppippi%2Fccusage-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==" alt="DeepWiki"></a>
12
11
  <!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
13
12
  <a href="https://github.com/hesreallyhim/awesome-claude-code"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Claude Code" /></a>
@@ -25,26 +24,51 @@
25
24
 
26
25
  ## Supported Sources
27
26
 
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.
27
+ ccusage reads local usage data from coding agent CLIs and turns it into daily, weekly, monthly, and session reports.
28
+
29
+ | Source | Focused command example |
30
+ | ------------------ | ------------------------ |
31
+ | Claude Code | `ccusage claude daily` |
32
+ | Codex | `ccusage codex daily` |
33
+ | OpenCode | `ccusage opencode daily` |
34
+ | Amp | `ccusage amp daily` |
35
+ | Droid | `ccusage droid daily` |
36
+ | Codebuff | `ccusage codebuff daily` |
37
+ | Hermes Agent | `ccusage hermes daily` |
38
+ | pi-agent | `ccusage pi daily` |
39
+ | Goose | `ccusage goose daily` |
40
+ | OpenClaw | `ccusage openclaw daily` |
41
+ | Kilo | `ccusage kilo daily` |
42
+ | Kimi | `ccusage kimi daily` |
43
+ | Qwen | `ccusage qwen daily` |
44
+ | GitHub Copilot CLI | `ccusage copilot daily` |
45
+ | Gemini CLI | `ccusage gemini daily` |
46
+
47
+ Use `ccusage daily`, `ccusage weekly`, `ccusage monthly`, or `ccusage session` to include every detected source in one report.
29
48
 
30
49
  ## Installation
31
50
 
32
51
  ### Quick Start (Recommended)
33
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
+ You can run ccusage directly without a global installation:
35
54
 
36
55
  ```bash
37
56
  # Recommended
38
57
  bunx ccusage
39
58
 
59
+ # Nix
60
+ nix run github:ryoppippi/ccusage -- daily
61
+
40
62
  # Alternative package runners
41
63
  pnpm dlx ccusage
42
64
  pnpx ccusage
43
65
  npx ccusage@latest
66
+
67
+ # PR preview builds
68
+ bunx -p https://pkg.pr.new/ryoppippi/ccusage@<pr-number> ccusage --offline
44
69
  ```
45
70
 
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.
71
+ > [bunx](https://bun.com/docs/pm/bunx) caches the downloaded package, so repeated runs are faster after the first launch.
48
72
 
49
73
  ## Usage
50
74
 
@@ -63,6 +87,16 @@ bunx ccusage claude daily --mode display
63
87
  bunx ccusage codex daily --speed fast
64
88
  bunx ccusage opencode weekly
65
89
  bunx ccusage amp session
90
+ bunx ccusage droid daily
91
+ bunx ccusage codebuff daily
92
+ bunx ccusage hermes daily
93
+ bunx ccusage goose daily
94
+ bunx ccusage openclaw daily
95
+ bunx ccusage kilo daily
96
+ bunx ccusage kimi daily
97
+ bunx ccusage qwen daily
98
+ bunx ccusage copilot daily
99
+ bunx ccusage gemini daily
66
100
  bunx ccusage pi daily --pi-path /path/to/sessions
67
101
  bunx ccusage pi daily --pi-path /path/to/sessions,/archive/pi/sessions
68
102
 
@@ -89,7 +123,7 @@ bunx ccusage monthly --compact # Compact monthly report
89
123
  - 📊 **Daily Report**: View token usage and costs aggregated by date
90
124
  - 📅 **Monthly Report**: View token usage and costs aggregated by month
91
125
  - 💬 **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
126
+ - 🤖 **Unified CLI Reports**: View Claude Code, Codex, OpenCode, Amp, Droid, Codebuff, Hermes Agent, pi-agent, Goose, OpenClaw, Kilo, Kimi, Qwen, GitHub Copilot CLI, and Gemini CLI usage from one CLI
93
127
  - ⏰ **5-Hour Blocks Report**: Track usage within Claude's billing windows with active block monitoring
94
128
  - 🚀 **Statusline Integration**: Compact usage display for Claude Code status bar hooks (Beta)
95
129
  - 🤖 **Model Tracking**: See which models are used across supported sources
@@ -107,31 +141,64 @@ bunx ccusage monthly --compact # Compact monthly report
107
141
  - 🏗️ **Claude Instance Support**: Group Claude Code usage by project with `--instances` and filter by specific projects
108
142
  - 🌍 **Timezone Support**: Configure timezone for date grouping with `--timezone` option
109
143
  - ⚙️ **Configuration Files**: Set defaults with JSON configuration files, complete with IDE autocomplete and validation
110
- - 🚀 **Ultra-Small Bundle**: Unlike other CLI tools, we pay extreme attention to bundle size - incredibly small even without minification!
111
144
 
112
145
  ## Documentation
113
146
 
114
147
  Full documentation is available at **[ccusage.com](https://ccusage.com/)**
115
148
 
116
- ## Development Setup
149
+ ## Development
117
150
 
118
- ### Using Nix (Recommended for Contributors)
151
+ <details>
152
+ <summary>Nix-based contributor setup</summary>
119
153
 
120
- For contributors and developers working on ccusage, we provide a Nix flake-based development environment:
154
+ Use the Nix flake development environment. Install [Nix](https://nixos.org/) with the `nix-command` and `flakes` experimental features enabled, then use [nix-direnv](https://github.com/nix-community/nix-direnv) so the repository dev shell loads automatically when you enter the directory:
121
155
 
122
- ```bash
156
+ ```sh
123
157
  # Clone the repository
124
158
  git clone https://github.com/ryoppippi/ccusage.git
125
159
  cd ccusage
126
160
 
127
- # Allow direnv (automatically loads Nix environment)
161
+ # Allow direnv to load the Nix dev shell
128
162
  direnv allow
163
+ ```
164
+
165
+ The dev shell provides the pinned `pnpm`, Rust toolchain, GitHub CLI, and project utilities from `flake.nix`. It also installs package dependencies from `pnpm-lock.yaml` when needed.
129
166
 
130
- # Or manually enter the development shell
167
+ If you do not use direnv, enter the shell manually:
168
+
169
+ ```sh
131
170
  nix develop
132
171
  ```
133
172
 
134
- This ensures consistent tooling versions across all contributors and CI systems. The development environment is defined in `flake.nix` and automatically activated via direnv when entering the project directory.
173
+ Run the usual checks from inside the Nix environment:
174
+
175
+ ```sh
176
+ pnpm run format
177
+ pnpm typecheck
178
+ pnpm run test
179
+ ```
180
+
181
+ ### Nix Package
182
+
183
+ The flake exposes `ccusage` as the default package and app:
184
+
185
+ ```sh
186
+ nix run github:ryoppippi/ccusage
187
+ nix run github:ryoppippi/ccusage -- codex daily --offline
188
+ nix build github:ryoppippi/ccusage
189
+ ```
190
+
191
+ Nix builds embed the LiteLLM pricing file from the locked `litellm-pricing` flake input, so sandboxed builds do not fetch pricing at build time. To update the locked pricing snapshot and refresh the non-Nix Cargo fallback JSON:
192
+
193
+ ```bash
194
+ nix flake update litellm-pricing
195
+ nix run .#update-pricing-fallback
196
+ nix flake check
197
+ ```
198
+
199
+ The scheduled `update pricing` workflow runs the same commands and opens a PR when the locked input changes.
200
+
201
+ </details>
135
202
 
136
203
  ## Sponsors
137
204