ccusage 0.6.2 → 0.8.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
@@ -41,6 +41,8 @@ This tool helps you understand the value you're getting from your subscription b
41
41
  - 📊 **Daily Report**: View token usage and costs aggregated by date
42
42
  - 📅 **Monthly Report**: View token usage and costs aggregated by month
43
43
  - 💬 **Session Report**: View usage grouped by conversation sessions
44
+ - 🤖 **Model Tracking**: See which Claude models you're using (Opus, Sonnet, etc.)
45
+ - 📊 **Model Breakdown**: View per-model cost breakdown with `--breakdown` flag
44
46
  - 📅 **Date Filtering**: Filter reports by date range using `--since` and `--until`
45
47
  - 📁 **Custom Path**: Support for custom Claude data directory locations
46
48
  - 🎨 **Beautiful Output**: Colorful table-formatted display
@@ -141,6 +143,9 @@ ccusage daily --mode display # Always show pre-calculated costUSD values
141
143
  # Control sort order
142
144
  ccusage daily --order asc # Show oldest dates first
143
145
  ccusage daily --order desc # Show newest dates first (default)
146
+
147
+ # Show per-model cost breakdown
148
+ ccusage daily --breakdown # Show cost breakdown by model (opus-4, sonnet-4, etc.)
144
149
  ```
145
150
 
146
151
  `ccusage` is an alias for `ccusage daily`, so you can run it without specifying the subcommand.
@@ -170,6 +175,9 @@ ccusage monthly --mode display # Always show pre-calculated costUSD values
170
175
  # Control sort order
171
176
  ccusage monthly --order asc # Show oldest months first
172
177
  ccusage monthly --order desc # Show newest months first (default)
178
+
179
+ # Show per-model cost breakdown
180
+ ccusage monthly --breakdown # Show cost breakdown by model
173
181
  ```
174
182
 
175
183
  ### Session Report
@@ -197,6 +205,9 @@ ccusage session --mode display # Always show pre-calculated costUSD values
197
205
  # Control sort order
198
206
  ccusage session --order asc # Show oldest sessions first
199
207
  ccusage session --order desc # Show newest sessions first (default)
208
+
209
+ # Show per-model cost breakdown
210
+ ccusage session --breakdown # Show cost breakdown by model
200
211
  ```
201
212
 
202
213
  ### Options
@@ -209,6 +220,7 @@ All commands support the following options:
209
220
  - `-j, --json`: Output results in JSON format instead of table
210
221
  - `-m, --mode <mode>`: Cost calculation mode: `auto` (default), `calculate`, or `display`
211
222
  - `-o, --order <order>`: Sort order: `desc` (newest first, default) or `asc` (oldest first).
223
+ - `-b, --breakdown`: Show per-model cost breakdown (splits usage by Opus, Sonnet, etc.)
212
224
  - `-d, --debug`: Show pricing mismatch information for debugging
213
225
  - `--debug-samples <number>`: Number of sample discrepancies to show in debug output (default: 5)
214
226
  - `-h, --help`: Display help message
@@ -295,15 +307,37 @@ After adding this configuration, restart Claude Desktop. You'll then be able to
295
307
  │ │
296
308
  ╰──────────────────────────────────────────╯
297
309
 
298
- ┌──────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┐
299
- │ Date │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
300
- ├──────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
301
- │ 2025-05-30 │ 277 │ 31,456 │ 512 │ 1,024 │ 33,269 │ $17.58 │
302
- │ 2025-05-29 │ 959 │ 39,662 │ 256 │ 768 │ 41,645 │ $16.42 │
303
- │ 2025-05-28 │ 155 │ 21,693 │ 128 │ 512 │ 22,488 │ $8.36 │
304
- ├──────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
305
- │ Total │ 11,174 │ 720,366 │ 896 │ 2,304 │ 734,740 │ $336.47 │
306
- └──────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┘
310
+ ┌──────────────┬──────────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┐
311
+ │ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
312
+ ├──────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
313
+ │ 2025-05-30 │ opus-4, sonnet-4 │ 277 │ 31,456 │ 512 │ 1,024 │ 33,269 │ $17.58 │
314
+ │ 2025-05-29 │ sonnet-4 │ 959 │ 39,662 │ 256 │ 768 │ 41,645 │ $16.42 │
315
+ │ 2025-05-28 │ opus-4 │ 155 │ 21,693 │ 128 │ 512 │ 22,488 │ $8.36 │
316
+ ├──────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
317
+ │ Total │ 11,174 │ 720,366 │ 896 │ 2,304 │ 734,740 │ $336.47 │
318
+ └──────────────┴──────────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┘
319
+ ```
320
+
321
+ With `--breakdown` flag:
322
+
323
+ ```
324
+ ╭──────────────────────────────────────────╮
325
+ │ │
326
+ │ Claude Code Token Usage Report - Daily │
327
+ │ │
328
+ ╰──────────────────────────────────────────╯
329
+
330
+ ┌──────────────┬──────────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┐
331
+ │ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
332
+ ├──────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
333
+ │ 2025-05-30 │ opus-4, sonnet-4 │ 277 │ 31,456 │ 512 │ 1,024 │ 33,269 │ $17.58 │
334
+ ├──────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
335
+ │ └─ opus-4 │ │ 100 │ 15,000 │ 256 │ 512 │ 15,868 │ $10.25 │
336
+ ├──────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
337
+ │ └─ sonnet-4│ │ 177 │ 16,456 │ 256 │ 512 │ 17,401 │ $7.33 │
338
+ ├──────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
339
+ │ Total │ │ 11,174 │ 720,366 │ 896 │ 2,304 │ 734,740 │ $336.47 │
340
+ └──────────────┴──────────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┘
307
341
  ```
308
342
 
309
343
  ### Session Report
@@ -315,15 +349,15 @@ After adding this configuration, restart Claude Desktop. You'll then be able to
315
349
  │ │
316
350
  ╰───────────────────────────────────────────────╯
317
351
 
318
- ┌─────────────┬────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┬───────────────┐
319
- Project │ Session │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │ Last Activity │
320
- ├─────────────┼────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
321
- myproject │ session-1 │ 4,512 │ 350,846 │ 512 │ 1,024 │ 356,894 │ $156.40 │ 2025-05-24 │
322
- ├─────────────┼────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
323
- myproject │ session-2 │ 2,775 │ 186,645 │ 256 │ 768 │ 190,444 │ $98.45 │ 2025-05-25 │
324
- ├─────────────┼────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
325
- │ Total │ 11,174 │ 720,445 │ 768 │ 1,792 │ 734,179 │ $336.68 │ │
326
- └─────────────┴────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┴───────────────┘
352
+ ┌────────────┬──────────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┬───────────────┐
353
+ │ Session │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │ Last Activity │
354
+ ├────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
355
+ │ session-1 │ opus-4, sonnet-4 │ 4,512 │ 350,846 │ 512 │ 1,024 │ 356,894 │ $156.40 │ 2025-05-24 │
356
+ ├────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
357
+ │ session-2 │ sonnet-4 │ 2,775 │ 186,645 │ 256 │ 768 │ 190,444 │ $98.45 │ 2025-05-25 │
358
+ ├────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
359
+ │ Total │ 11,174 │ 720,445 │ 768 │ 1,792 │ 734,179 │ $336.68 │ │
360
+ └────────────┴──────────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┴───────────────┘
327
361
  ```
328
362
 
329
363
  ## Requirements
@@ -1,4 +1,4 @@
1
- import { DailyUsage, MonthlyUsage, SessionUsage } from "./data-loader-B0tJZeHI.js";
1
+ import { DailyUsage, MonthlyUsage, SessionUsage } from "./data-loader-amTZCtBR.js";
2
2
  import "./pricing-fetcher-Dq-OLBp4.js";
3
3
 
4
4
  //#region src/calculate-cost.d.ts