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 +55 -22
- package/dist/calculate-cost.d.ts +2 -2
- package/dist/{data-loader-DP5qBPn6.js → data-loader-nOFcMg_V.js} +720 -171
- package/dist/data-loader-pCzn-ryX.d.ts +180 -0
- package/dist/data-loader.d.ts +3 -3
- package/dist/data-loader.js +5 -5
- package/dist/{debug-C_5Qx11m.js → debug-Bttss7TN.js} +42 -37
- package/dist/debug.js +5 -5
- package/dist/{dist-C0-Tf5eD.js → dist-BEQ1tJCL.js} +1 -18
- package/dist/{dist-LwbOR2Yw.js → dist-DAarI-SJ.js} +1 -1
- package/dist/{effect-WSjEuzC9-CJfWUy0j.js → effect-WSjEuzC9-ChJ5OQQf.js} +1 -1
- package/dist/{index-CISmcbXk-DCA05NUL.js → index-CISmcbXk-x9eVmhGM.js} +4 -4
- package/dist/index.js +84 -137
- package/dist/{logger-DsQC4OvA.js → logger-BPjA3VFO.js} +1 -1
- package/dist/logger.js +1 -1
- package/dist/{mcp-BQdv12mr.js → mcp-DCEVbd8C.js} +15 -9
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +6 -6
- package/dist/pricing-fetcher-CAeJvZnF.js +79 -0
- package/dist/{pricing-fetcher-CfEgfzSr.d.ts → pricing-fetcher-Dq-OLBp4.d.ts} +22 -10
- package/dist/pricing-fetcher.d.ts +2 -2
- package/dist/pricing-fetcher.js +4 -4
- package/dist/{sury-DmrZ3_Oj-CCL_DlTt.js → sury-DmrZ3_Oj-l0qqtY-f.js} +1 -1
- package/dist/valibot-CQk-M5rL-BNHzwpA0.js +10 -0
- package/dist/{zod-Db63SLXj-Dyc_OWjq.js → zod-Db63SLXj-N1oN-yiY.js} +1 -1
- package/package.json +1 -1
- package/dist/data-loader-VdEcqJHc.d.ts +0 -71
- package/dist/pricing-fetcher-BPUgMrB_.js +0 -60
- package/dist/valibot-CQk-M5rL-CkjrLVu1.js +0 -10
package/README.md
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
> **ccusage(claude-code-usage)**
|
|
4
4
|
|
|
5
5
|
[](https://npmjs.com/package/ccusage)
|
|
6
|
-
[](https://
|
|
7
|
-
[](https://deepwiki.com/ryoppippi/ccusage)
|
|
8
|
-
|
|
9
|
-
<!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
|
|
6
|
+
[](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
|
+
[](https://deepwiki.com/ryoppippi/ccusage)<!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
|
|
8
|
+
[](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
|
package/dist/calculate-cost.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
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 = {
|