@caius_kong/ccusage-dashboard 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 +77 -31
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,41 +1,87 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Shows **today / this week / this month / custom range** cost & tokens grouped by model,
|
|
5
|
-
a **30-day cost trend chart**, and a **monthly budget alert** (default cap $300).
|
|
6
|
-
Auto-refreshing, numbers straight from ccusage.
|
|
3
|
+
# ccusage-dashboard
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
what ccusage reports (no own pricing tables, no drift).
|
|
5
|
+
**A tiny local dashboard built specifically for [ccusage](https://github.com/ccusage/ccusage).**
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
> ⚠️ **This is not a re-implementation.** Every number you see comes straight from
|
|
8
|
+
> `ccusage ... --json`. No own pricing tables, no re-parsing of session logs — the
|
|
9
|
+
> dashboard is a thin view over ccusage's own accurate cost engine. If `ccusage`
|
|
10
|
+
> says it, this dashboard shows it.
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## What is this?
|
|
17
|
+
|
|
18
|
+
[ccusage](https://github.com/ccusage/ccusage) is a powerful CLI that analyzes coding-agent
|
|
19
|
+
token usage & cost from local data — accurate, but terminal-only and hard to *watch*.
|
|
20
|
+
|
|
21
|
+
**ccusage-dashboard puts a live web UI on top of it**: today / this week / this month /
|
|
22
|
+
custom-range cost grouped by model, a 30-day cost trend, and a monthly budget alert.
|
|
23
|
+
It auto-refreshes while you work, so you can *see* spend happen instead of running reports.
|
|
24
|
+
|
|
25
|
+
Because it shells out to `ccusage` for every number, **cost estimates are always identical
|
|
26
|
+
to what ccusage itself reports** — the source you already trust.
|
|
27
|
+
|
|
28
|
+
## One-command install & start
|
|
12
29
|
|
|
13
30
|
```bash
|
|
14
|
-
|
|
15
|
-
python3 server.py --port 9000 # different port
|
|
16
|
-
python3 server.py --budget 500 # change monthly budget cap (default 300)
|
|
17
|
-
python3 server.py --ccusage-path /path/to/ccusage # use a specific binary
|
|
18
|
-
./run.sh # opens the browser automatically
|
|
31
|
+
npx @caius_kong/ccusage-dashboard
|
|
19
32
|
```
|
|
20
33
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
That's it. npx downloads the package (including its own `ccusage` dependency),
|
|
35
|
+
starts a local server on `http://127.0.0.1:8799`, and opens your browser.
|
|
36
|
+
|
|
37
|
+
> Requirements: **Node.js** (for the launcher) and **Python 3.8+** (for the server).
|
|
38
|
+
> On macOS: `brew install python3`. No other installs, no build step, no config.
|
|
39
|
+
|
|
40
|
+
### CLI options
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx @caius_kong/ccusage-dashboard --port 9000 # change port
|
|
44
|
+
npx @caius_kong/ccusage-dashboard --budget 500 # monthly budget cap (default $300)
|
|
45
|
+
npx @caius_kong/ccusage-dashboard --no-warm # skip 3s startup warm-up
|
|
46
|
+
CCUSAGE_UI_NO_OPEN=1 npx @caius_kong/ccusage-dashboard # don't auto-open browser
|
|
47
|
+
```
|
|
25
48
|
|
|
26
|
-
##
|
|
49
|
+
## What it shows
|
|
27
50
|
|
|
28
|
-
|
|
|
51
|
+
| | |
|
|
29
52
|
|---|---|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
| **Today / This Week / This Month / Custom Range** | totals + tokens + cache breakdown |
|
|
54
|
+
| **By model** | per-model cost, % of total, in/out/cache-read/cache-write tokens |
|
|
55
|
+
| **30-day trend** | daily cost bar chart (hover for values, weekends marked) |
|
|
56
|
+
| **Budget alert** | monthly cap (default $300) — green <80%, yellow <100%, red ≥100% |
|
|
57
|
+
|
|
58
|
+
All costs in USD. Auto-refresh: today every 15s, others every 60s.
|
|
59
|
+
|
|
60
|
+
## How it works
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Browser (index.html)
|
|
64
|
+
│ fetch /api/... (auto-refresh)
|
|
65
|
+
▼
|
|
66
|
+
server.py (Python stdlib, zero deps)
|
|
67
|
+
│ spawns: ccusage daily/monthly/weekly ... --json --offline
|
|
68
|
+
▼
|
|
69
|
+
ccusage (bundled dependency — the real cost engine)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `lib/server.py` — Python stdlib HTTP server. Resolves a local ccusage
|
|
73
|
+
(bundled dep → PATH → npx cache), warms caches on boot (~3s), then serves instant responses.
|
|
74
|
+
- `lib/index.html` — single-file dashboard. No build step, no CDN.
|
|
75
|
+
- `bin/ccusage-ui.js` — Node launcher (finds python3, starts server, opens browser).
|
|
76
|
+
|
|
77
|
+
## Local development
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python3 lib/server.py --budget 300 # run server directly from the repo
|
|
81
|
+
# or
|
|
82
|
+
node bin/ccusage-ui.js # same as the npx experience
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT © Caius Kong
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caius_kong/ccusage-dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "One-command local dashboard for ccusage: today/week/month/custom cost by model, 30-day trend, monthly budget alert. Numbers straight from ccusage.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -38,4 +38,4 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|