claude-usage-dashboard 1.0.5 → 1.1.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 +62 -52
- package/bin/cli.js +20 -20
- package/package.json +40 -40
- package/public/css/style.css +251 -221
- package/public/index.html +100 -93
- package/public/js/api.js +14 -13
- package/public/js/app.js +180 -140
- package/public/js/charts/cache-efficiency.js +29 -29
- package/public/js/charts/cost-comparison.js +39 -39
- package/public/js/charts/model-distribution.js +48 -48
- package/public/js/charts/project-distribution.js +92 -92
- package/public/js/charts/session-stats.js +117 -117
- package/public/js/charts/token-trend.js +113 -113
- package/public/js/components/date-picker.js +21 -21
- package/public/js/components/plan-selector.js +37 -37
- package/server/aggregator.js +147 -147
- package/server/index.js +33 -33
- package/server/parser.js +92 -92
- package/server/pricing.js +52 -52
- package/server/routes/api.js +110 -87
package/README.md
CHANGED
|
@@ -1,52 +1,62 @@
|
|
|
1
|
-
# Claude Usage Dashboard
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- **Token
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
# Claude Usage Dashboard
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/claude-usage-dashboard)
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Token tracking** — Total tokens with breakdown by input, output, cache read, and cache write
|
|
12
|
+
- **Cost estimation** — API cost equivalent at standard pricing, compared against your subscription plan (Pro / Max 5x / Max 20x)
|
|
13
|
+
- **Token consumption trend** — Stacked bar chart with hourly, daily, weekly, or monthly granularity
|
|
14
|
+
- **Model distribution** — Donut chart showing usage across Claude models
|
|
15
|
+
- **Cache efficiency** — Visual breakdown of cache read, cache creation, and uncached requests
|
|
16
|
+
- **Project distribution** — Horizontal bar chart comparing token usage across projects
|
|
17
|
+
- **Session details** — Sortable, paginated table of every session with cost and duration
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
Run directly without installing:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx claude-usage-dashboard
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Open http://localhost:3000 in your browser.
|
|
28
|
+
|
|
29
|
+
### From Source
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/ludengz/claudeUsageDashboard.git
|
|
33
|
+
cd claudeUsageDashboard
|
|
34
|
+
npm install
|
|
35
|
+
npm start
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Custom Port
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
PORT=8080 npx claude-usage-dashboard
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## How It Works
|
|
45
|
+
|
|
46
|
+
The dashboard reads Claude Code session logs from `~/.claude/projects/` — if you use Claude Code, these already exist on your machine. Logs are parsed once at startup; restart the server to pick up new session data.
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
|
|
50
|
+
- **Backend:** Node.js, Express 5
|
|
51
|
+
- **Frontend:** Vanilla JS (ES modules), D3.js v7
|
|
52
|
+
- **Tests:** Mocha + Chai
|
|
53
|
+
|
|
54
|
+
## Running Tests
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
ISC
|
package/bin/cli.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from 'child_process';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
const server = path.join(__dirname, '..', 'server', 'index.js');
|
|
8
|
-
|
|
9
|
-
const child = spawn(process.execPath, [server], {
|
|
10
|
-
stdio: 'inherit',
|
|
11
|
-
// Attach child to the terminal's foreground process group
|
|
12
|
-
detached: false,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|
|
16
|
-
|
|
17
|
-
// Forward signals to child
|
|
18
|
-
for (const sig of ['SIGINT', 'SIGTERM']) {
|
|
19
|
-
process.on(sig, () => child.kill(sig));
|
|
20
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const server = path.join(__dirname, '..', 'server', 'index.js');
|
|
8
|
+
|
|
9
|
+
const child = spawn(process.execPath, [server], {
|
|
10
|
+
stdio: 'inherit',
|
|
11
|
+
// Attach child to the terminal's foreground process group
|
|
12
|
+
detached: false,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
16
|
+
|
|
17
|
+
// Forward signals to child
|
|
18
|
+
for (const sig of ['SIGINT', 'SIGTERM']) {
|
|
19
|
+
process.on(sig, () => child.kill(sig));
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "claude-usage-dashboard",
|
|
3
|
-
"version": "1.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.js"
|
|
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/claudeUsageDashboard.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.1.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.js"
|
|
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/claudeUsageDashboard.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
|
+
}
|