cctrackr 0.1.0 → 0.1.1
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 +72 -72
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Know exactly what Claude Code costs you. Accurate token tracking, cost breakdown
|
|
|
11
11
|
cctrack reads Claude Code's local usage logs and turns them into actionable analytics. It deduplicates requests, applies Anthropic's tiered pricing, and gives you cost breakdowns by day, session, project, and model -- in the terminal or as an interactive HTML dashboard.
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
|
-
<img src="assets/dashboard-hero.png" alt="
|
|
14
|
+
<img src="assets/dashboard-hero.png" alt="cctrackr dashboard overview" width="100%">
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
## Features
|
|
@@ -112,87 +112,87 @@ Compares your projected monthly cost against Pro, Max 5x, and Max 20x subscripti
|
|
|
112
112
|
|
|
113
113
|
| Command | Description |
|
|
114
114
|
|---|---|
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
115
|
+
| `cctrackr` | Open interactive HTML dashboard (default) |
|
|
116
|
+
| `cctrackrdaily` | Daily usage breakdown with cost sparklines |
|
|
117
|
+
| `cctrackrmonthly` | Monthly aggregated view |
|
|
118
|
+
| `cctrackrsession` | Per-session breakdown with project and model |
|
|
119
|
+
| `cctrackrblocks` | Usage grouped by 5-hour windows |
|
|
120
|
+
| `cctrackrroi` | ROI analysis vs subscription plans |
|
|
121
|
+
| `cctrackrlive` | Real-time terminal monitor with burn rate |
|
|
122
|
+
| `cctrackrstatusline` | Compact one-line output for tmux/editors |
|
|
123
|
+
| `cctrackrlimits` | Rate limit analysis (billable token tracking) |
|
|
124
|
+
| `cctrackrexport csv` | Export per-request data as CSV |
|
|
125
|
+
| `cctrackrexport json` | Export structured JSON |
|
|
126
|
+
| `cctrackrpricing list` | View all model prices |
|
|
127
|
+
| `cctrackrconfig` | Manage budgets and settings |
|
|
128
128
|
|
|
129
129
|
## Command Details
|
|
130
130
|
|
|
131
|
-
### `
|
|
131
|
+
### `cctrackrdashboard`
|
|
132
132
|
|
|
133
133
|
Opens an interactive HTML dashboard in your browser. The HTML file is self-contained -- no server needed. You can save it, share it, or archive it.
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
cctrackr dashboard # Open in browser
|
|
137
|
+
cctrackr dashboard --save report.html # Save to file without opening
|
|
138
|
+
cctrackr dashboard --json # Output raw dashboard data as JSON
|
|
139
|
+
cctrackr dashboard --project my-app # Pre-filter to a specific project
|
|
140
|
+
cctrackr dashboard --since 2026-03-01 # Filter from a date
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
### `
|
|
143
|
+
### `cctrackrroi`
|
|
144
144
|
|
|
145
145
|
Compares your actual API-equivalent cost against subscription plans. Supports fuzzy plan names:
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
cctrackr roi # Default: compare against all plans
|
|
149
|
+
cctrackr roi --plan pro # Compare against Pro ($20/mo)
|
|
150
|
+
cctrackr roi --plan max5 # Compare against Max 5x ($100/mo)
|
|
151
|
+
cctrackr roi --plan 200 # Fuzzy: "200" resolves to Max 20x
|
|
152
|
+
cctrackr roi --plan max # Fuzzy: "max" resolves to Max 5x
|
|
153
|
+
cctrackr roi --json # Machine-readable output
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
-
### `
|
|
156
|
+
### `cctrackrlive`
|
|
157
157
|
|
|
158
158
|
Real-time terminal monitor that refreshes every few seconds. Shows today's cost, burn rate, and budget status. Press Ctrl+C to exit.
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
cctrackr live # Default refresh every 5 seconds
|
|
162
|
+
cctrackr live --interval 10 # Refresh every 10 seconds
|
|
163
|
+
cctrackr live --project my-app # Monitor a specific project
|
|
164
|
+
cctrackr live --mode display # Use Claude Code's cost estimates
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
### `
|
|
167
|
+
### `cctrackrblocks`
|
|
168
168
|
|
|
169
169
|
Groups usage into 5-hour time windows to reveal consumption patterns. Also displays weekly rate limit windows and extra usage credit data when available (from statusline hook).
|
|
170
170
|
|
|
171
171
|
```bash
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
cctrackr blocks # Current window and recent history
|
|
173
|
+
cctrackr blocks --json # Machine-readable output
|
|
174
|
+
cctrackr blocks --live # Auto-refresh every 5 seconds
|
|
175
|
+
cctrackr blocks --since 2026-03-25 # Filter by date range
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
-
### `
|
|
178
|
+
### `cctrackrlimits`
|
|
179
179
|
|
|
180
180
|
Analyzes rate limit consumption using billable tokens only (input + cache_creation, excluding cache_read).
|
|
181
181
|
|
|
182
182
|
```bash
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
cctrackr limits # Terminal summary
|
|
184
|
+
cctrackr limits --json # Detailed JSON with prediction model
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
### `
|
|
187
|
+
### `cctrackrstatusline`
|
|
188
188
|
|
|
189
189
|
Designed to be piped into tmux or editor status bars. Ultra-fast with a 30-second cache for repeated calls.
|
|
190
190
|
|
|
191
191
|
```bash
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
cctrackr statusline # One-line summary
|
|
193
|
+
cctrackr statusline --json # Structured JSON for scripts
|
|
194
|
+
cctrackr statusline --format '{cost} | {model}' # Custom format
|
|
195
|
+
cctrackr statusline --no-cache # Force fresh parse
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
**Custom format placeholders:** `{cost}`, `{model}`, `{tokens}`, `{block_pct}`, `{block_remaining}`
|
|
@@ -201,22 +201,22 @@ To use as a Claude Code statusline hook (receives real rate limit data from stdi
|
|
|
201
201
|
|
|
202
202
|
```json
|
|
203
203
|
{
|
|
204
|
-
"statusline": "
|
|
204
|
+
"statusline": "cctrackr statusline"
|
|
205
205
|
}
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
When configured as a hook, cctrack receives rate limit data (`used_percentage`, `resets_at`, weekly windows, extra usage credits) directly from Claude Code's stdin. This data is persisted to `~/.cctrack/ratelimits.json` and shared with `blocks` and `live` commands.
|
|
209
209
|
|
|
210
|
-
### `
|
|
210
|
+
### `cctrackrexport`
|
|
211
211
|
|
|
212
212
|
Export raw per-request data for external analysis:
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
cctrackr export csv # CSV to stdout
|
|
216
|
+
cctrackr export csv > usage.csv # Save to file
|
|
217
|
+
cctrackr export json # Full dashboard JSON
|
|
218
|
+
cctrackr export csv --since 2026-03-01 # Date-filtered export
|
|
219
|
+
cctrackr export csv --project my-app # Project-filtered export
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
### Cost Modes
|
|
@@ -230,8 +230,8 @@ The `--mode` flag controls how costs are calculated:
|
|
|
230
230
|
| `compare` | Shows both calculated and display costs side by side |
|
|
231
231
|
|
|
232
232
|
```bash
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
cctrackr daily --mode display # Use Claude Code's cost estimates
|
|
234
|
+
cctrackr daily --mode compare # Compare both methods
|
|
235
235
|
```
|
|
236
236
|
|
|
237
237
|
## Terminal Output Examples
|
|
@@ -239,7 +239,7 @@ cctrack daily --mode compare # Compare both methods
|
|
|
239
239
|
**Daily breakdown:**
|
|
240
240
|
|
|
241
241
|
```
|
|
242
|
-
$
|
|
242
|
+
$ cctrackr daily
|
|
243
243
|
|
|
244
244
|
┌────────────┬────────┬────────┬─────────────┬────────────┬────────┬──────────────────┐
|
|
245
245
|
│ Date │ Input │ Output │ Cache Write │ Cache Read │ Total │ Cost │
|
|
@@ -256,7 +256,7 @@ Burn rate: $3.14/hr, $75.38/day → projected $2261.25/month
|
|
|
256
256
|
**Session view:**
|
|
257
257
|
|
|
258
258
|
```
|
|
259
|
-
$
|
|
259
|
+
$ cctrackr session
|
|
260
260
|
|
|
261
261
|
┌─────────────────┬─────────────┬─────────────┬──────────┬──────────┬────────┬─────────┐
|
|
262
262
|
│ Session ID │ Project │ Model │ Duration │ Requests │ Tokens │ Cost │
|
|
@@ -270,14 +270,14 @@ $ cctrack session
|
|
|
270
270
|
**Statusline (for tmux or editor status bars):**
|
|
271
271
|
|
|
272
272
|
```
|
|
273
|
-
$
|
|
273
|
+
$ cctrackr statusline
|
|
274
274
|
$58.30 today │ opus-4.6 │ 99.9M tok │ █████░░░ 52% 5h (2h 15m)
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
**ROI analysis:**
|
|
278
278
|
|
|
279
279
|
```
|
|
280
|
-
$
|
|
280
|
+
$ cctrackr roi --plan max5
|
|
281
281
|
|
|
282
282
|
ROI Analysis (max5 plan)
|
|
283
283
|
────────────────────────
|
|
@@ -291,7 +291,7 @@ Projected monthly: $2261.25
|
|
|
291
291
|
**Blocks view:**
|
|
292
292
|
|
|
293
293
|
```
|
|
294
|
-
$
|
|
294
|
+
$ cctrackr blocks
|
|
295
295
|
|
|
296
296
|
┌───────────────────┬──────────┬──────────┬────────┐
|
|
297
297
|
│ Window │ Requests │ Tokens │ Cost │
|
|
@@ -333,8 +333,8 @@ $ cctrack blocks
|
|
|
333
333
|
Set daily or monthly spending budgets:
|
|
334
334
|
|
|
335
335
|
```bash
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
cctrackr config set budget.daily 100
|
|
337
|
+
cctrackr config set budget.monthly 2000
|
|
338
338
|
```
|
|
339
339
|
|
|
340
340
|
The `daily` and `live` commands show a color-coded progress bar:
|
|
@@ -355,10 +355,10 @@ Daily Budget: ████████████░░░░░░░░ 62% (
|
|
|
355
355
|
cctrack maintains accurate per-token pricing for all 14 Anthropic models:
|
|
356
356
|
|
|
357
357
|
```bash
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
cctrackr pricing list # View all model prices
|
|
359
|
+
cctrackr pricing status # Check pricing source and freshness
|
|
360
|
+
cctrackr pricing update # Force-fetch latest prices from Anthropic
|
|
361
|
+
cctrackr pricing list --json # Machine-readable pricing data
|
|
362
362
|
```
|
|
363
363
|
|
|
364
364
|
Pricing works in two tiers:
|
|
@@ -388,11 +388,11 @@ Anthropic does not count `cache_read` tokens toward rate limits -- only `input`
|
|
|
388
388
|
|
|
389
389
|
### Statusline data depends on your setup
|
|
390
390
|
|
|
391
|
-
`
|
|
391
|
+
`cctrackrstatusline` is designed to be used as a Claude Code statusline hook (configured via `.claude/settings.json`). When configured this way, it receives real rate limit data (`used_percentage`, `resets_at`) directly from Claude Code's stdin on every assistant message. **If you run `cctrackrstatusline` manually from a terminal, this real-time rate limit data is not available** -- you will only see cost and token data derived from JSONL logs.
|
|
392
392
|
|
|
393
393
|
### Blocks are approximations, not Anthropic's actual windows
|
|
394
394
|
|
|
395
|
-
`
|
|
395
|
+
`cctrackrblocks` groups your usage into 5-hour windows to help you see usage patterns. These windows are based on your local timestamps and do not correspond to Anthropic's internal rate limit windows. Anthropic's rate limiting involves multiple overlapping systems that are not publicly documented and cannot be reconstructed from JSONL data alone.
|
|
396
396
|
|
|
397
397
|
### Rate limit prediction is uncalibrated
|
|
398
398
|
|
|
@@ -414,11 +414,11 @@ cctrack uses Anthropic's publicly listed per-token prices. Your actual bill may
|
|
|
414
414
|
Config is stored at `~/.cctrack/config.json`:
|
|
415
415
|
|
|
416
416
|
```bash
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
417
|
+
cctrackr config set budget.daily 100 # Daily budget in $
|
|
418
|
+
cctrackr config set budget.monthly 2000 # Monthly budget in $
|
|
419
|
+
cctrackr config set budget.block 50 # Per 5-hour block budget in $
|
|
420
|
+
cctrackr config get # View current config
|
|
421
|
+
cctrackr config reset # Reset to defaults
|
|
422
422
|
```
|
|
423
423
|
|
|
424
424
|
**Environment variables:**
|