ccusage 0.6.1 → 0.7.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
@@ -3,10 +3,9 @@
3
3
  > **ccusage(claude-code-usage)**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/ccusage?color=yellow)](https://npmjs.com/package/ccusage)
6
- [![NPM Downloads](https://img.shields.io/npm/dy/ccusage)](https://www.npmjs.com/package/ccusage)
7
- [![DeepWiki](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==)](https://deepwiki.com/ryoppippi/ccusage)
8
-
9
- <!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
6
+ [![NPM Downloads](https://img.shields.io/npm/dy/ccusage)](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)
7
+ [![DeepWiki](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==)](https://deepwiki.com/ryoppippi/ccusage)<!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
8
+ [![Mentioned in Awesome Claude Code](https://awesome.re/mentioned-badge.svg)](https://github.com/hesreallyhim/awesome-claude-code)
10
9
 
11
10
  <div align="center">
12
11
  <img src="https://github.com/ryoppippi/ccusage/blob/main/docs/screenshot.png?raw=true">
@@ -42,6 +41,8 @@ This tool helps you understand the value you're getting from your subscription b
42
41
  - 📊 **Daily Report**: View token usage and costs aggregated by date
43
42
  - 📅 **Monthly Report**: View token usage and costs aggregated by month
44
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
45
46
  - 📅 **Date Filtering**: Filter reports by date range using `--since` and `--until`
46
47
  - 📁 **Custom Path**: Support for custom Claude data directory locations
47
48
  - 🎨 **Beautiful Output**: Colorful table-formatted display
@@ -142,6 +143,9 @@ ccusage daily --mode display # Always show pre-calculated costUSD values
142
143
  # Control sort order
143
144
  ccusage daily --order asc # Show oldest dates first
144
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.)
145
149
  ```
146
150
 
147
151
  `ccusage` is an alias for `ccusage daily`, so you can run it without specifying the subcommand.
@@ -171,6 +175,9 @@ ccusage monthly --mode display # Always show pre-calculated costUSD values
171
175
  # Control sort order
172
176
  ccusage monthly --order asc # Show oldest months first
173
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
174
181
  ```
175
182
 
176
183
  ### Session Report
@@ -198,6 +205,9 @@ ccusage session --mode display # Always show pre-calculated costUSD values
198
205
  # Control sort order
199
206
  ccusage session --order asc # Show oldest sessions first
200
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
201
211
  ```
202
212
 
203
213
  ### Options
@@ -210,6 +220,7 @@ All commands support the following options:
210
220
  - `-j, --json`: Output results in JSON format instead of table
211
221
  - `-m, --mode <mode>`: Cost calculation mode: `auto` (default), `calculate`, or `display`
212
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.)
213
224
  - `-d, --debug`: Show pricing mismatch information for debugging
214
225
  - `--debug-samples <number>`: Number of sample discrepancies to show in debug output (default: 5)
215
226
  - `-h, --help`: Display help message
@@ -296,15 +307,37 @@ After adding this configuration, restart Claude Desktop. You'll then be able to
296
307
  │ │
297
308
  ╰──────────────────────────────────────────╯
298
309
 
299
- ┌──────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┐
300
- │ Date │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
301
- ├──────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
302
- │ 2025-05-30 │ 277 │ 31,456 │ 512 │ 1,024 │ 33,269 │ $17.58 │
303
- │ 2025-05-29 │ 959 │ 39,662 │ 256 │ 768 │ 41,645 │ $16.42 │
304
- │ 2025-05-28 │ 155 │ 21,693 │ 128 │ 512 │ 22,488 │ $8.36 │
305
- ├──────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┤
306
- │ Total │ 11,174 │ 720,366 │ 896 │ 2,304 │ 734,740 │ $336.47 │
307
- └──────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┘
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
+ └──────────────┴──────────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┘
308
341
  ```
309
342
 
310
343
  ### Session Report
@@ -316,15 +349,15 @@ After adding this configuration, restart Claude Desktop. You'll then be able to
316
349
  │ │
317
350
  ╰───────────────────────────────────────────────╯
318
351
 
319
- ┌─────────────┬────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┬───────────────┐
320
- │ Project │ Session │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │ Last Activity │
321
- ├─────────────┼────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
322
- │ myproject │ session-1 │ 4,512 │ 350,846 │ 512 │ 1,024 │ 356,894 │ $156.40 │ 2025-05-24 │
323
- ├─────────────┼────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
324
- │ myproject │ session-2 │ 2,775 │ 186,645 │ 256 │ 768 │ 190,444 │ $98.45 │ 2025-05-25 │
325
- ├─────────────┼────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
326
- │ Total │ │ 11,174 │ 720,445 │ 768 │ 1,792 │ 734,179 │ $336.68 │ │
327
- └─────────────┴────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┴───────────────┘
352
+ ┌─────────────┬────────────┬──────────────────┬────────┬─────────┬──────────────┬────────────┬──────────────┬────────────┬───────────────┐
353
+ │ Project │ Session │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │ Last Activity │
354
+ ├─────────────┼────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
355
+ │ myproject │ session-1 │ opus-4, sonnet-4 │ 4,512 │ 350,846 │ 512 │ 1,024 │ 356,894 │ $156.40 │ 2025-05-24 │
356
+ ├─────────────┼────────────┼──────────────────┼────────┼─────────┼──────────────┼────────────┼──────────────┼────────────┼───────────────┤
357
+ │ myproject │ 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
+ └─────────────┴────────────┴──────────────────┴────────┴─────────┴──────────────┴────────────┴──────────────┴────────────┴───────────────┘
328
361
  ```
329
362
 
330
363
  ## Requirements
@@ -1,5 +1,5 @@
1
- import "./pricing-fetcher-CfEgfzSr.js";
2
- import { DailyUsage, MonthlyUsage, SessionUsage } from "./data-loader-VdEcqJHc.js";
1
+ import { DailyUsage, MonthlyUsage, SessionUsage } from "./data-loader-pCzn-ryX.js";
2
+ import "./pricing-fetcher-Dq-OLBp4.js";
3
3
 
4
4
  //#region src/calculate-cost.d.ts
5
5
  type TokenData = {