claude-usage-dashboard 1.3.13 → 1.4.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
@@ -1,33 +1,49 @@
1
1
  # Claude Usage Dashboard
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/claude-usage-dashboard)](https://www.npmjs.com/package/claude-usage-dashboard)
4
+ [![npm downloads](https://img.shields.io/npm/dm/claude-usage-dashboard)](https://www.npmjs.com/package/claude-usage-dashboard)
4
5
 
5
- A self-hosted dashboard that visualizes your [Claude Code](https://claude.ai/code) usage by parsing local JSONL session logs from `~/.claude/projects/`.
6
+ > Find out what your Claude Code subscription is actually worth in API costs.
7
+
8
+ Your $200/month Max plan might be consuming **$15,000+/month** in API-equivalent value. This dashboard shows you exactly how much — per project, per session, per model. One command to start. Completely local. No data leaves your machine.
9
+
10
+ ```bash
11
+ npx claude-usage-dashboard
12
+ ```
6
13
 
7
14
  ![Dashboard Screenshot](docs/screenshots/dashboard.png)
8
15
 
9
- ## Features
16
+ ## What You'll See
17
+
18
+ ### Know What You're Spending
19
+
20
+ Real-time projected API cost at your current usage rate — weekly and monthly. At 5% quota utilization, you might be burning through **$3,600/week** equivalent. The dashboard calculates this from your actual quota window, not estimates.
21
+
22
+ ### Track Your Quota in Real Time
10
23
 
11
- - **Token tracking** Total tokens with breakdown by input, output, cache read, and cache write
12
- - **Cost estimation** — API cost equivalent at standard pricing
13
- - **Subscription quota** Real-time utilization gauges (5-hour, 7-day, per-model) pulled from the Anthropic API with auto-detection of your plan tier. Includes projected API cost at 100% quota utilization (weekly and monthly), calculated using the exact quota window derived from the 7-day reset time. Shows the quota window date range for transparency. Date picker defaults to the current quota period on page load
14
- - **Token consumption trend** — Stacked bar chart with hourly, daily, weekly, or monthly granularity. Toggle between tokens and dollar view. Includes period summary with avg/min/max stats, active hours heatmap, and smart date range limits per granularity
15
- - **Model distribution** Donut chart showing usage across Claude models
16
- - **Cache efficiency** — Visual breakdown of cache read, cache creation, and uncached requests
17
- - **Project distribution** Horizontal bar chart comparing token usage across projects
18
- - **Session details** — Sortable, paginated table of every session with cost and duration
19
- - **Auto-refresh** Dashboard polls every 30s for new usage data; quota refreshes every 2 minutes
20
- - **Persistent settings** — Date range, granularity, auto-refresh, and y-axis mode are remembered across sessions via localStorage
24
+ Live utilization gauges for 5-hour, 7-day, and per-model quotas pulled directly from the Anthropic API. Auto-detects your plan tier (Pro / Max 5x / Max 20x). Never get throttled by surprise again.
25
+
26
+ ### Find What's Eating Your Tokens
27
+
28
+ Per-project and per-session cost breakdowns show exactly where your usage goes. Sortable session table with cost, duration, and full token breakdown. Spot the expensive sessions instantly.
29
+
30
+ ### Understand Your Cache Efficiency
31
+
32
+ You'll probably discover that ~95% of your tokens are cache reads at 1/10th the cost. The dashboard visualizes cache read vs. cache write vs. uncached requests so you can see how efficiently Claude is using context.
33
+
34
+ ### Everything Else
35
+
36
+ Hourly/daily/weekly/monthly token trends · Dollar and token toggle · Model distribution across Opus/Sonnet/Haiku · Active hours heatmap · Auto-refresh (30s) · Persistent filters via localStorage · Dark theme
21
37
 
22
38
  ## Quick Start
23
39
 
24
- Run directly without installing:
40
+ Run directly no install, no config, no API keys needed:
25
41
 
26
42
  ```bash
27
43
  npx claude-usage-dashboard
28
44
  ```
29
45
 
30
- Open http://localhost:3000 in your browser.
46
+ Open [localhost:3000](http://localhost:3000). That's it.
31
47
 
32
48
  ### From Source
33
49
 
@@ -46,15 +62,9 @@ PORT=8080 npx claude-usage-dashboard
46
62
 
47
63
  ## How It Works
48
64
 
49
- The dashboard reads Claude Code session logs from `~/.claude/projects/` if you use Claude Code, these already exist on your machine. Logs are automatically re-read every 5 seconds, and new usage appears without restarting the server.
50
-
51
- Subscription quota data is fetched from the Anthropic API using your local OAuth credentials (`~/.claude/.credentials.json`). Your plan tier (Pro / Max 5x / Max 20x) is auto-detected from the same file.
52
-
53
- ## Tech Stack
65
+ Reads the JSONL session logs that Claude Code already writes to `~/.claude/projects/` on your machine. If you use Claude Code, the data is already there. Logs are re-read every 5 seconds new usage appears without restarting.
54
66
 
55
- - **Backend:** Node.js, Express 5
56
- - **Frontend:** Vanilla JS (ES modules), D3.js v7
57
- - **Tests:** Mocha + Chai
67
+ Subscription quota data is fetched from the Anthropic API using your existing local OAuth credentials. Your plan tier is auto-detected.
58
68
 
59
69
  ## Running Tests
60
70
 
package/bin/cli.cjs CHANGED
@@ -1,8 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- const { join } = require('path');
3
+ const { join, resolve } = require('path');
4
4
  const { spawnSync } = require('child_process');
5
5
 
6
+ // Parse CLI args before spawning server
7
+ const args = process.argv.slice(2);
8
+ for (let i = 0; i < args.length; i++) {
9
+ if (args[i] === '--sync-dir' && args[i + 1]) {
10
+ process.env.CLAUDE_DASH_SYNC_DIR = resolve(args[i + 1]);
11
+ i++;
12
+ } else if (args[i] === '--machine-name' && args[i + 1]) {
13
+ process.env.CLAUDE_DASH_MACHINE_NAME = args[i + 1];
14
+ i++;
15
+ }
16
+ }
17
+
6
18
  const serverPath = join(__dirname, '..', 'server', 'index.js');
7
19
  const result = spawnSync(process.execPath, [serverPath], { stdio: 'inherit' });
8
20
  process.exit(result.status || 0);
package/bin/cli.js CHANGED
@@ -1,2 +1,16 @@
1
- #!/usr/bin/env node
2
- import '../server/index.js';
1
+ #!/usr/bin/env node
2
+ import path from 'path';
3
+
4
+ // Parse CLI args before importing server
5
+ const args = process.argv.slice(2);
6
+ for (let i = 0; i < args.length; i++) {
7
+ if (args[i] === '--sync-dir' && args[i + 1]) {
8
+ process.env.CLAUDE_DASH_SYNC_DIR = path.resolve(args[i + 1]);
9
+ i++;
10
+ } else if (args[i] === '--machine-name' && args[i + 1]) {
11
+ process.env.CLAUDE_DASH_MACHINE_NAME = args[i + 1];
12
+ i++;
13
+ }
14
+ }
15
+
16
+ await import('../server/index.js');
package/bin/cli.sh CHANGED
@@ -1,11 +1,11 @@
1
- #!/bin/sh
2
- # Resolve symlinks to find the real script location
3
- SCRIPT="$0"
4
- while [ -L "$SCRIPT" ]; do
5
- DIR="$(cd -P "$(dirname "$SCRIPT")" && pwd)"
6
- SCRIPT="$(readlink "$SCRIPT")"
7
- case "$SCRIPT" in /*) ;; *) SCRIPT="$DIR/$SCRIPT" ;; esac
8
- done
9
- DIR="$(cd -P "$(dirname "$SCRIPT")" && pwd)"
10
-
11
- exec node "$DIR/../server/index.js" "$@"
1
+ #!/bin/sh
2
+ # Resolve symlinks to find the real script location
3
+ SCRIPT="$0"
4
+ while [ -L "$SCRIPT" ]; do
5
+ DIR="$(cd -P "$(dirname "$SCRIPT")" && pwd)"
6
+ SCRIPT="$(readlink "$SCRIPT")"
7
+ case "$SCRIPT" in /*) ;; *) SCRIPT="$DIR/$SCRIPT" ;; esac
8
+ done
9
+ DIR="$(cd -P "$(dirname "$SCRIPT")" && pwd)"
10
+
11
+ exec node "$DIR/../server/index.js" "$@"
package/package.json CHANGED
@@ -1,40 +1,43 @@
1
- {
2
- "name": "claude-usage-dashboard",
3
- "version": "1.3.13",
4
- "description": "Dashboard that visualizes Claude Code usage from local session logs",
5
- "main": "server/index.js",
6
- "bin": {
7
- "claude-usage-dashboard": "bin/cli.cjs"
8
- },
9
- "files": [
10
- "bin/",
11
- "server/",
12
- "public/"
13
- ],
14
- "scripts": {
15
- "start": "node server/index.js",
16
- "test": "mocha test/**/*.test.js --timeout 5000"
17
- },
18
- "keywords": [
19
- "claude",
20
- "usage",
21
- "dashboard",
22
- "token",
23
- "cost"
24
- ],
25
- "author": "",
26
- "license": "ISC",
27
- "repository": {
28
- "type": "git",
29
- "url": "https://github.com/ludengz/claude-usage-dashboard.git"
30
- },
31
- "type": "module",
32
- "dependencies": {
33
- "d3": "^7.9.0",
34
- "express": "^5.2.1"
35
- },
36
- "devDependencies": {
37
- "chai": "^6.2.2",
38
- "mocha": "^11.7.5"
39
- }
40
- }
1
+ {
2
+ "name": "claude-usage-dashboard",
3
+ "version": "1.4.0",
4
+ "description": "Dashboard that visualizes Claude Code usage from local session logs",
5
+ "main": "server/index.js",
6
+ "bin": {
7
+ "claude-usage-dashboard": "bin/cli.cjs"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "server/",
12
+ "public/"
13
+ ],
14
+ "scripts": {
15
+ "start": "node server/index.js",
16
+ "test": "mocha test/**/*.test.js --timeout 5000"
17
+ },
18
+ "keywords": [
19
+ "claude",
20
+ "usage",
21
+ "dashboard",
22
+ "token",
23
+ "cost"
24
+ ],
25
+ "author": "",
26
+ "license": "ISC",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/ludengz/claude-usage-dashboard.git"
30
+ },
31
+ "type": "module",
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "dependencies": {
36
+ "d3": "^7.9.0",
37
+ "express": "^5.2.1"
38
+ },
39
+ "devDependencies": {
40
+ "chai": "^6.2.2",
41
+ "mocha": "^11.7.5"
42
+ }
43
+ }