ccgauge 1.1.0 → 1.1.2
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +42 -42
- package/.next/standalone/.next/app-path-routes-manifest.json +6 -6
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/blocks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/scan/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/models/page.js +1 -1
- package/.next/standalone/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page.js +2 -2
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/usage/page.js +1 -1
- package/.next/standalone/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +6 -6
- package/.next/standalone/.next/server/chunks/125.js +1 -1
- package/.next/standalone/.next/server/chunks/567.js +3 -3
- package/.next/standalone/.next/server/chunks/716.js +1 -1
- package/.next/standalone/.next/server/chunks/98.js +1 -1
- package/.next/standalone/.next/server/functions-config-manifest.json +1 -1
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/148-edf90b0918345dc2.js +1 -0
- package/.next/standalone/.next/static/chunks/app/layout-af71188a257674b5.js +1 -0
- package/.next/standalone/.next/static/chunks/app/page-1a147d12fca0b184.js +1 -0
- package/.next/standalone/.next/static/chunks/app/usage/{page-7fcc2a2d931307d5.js → page-051223f62647aadc.js} +1 -1
- package/.next/standalone/.next/static/css/fabb40b2545c70dd.css +5 -0
- package/.next/standalone/package.json +8 -2
- package/.next/standalone/public/codex-logo.webp +0 -0
- package/CHANGELOG.md +160 -0
- package/README.md +136 -384
- package/README.zh-CN.md +146 -398
- package/bin/cli.mjs +30 -190
- package/dist/mcp/server.mjs +11 -11
- package/dist/report/index.mjs +36 -3127
- package/package.json +8 -2
- package/.next/standalone/.next/static/chunks/148-f2cba0b76260b8d3.js +0 -1
- package/.next/standalone/.next/static/chunks/app/layout-0adb4fc0305adf29.js +0 -1
- package/.next/standalone/.next/static/chunks/app/page-3cda7f70ecf5017a.js +0 -1
- package/.next/standalone/.next/static/css/bde47638beb0c717.css +0 -3
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/constants.js +0 -10
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/fontkit/index.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/format-available-values.js +0 -9
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js +0 -28
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-font-file.js +0 -24
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-resource.js +0 -46
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/find-font-files-in-css.js +0 -34
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/font-data.json +0 -17669
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-fallback-font-override-metrics.js +0 -62
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-font-axes.js +0 -66
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-google-fonts-url.js +0 -55
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-proxy-agent.js +0 -23
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/google-fonts-metadata.js +0 -8
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/loader.js +0 -175
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/retry.js +0 -18
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/sort-fonts-variant-values.js +0 -26
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/validate-google-font-function-call.js +0 -101
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/get-fallback-metrics-from-font-file.js +0 -85
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/loader.js +0 -78
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/pick-font-file-for-fallback-generation.js +0 -85
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js +0 -66
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/next-font-error.js +0 -11
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/google/loader.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/local/loader.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/index.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/validator_wasm.js +0 -2672
- package/.next/standalone/node_modules/next/dist/compiled/babel/bundle.js +0 -227
- package/.next/standalone/node_modules/next/dist/compiled/babel/code-frame.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-block-hoist-plugin.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-config.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-normalize-file.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-normalize-opts.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-plugin-pass.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/generator.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/parser.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-syntax-jsx.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-transform-define.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-transform-modules-commonjs.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/preset-typescript.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/traverse.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/types.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel-packages/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel-packages/packages-bundle.js +0 -335
- package/.next/standalone/node_modules/next/dist/server/capsize-font-metrics.json +0 -181516
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/LICENSE +0 -191
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/package.json +0 -40
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/lib/index.js +0 -1
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib +0 -0
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/package.json +0 -36
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +0 -30
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/channel.js +0 -177
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/colour.js +0 -195
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/composite.js +0 -212
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/constructor.js +0 -499
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/index.js +0 -16
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/input.js +0 -809
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/is.js +0 -143
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/libvips.js +0 -207
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/operation.js +0 -1016
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/output.js +0 -1666
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/resize.js +0 -595
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/sharp.js +0 -121
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/utility.js +0 -291
- package/.next/standalone/node_modules/next/node_modules/sharp/package.json +0 -202
- package/.next/standalone/public/codex-logo.png +0 -0
- /package/.next/standalone/.next/static/{jncTEohJB76Iq9TUm3G21 → EQqRlXV5HyaCYSZWOVllH}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{jncTEohJB76Iq9TUm3G21 → EQqRlXV5HyaCYSZWOVllH}/_ssgManifest.js +0 -0
package/README.md
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# ccgauge
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Tokens, cost, and cache-savings dashboard for Claude Code + Codex CLI.**
|
|
6
|
+
One command. Zero install. Everything stays on your laptop.
|
|
6
7
|
|
|
7
|
-
[](https://www.npmjs.com/package/ccgauge)
|
|
8
9
|
[](https://github.com/chengzuopeng/ccgauge/blob/main/LICENSE)
|
|
9
10
|
[](#)
|
|
10
11
|
|
|
12
|
+
**🌐 [chengzuopeng.github.io/ccgauge](https://chengzuopeng.github.io/ccgauge)**
|
|
13
|
+
|
|
11
14
|
[English](https://github.com/chengzuopeng/ccgauge/blob/main/README.md) · [简体中文](https://github.com/chengzuopeng/ccgauge/blob/main/README.zh-CN.md)
|
|
12
15
|
|
|
13
16
|
</div>
|
|
@@ -16,240 +19,144 @@
|
|
|
16
19
|
npx ccgauge
|
|
17
20
|
```
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
ccgauge reads the JSONL session files Claude Code and Codex CLI already store on your disk, computes day / project / model / session breakdowns plus **dollar-equivalent cost**, and opens a unified browser dashboard. Switch providers with one click. Ask your LLM about your usage via the built-in MCP server. Or skip the browser entirely and run `ccgauge report -d` for a rich terminal dashboard.
|
|
23
|
+
|
|
24
|
+
**No login. No telemetry. No outbound network calls.**
|
|
20
25
|
|
|
21
26
|

|
|
22
27
|
|
|
23
28
|
---
|
|
24
29
|
|
|
25
|
-
## Why ccgauge
|
|
30
|
+
## Why ccgauge stands out
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
- 🪟 **Two CLIs, one dashboard.** Claude Code and Codex CLI side by side — switch sources from the nav bar, or merge them in the All view. No other dashboard covers both.
|
|
33
|
+
- 💰 **Cache savings as a first-class KPI.** See exactly how many dollars Anthropic prompt caching saved you this week. Not a footnote — a card on the overview.
|
|
34
|
+
- ⏱️ **Live 5-hour block.** Countdown, progress bar, projected total cost — know when the rate-limit window rolls over *before* you hit it.
|
|
35
|
+
- 🤖 **MCP-native.** Plug into Claude Desktop / Cursor / Cline and ask *"What did I work on yesterday, by project?"* in plain English. Real numbers, no screenshots, no copy-paste.
|
|
36
|
+
- 🔒 **100% local & private.** Reads JSONL files you already have. Zero outbound calls. MIT licensed. Your transcripts never leave the machine.
|
|
37
|
+
- 🪜 **Worktree-aware projects.** All worktrees of the same repo collapse into one project row — the way you actually think about your work.
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
- *"Is prompt caching actually saving me money — and how much?"*
|
|
31
|
-
- *"Which project / session / model is eating the most tokens?"*
|
|
32
|
-
- *"How close am I to the 5-hour rate-limit window resetting?"*
|
|
39
|
+
## What's new in v1.1.0
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
- **`ccgauge report --dashboard` / `-d`** — rich one-screen TUI: KPI tiles, stacked-bar trend chart, breakdown tables, day×hour heatmap. Perfect for SSH / tmux / a quick check without leaving the terminal. Falls back to plain text below 80 columns.
|
|
42
|
+
- **Custom date range** on `/usage` — proper calendar picker (react-day-picker), brand-themed, follows your language toggle. `?range=custom&from=...&to=...` URL contract.
|
|
43
|
+
- **Marketing site at root URLs** — English at `/cli/` / `/features/` / `/mcp/`, Chinese under `/zh/...`. Old `/en/*` paths still resolve via static redirects.
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
See [CHANGELOG.md](https://github.com/chengzuopeng/ccgauge/blob/main/CHANGELOG.md) for the full release notes.
|
|
37
46
|
|
|
38
|
-
##
|
|
47
|
+
## Features
|
|
39
48
|
|
|
40
|
-
###
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- **
|
|
44
|
-
-
|
|
49
|
+
### Dashboard (browser)
|
|
50
|
+
- **Overview** — 6 KPI cards (tokens today / cost / cache hit / top model / active sessions / live 5h block) with day-over-day delta on each.
|
|
51
|
+
- **Usage** — turn-grouped table with expandable tool calls, CSV export, **Tokens / Conversations** chart toggle. Filters: range (incl. **custom date**), granularity, model + project multi-select.
|
|
52
|
+
- **Sessions** — per-conversation list with model / tokens / cost / duration; click in for the message-level timeline.
|
|
53
|
+
- **Projects** — per-`cwd` aggregation with sparkline and spend share; worktrees auto-collapsed.
|
|
54
|
+
- **Models** — side-by-side cost share, token share, cache hit, official per-1M pricing.
|
|
55
|
+
- **Light / Dark / System** themes (no flash), **EN / 中文**, cookie + localStorage synced.
|
|
45
56
|
|
|
46
|
-
###
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
57
|
+
### CLI report (terminal)
|
|
58
|
+
- `ccgauge report` — colored, aligned text report in ~0.2s, ideal for CI.
|
|
59
|
+
- `ccgauge report -d` — rich TUI: KPI tiles, stacked vertical-bar trend, double-column breakdown tables, 7×24 activity heatmap.
|
|
60
|
+
- Filters: `--range / --source / --by / --since / --until / --model / --project`.
|
|
61
|
+
- `--json` for scripts; `--no-color` auto-detected when piped.
|
|
50
62
|
|
|
51
|
-
###
|
|
52
|
-
-
|
|
53
|
-
- **
|
|
54
|
-
-
|
|
55
|
-
-
|
|
63
|
+
### MCP server (LLM access)
|
|
64
|
+
- `ccgauge mcp` — stdio JSON-RPC server. Plug into Claude Desktop / Cursor / Cline / your own agent.
|
|
65
|
+
- **9 tools** for usage summary, time-series, per-model / project / session breakdowns, daily / weekly summaries, recent activity, hypothetical cost estimator.
|
|
66
|
+
- Reasoning-token breakdown for models that emit one.
|
|
67
|
+
- Separate cache (`index-mcp-v2.json`) so MCP and the dashboard never fight.
|
|
56
68
|
|
|
57
69
|
### Cost transparency
|
|
58
|
-
- **Cache savings**
|
|
59
|
-
- Codex cost shown as
|
|
60
|
-
- Built-in pricing
|
|
61
|
-
|
|
62
|
-
### Polished local UI
|
|
63
|
-
- **Light / Dark / System** themes, no flash of incorrect theme
|
|
64
|
-
- **English / 中文** (cookie + localStorage)
|
|
65
|
-
- Filters: time range (today / 7d / 30d / 90d / all), granularity (hour / day / week / month), model and project multi-select
|
|
66
|
-
|
|
67
|
-
### CLI report (no server)
|
|
68
|
-
- `ccgauge report` prints a colored, aligned terminal usage report in ~0.2 s from the same JSONL the dashboard reads
|
|
69
|
-
- `--range / --source / --by / --since / --until / --model / --project` filters
|
|
70
|
-
- `--json` for machine-readable output; `--no-color` auto-applied when piped — drops cleanly into shell scripts and CI
|
|
71
|
-
|
|
72
|
-
### MCP server (for LLMs)
|
|
73
|
-
- `ccgauge mcp` runs a stdio JSON-RPC server so **Claude Desktop / Cursor / Cline** can query your local usage directly
|
|
74
|
-
- Nine MCP tools: `usage_summary`, `usage_by_time`, `usage_by_model`, `usage_by_project`, `usage_by_session`, `daily_summary`, `weekly_summary`, `recent_activity`, `cost_estimator`
|
|
75
|
-
- Reasoning-token breakdown surfaced for the models that emit one
|
|
76
|
-
- Separate named cache (`index-mcp-v2.json`) so MCP runs don't contend with the dashboard
|
|
70
|
+
- **Cache savings** quantified as a dollar figure on the overview.
|
|
71
|
+
- Codex cost shown as **OpenAI API equivalent** so subscription users can compare value against pay-as-you-go.
|
|
72
|
+
- Built-in pricing: 12 Claude models + gpt-5 family + o-series; unknown models fall back to family-latest.
|
|
77
73
|
|
|
78
74
|
### Privacy by design
|
|
79
|
-
- 100
|
|
80
|
-
- Open source, MIT
|
|
81
|
-
- Background mode for
|
|
75
|
+
- 100% local: read-only access to JSONL files, zero outbound calls.
|
|
76
|
+
- Open source, MIT licensed.
|
|
77
|
+
- Background mode for an always-on service with `start / stop / restart / status / open / logs` lifecycle commands.
|
|
82
78
|
|
|
83
79
|
## Quick start
|
|
84
80
|
|
|
85
|
-
Zero-install one-shot:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npx ccgauge
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Or install globally:
|
|
92
|
-
|
|
93
81
|
```bash
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
yarn global add ccgauge && ccgauge # yarn
|
|
82
|
+
npx ccgauge # zero-install one-shot
|
|
83
|
+
npm i -g ccgauge && ccgauge # or install globally
|
|
97
84
|
```
|
|
98
85
|
|
|
99
|
-
|
|
86
|
+
Dashboard opens at [http://localhost:3737](http://localhost:3737). If the port is busy, ccgauge picks the next free one. `Ctrl+C` to stop.
|
|
100
87
|
|
|
101
|
-
**Requirements:** Node.js 20
|
|
88
|
+
**Requirements:** Node.js 20+. macOS / Linux / Windows.
|
|
102
89
|
|
|
103
|
-
## CLI
|
|
104
|
-
|
|
105
|
-
`ccgauge` is shorthand for `ccgauge start`, so flags work after either command.
|
|
106
|
-
|
|
107
|
-
### Foreground (default)
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
ccgauge
|
|
111
|
-
ccgauge --port 4000 --no-open
|
|
112
|
-
ccgauge start --host 0.0.0.0 --port 4000
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Background service
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
ccgauge start --background
|
|
119
|
-
|
|
120
|
-
ccgauge status
|
|
121
|
-
ccgauge open
|
|
122
|
-
ccgauge logs # last 80 lines
|
|
123
|
-
ccgauge logs --follow # tail in real time
|
|
124
|
-
ccgauge restart --port 4000
|
|
125
|
-
ccgauge stop
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Background mode persists state under `~/.ccgauge/`:
|
|
129
|
-
- `state.json` — PID, URL, start time, log file path
|
|
130
|
-
- `ccgauge.log` — server output (read by `ccgauge logs`)
|
|
131
|
-
- Override with `CCGAUGE_STATE_DIR=/path/to/dir` for isolated profiles or tests
|
|
90
|
+
## CLI
|
|
132
91
|
|
|
133
92
|
### Commands
|
|
134
93
|
|
|
135
94
|
| Command | Purpose |
|
|
136
95
|
| --- | --- |
|
|
137
|
-
| `ccgauge`, `ccgauge start` | Start in foreground.
|
|
96
|
+
| `ccgauge`, `ccgauge start` | Start dashboard server in foreground. |
|
|
138
97
|
| `ccgauge start --background` | Start a detached background service. |
|
|
139
98
|
| `ccgauge stop [--force]` | Stop the background service. |
|
|
140
99
|
| `ccgauge restart [options]` | Stop and re-start with new options. |
|
|
141
|
-
| `ccgauge status [--json]` | Inspect
|
|
100
|
+
| `ccgauge status [--json]` | Inspect background service. Exits **3** (systemd-style "not running") when nothing is up. |
|
|
142
101
|
| `ccgauge open` | Open the running dashboard in your browser. |
|
|
143
|
-
| `ccgauge logs [-f] [-n
|
|
144
|
-
| `ccgauge report [options]` |
|
|
145
|
-
| `ccgauge mcp` | Start the MCP server on stdio
|
|
146
|
-
| `ccgauge doctor` | One-screen diagnostic
|
|
102
|
+
| `ccgauge logs [-f] [-n N]` | Tail the background-service log. |
|
|
103
|
+
| `ccgauge report [options]` | One-shot text or TUI report (no server). |
|
|
104
|
+
| `ccgauge mcp` | Start the MCP server on stdio for LLM access. |
|
|
105
|
+
| `ccgauge doctor` | One-screen diagnostic — paste into bug reports. |
|
|
106
|
+
|
|
107
|
+
### Startup options
|
|
147
108
|
|
|
148
|
-
|
|
109
|
+
| Option | Default | Purpose |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| `-p, --port <port>` | `3737` | Preferred port. Falls back if busy unless `--strict-port`. |
|
|
112
|
+
| `-H, --host <host>` | `127.0.0.1` | Bind host. |
|
|
113
|
+
| `--no-open` | — | Skip auto-open in foreground. |
|
|
114
|
+
| `-b, --background` | — | Run as detached background service. |
|
|
115
|
+
| `-q, --quiet` | — | Silence Next.js output. |
|
|
116
|
+
| `--dir <path>` | — | Add `<path>/projects` as an extra Claude source. |
|
|
117
|
+
| `--strict-port` | — | Fail if the preferred port is busy. |
|
|
149
118
|
|
|
150
|
-
|
|
151
|
-
and prints a colored, aligned report:
|
|
119
|
+
### Background mode
|
|
152
120
|
|
|
153
121
|
```bash
|
|
154
|
-
ccgauge
|
|
155
|
-
ccgauge
|
|
156
|
-
ccgauge
|
|
157
|
-
ccgauge
|
|
158
|
-
ccgauge report --since 2026-05-01 --until 2026-05-08
|
|
122
|
+
ccgauge start -b # detached service, state in ~/.ccgauge/
|
|
123
|
+
ccgauge status # PID / URL / uptime
|
|
124
|
+
ccgauge logs --follow # tail the service log
|
|
125
|
+
ccgauge stop # graceful stop (or --force)
|
|
159
126
|
```
|
|
160
127
|
|
|
161
|
-
|
|
128
|
+
`~/.ccgauge/` holds `state.json` (PID, URL, start time, log path) and `ccgauge.log`. Override with `CCGAUGE_STATE_DIR=/tmp/profile` for isolated profiles.
|
|
129
|
+
|
|
130
|
+
### `ccgauge report`
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
ccgauge report # last 7d, all sources, text
|
|
134
|
+
ccgauge report -d # rich TUI dashboard
|
|
135
|
+
ccgauge report -r 30d -b project # 30 days, broken down by project
|
|
136
|
+
ccgauge report -s codex -m gpt-5 # only Codex, only gpt-5 models
|
|
137
|
+
ccgauge report --json # machine-readable
|
|
138
|
+
```
|
|
162
139
|
|
|
163
140
|
| Option | Default | Purpose |
|
|
164
141
|
| --- | --- | --- |
|
|
165
142
|
| `-r, --range <range>` | `7d` | `today` / `1d` / `7d` / `30d` / `90d` / `all` |
|
|
166
143
|
| `-s, --source <provider>` | `all` | `claude` / `codex` / `all` |
|
|
167
|
-
| `-b, --by <dim>` | `model` | Breakdown
|
|
168
|
-
| `-g, --gran <
|
|
144
|
+
| `-b, --by <dim>` | `model` | Breakdown: `model` / `project` / `session` |
|
|
145
|
+
| `-g, --gran <gran>` | `day` | Trend bucket: `hour` / `day` / `week` / `month` |
|
|
169
146
|
| `-n, --limit <n>` | `10` | Rows in the breakdown table |
|
|
170
|
-
| `--since
|
|
171
|
-
| `--until <date>` | — | Override range end |
|
|
147
|
+
| `--since` / `--until` | — | ISO date range override (`YYYY-MM-DD`, local day-aligned) |
|
|
172
148
|
| `-m, --model <pat>` | — | Filter records whose model contains `<pat>` |
|
|
173
149
|
| `--project <pat>` | — | Filter by project basename / cwd substring |
|
|
174
|
-
| `-
|
|
175
|
-
| `--
|
|
176
|
-
| `--no-
|
|
177
|
-
|
|
|
150
|
+
| `-d, --dashboard` | — | Rich one-screen TUI layout (KPI tiles + stacked trend + breakdown + heatmap) |
|
|
151
|
+
| `--width <n>` | tty cols | Force output width — useful for screenshots / CI |
|
|
152
|
+
| `--no-banner / --compact` | — | Dashboard trimmings (skip banner / skip trend chart) |
|
|
153
|
+
| `-j, --json` | — | JSON output |
|
|
154
|
+
| `--no-color` | auto | Disable ANSI colors (auto when piped) |
|
|
155
|
+
| `--no-trend / --no-breakdown` | — | Skip sections (text mode only) |
|
|
178
156
|
|
|
179
|
-
|
|
180
|
-
`--until 2026-05-08` includes all of May 8.
|
|
157
|
+
## MCP — let an LLM query your usage
|
|
181
158
|
|
|
182
|
-
|
|
183
|
-
> the background server's stdout log file.
|
|
184
|
-
|
|
185
|
-
### Startup options
|
|
186
|
-
|
|
187
|
-
| Option | Applies to | Purpose |
|
|
188
|
-
| --- | --- | --- |
|
|
189
|
-
| `-p, --port <port>` | start, restart, root | Preferred port. Default: `3737`. |
|
|
190
|
-
| `-H, --host <host>` | start, restart, root | Bind host. Default: `127.0.0.1`. |
|
|
191
|
-
| `--no-open` | start, root | Skip auto-open in foreground mode. (Background mode never auto-opens; use `ccgauge open` instead.) |
|
|
192
|
-
| `--dir <path>` | start, restart, root | Add `<path>/projects` as a Claude data source. |
|
|
193
|
-
| `-q, --quiet` | start, restart, root | Silence Next.js output. |
|
|
194
|
-
| `-b, --background` | start, root | Run as a detached background service. |
|
|
195
|
-
| `--strict-port` | start, restart, root | Fail if the preferred port is busy. |
|
|
196
|
-
| `--log <path>` | start --background, restart | Background log file path. |
|
|
197
|
-
|
|
198
|
-
## MCP server (let an LLM query your usage)
|
|
199
|
-
|
|
200
|
-
ccgauge ships an [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
201
|
-
server so any MCP-aware client (Claude Desktop, Cursor, Cline, Codex CLI,
|
|
202
|
-
your own agent…) can talk to your local Claude Code + Codex CLI history
|
|
203
|
-
through structured tools — no copy-paste, no screenshots of the dashboard.
|
|
204
|
-
|
|
205
|
-
### What you can ask
|
|
206
|
-
|
|
207
|
-
Once configured, you can ask things like:
|
|
208
|
-
|
|
209
|
-
- *"How much did I spend on AI coding this week? Break it down by Claude vs Codex."*
|
|
210
|
-
- *"What did I work on yesterday?"*
|
|
211
|
-
- *"Show me my 10 most expensive sessions this month."*
|
|
212
|
-
- *"Which project ate the most tokens in the last 30 days?"*
|
|
213
|
-
- *"Was prompt caching saving me money? How much?"*
|
|
214
|
-
- *"Estimate the cost of 100K input + 20K output on Opus 4.7."*
|
|
215
|
-
- *"How big was my Codex reasoning overhead last week?"*
|
|
216
|
-
- *"Give me a weekly stand-up bullet list of what I shipped."*
|
|
217
|
-
|
|
218
|
-
The LLM picks the right tool, calls it locally, and answers in plain
|
|
219
|
-
English with real numbers from your machine.
|
|
220
|
-
|
|
221
|
-
### Capabilities at a glance
|
|
222
|
-
|
|
223
|
-
| Tool | What it answers |
|
|
224
|
-
| --- | --- |
|
|
225
|
-
| `usage_summary` | Total tokens / cost / cache savings for a date range. Always returns combined totals + per-source breakdown. |
|
|
226
|
-
| `usage_by_time` | Time-series buckets (hour / day / week / month) for trend questions. |
|
|
227
|
-
| `usage_by_model` | Per-model cost share. Each entry tagged with its `source`. |
|
|
228
|
-
| `usage_by_project` | Per-project (cwd) cost share + session counts + last-activity. |
|
|
229
|
-
| `usage_by_session` | Session list with title (= first user message), models, duration, cost. Sort by recent / cost / tokens / duration. |
|
|
230
|
-
| `daily_summary` | "What did I do today / yesterday / Monday / on YYYY-MM-DD?" Sessions grouped by project + models + top tool calls. |
|
|
231
|
-
| `weekly_summary` | 7-day roll-up: per-day cost trend, top sessions, top projects, models. `week_offset=-1` for last week. |
|
|
232
|
-
| `recent_activity` | The N most recently active sessions across providers. |
|
|
233
|
-
| `cost_estimator` | Compute the USD cost of a hypothetical request (`{ source, model, input_tokens, output_tokens, cache_* }`). Uses built-in per-1M-token pricing; does NOT consult usage history. |
|
|
234
|
-
|
|
235
|
-
| Resource URI | Content |
|
|
236
|
-
| --- | --- |
|
|
237
|
-
| `ccgauge://providers` | Detected providers, data dirs, file/record counts, indexer status. |
|
|
238
|
-
|
|
239
|
-
**Common arguments** (every analytical tool accepts these):
|
|
240
|
-
|
|
241
|
-
- `source`: `"claude"` | `"codex"` | `"all"` (default `"all"`). When `"all"`, the response carries combined totals **and** a `bySource: { claude, codex }` breakdown so the LLM can answer either combined or provider-specific questions in a single call.
|
|
242
|
-
- Date range: pass `range` (one of `today`, `yesterday`, `this_week`, `last_week`, `this_month`, `last_month`, `7d`, `30d`, `90d`, `all`) **or** explicit `from` / `to` (ISO date or full timestamp).
|
|
243
|
-
|
|
244
|
-
### Configure your MCP client
|
|
245
|
-
|
|
246
|
-
The exact config-file location depends on your client; the snippet shape
|
|
247
|
-
is the same.
|
|
248
|
-
|
|
249
|
-
#### Claude Desktop
|
|
250
|
-
|
|
251
|
-
`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) /
|
|
252
|
-
`%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
159
|
+
Configure once, then ask in plain English. Snippet shape is the same across clients (Claude Desktop / Cursor / Cline / Continue):
|
|
253
160
|
|
|
254
161
|
```json
|
|
255
162
|
{
|
|
@@ -262,262 +169,107 @@ is the same.
|
|
|
262
169
|
}
|
|
263
170
|
```
|
|
264
171
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
```json
|
|
268
|
-
{
|
|
269
|
-
"mcpServers": {
|
|
270
|
-
"ccgauge": {
|
|
271
|
-
"command": "ccgauge",
|
|
272
|
-
"args": ["mcp"]
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
```
|
|
172
|
+
Restart your client. Try: *"What ccgauge tools do you have? Run usage_summary for last 7 days."*
|
|
277
173
|
|
|
278
|
-
|
|
174
|
+
If you've installed ccgauge globally, drop the `npx` and use `"command": "ccgauge"`. To override scan paths, pass `CLAUDE_CONFIG_DIR` / `CCGAUGE_CODEX_DIR` via the `env` field.
|
|
279
175
|
|
|
280
|
-
|
|
176
|
+
### Tools
|
|
281
177
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
#### Cline / Continue / generic MCP clients
|
|
296
|
-
|
|
297
|
-
Anything that follows the standard `{ command, args, env? }` shape works.
|
|
298
|
-
Use either `npx -y ccgauge mcp` (no global install) or `ccgauge mcp`
|
|
299
|
-
(with global install). To override scan paths, pass them via `env`:
|
|
300
|
-
|
|
301
|
-
```json
|
|
302
|
-
{
|
|
303
|
-
"mcpServers": {
|
|
304
|
-
"ccgauge": {
|
|
305
|
-
"command": "ccgauge",
|
|
306
|
-
"args": ["mcp"],
|
|
307
|
-
"env": {
|
|
308
|
-
"CCGAUGE_CODEX_DIR": "/custom/codex/path",
|
|
309
|
-
"CLAUDE_CONFIG_DIR": "/custom/claude/path",
|
|
310
|
-
"CCGAUGE_STATE_DIR": "/custom/cache/path"
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
#### Verify it's working
|
|
318
|
-
|
|
319
|
-
In Claude Desktop, open a new chat and ask:
|
|
320
|
-
|
|
321
|
-
> *"What ccgauge tools do you have? Run usage_summary for the last 7 days."*
|
|
322
|
-
|
|
323
|
-
You should see Claude pick `usage_summary`, return a JSON payload with
|
|
324
|
-
`totals` + `bySource`, then summarise it in prose with real numbers.
|
|
325
|
-
|
|
326
|
-
### Prompt cookbook
|
|
178
|
+
| Tool | What it answers |
|
|
179
|
+
| --- | --- |
|
|
180
|
+
| `usage_summary` | Total tokens / cost / cache savings for a date range. Always returns combined totals + per-source breakdown. |
|
|
181
|
+
| `usage_by_time` | Time-series buckets (hour / day / week / month) for trend questions. |
|
|
182
|
+
| `usage_by_model` | Per-model cost share. Each entry tagged with its `source`. |
|
|
183
|
+
| `usage_by_project` | Per-project (`cwd`) cost share + session counts + last activity. |
|
|
184
|
+
| `usage_by_session` | Session list sorted by recent / cost / tokens / duration. |
|
|
185
|
+
| `daily_summary` | *"What did I do today / yesterday / on YYYY-MM-DD?"* — sessions grouped by project + top tool calls. |
|
|
186
|
+
| `weekly_summary` | 7-day roll-up: daily cost trend, top sessions / projects, models. `week_offset=-1` for last week. |
|
|
187
|
+
| `recent_activity` | N most recently active sessions across providers. |
|
|
188
|
+
| `cost_estimator` | USD cost of a hypothetical request. Uses built-in pricing tables; does NOT consult history. |
|
|
327
189
|
|
|
328
|
-
|
|
329
|
-
to each one are the tool(s) the LLM will pick — useful if you want to
|
|
330
|
-
debug "why did it answer X".
|
|
190
|
+
Every analytical tool accepts `source` (`claude` / `codex` / `all`) and either `range` (`today` / `7d` / `30d` / `this_week` / `last_week` / `this_month` / `last_month` / `all`) or explicit `from` / `to`. The `all` view always returns combined totals + a `bySource: { claude, codex }` breakdown — one call, two answers.
|
|
331
191
|
|
|
332
|
-
|
|
192
|
+
### Prompt examples
|
|
333
193
|
|
|
334
|
-
- *"How much did I spend on AI coding this week, broken down by Claude
|
|
335
|
-
→ `usage_summary({ range: "7d" })`
|
|
336
|
-
- *"What's my AI coding cost this month? How does that compare to last month?"*
|
|
337
|
-
→ `usage_summary({ range: "this_month" })` + `usage_summary({ range: "last_month" })`
|
|
194
|
+
- *"How much did I spend on AI coding this week, broken down by Claude vs Codex?"*
|
|
338
195
|
- *"Show me a daily cost trend for the last 30 days."*
|
|
339
|
-
→ `usage_by_time({ range: "30d", granularity: "day" })`
|
|
340
|
-
- *"Which Claude model did I use the most this month, and how much did it cost?"*
|
|
341
|
-
→ `usage_by_model({ range: "this_month", source: "claude" })`
|
|
342
196
|
- *"Top 5 most expensive sessions this month?"*
|
|
343
|
-
→ `usage_by_session({ range: "this_month", sort: "cost", limit: 5 })`
|
|
344
|
-
|
|
345
|
-
#### Work content / standup
|
|
346
|
-
|
|
347
197
|
- *"What did I work on yesterday? Group by project."*
|
|
348
|
-
|
|
349
|
-
- *"
|
|
350
|
-
→ `weekly_summary({ week_offset: -1 })`
|
|
351
|
-
- *"Which 3 projects have I touched most in the last two weeks?"*
|
|
352
|
-
→ `usage_by_project({ from: "2026-05-01", to: "2026-05-15", limit: 3 })` — pass explicit `from`/`to` for any window not covered by the named ranges (`7d` / `30d` / `90d` / `this_week` / `last_week` / …).
|
|
353
|
-
- *"What was my last coding session about?"*
|
|
354
|
-
→ `recent_activity({ limit: 1 })`
|
|
355
|
-
|
|
356
|
-
#### Caching / efficiency
|
|
357
|
-
|
|
358
|
-
- *"How many tokens did Anthropic prompt caching save me this month?"*
|
|
359
|
-
→ `usage_summary({ range: "this_month", source: "claude" })` — the response includes `saved_usd`.
|
|
360
|
-
- *"What percentage of my Codex output is reasoning tokens this week?"*
|
|
361
|
-
→ `usage_summary({ range: "7d", source: "codex" })` — response carries `reasoning_tokens` next to `output_tokens`.
|
|
362
|
-
|
|
363
|
-
#### Budget / planning
|
|
364
|
-
|
|
365
|
-
- *"At my current burn rate, how much will I spend this month?"*
|
|
366
|
-
→ `usage_summary({ range: "this_month" })` + `usage_by_time({ range: "this_month", granularity: "day" })` — LLM extrapolates.
|
|
367
|
-
- *"If I run another 200K input + 50K output on Opus 4.7 today, what does that add to my month-to-date cost?"*
|
|
368
|
-
→ `cost_estimator({ source: "claude", model: "claude-opus-4-7", input_tokens: 200000, output_tokens: 50000 })` + `usage_summary({ range: "this_month" })` — the estimator returns the dollar cost for the hypothetical request without touching your usage history.
|
|
369
|
-
|
|
370
|
-
#### Cross-source comparisons
|
|
371
|
-
|
|
372
|
-
- *"Am I getting more value out of Claude or Codex this month, by tokens-per-dollar?"*
|
|
373
|
-
→ `usage_summary({ range: "this_month" })` — both totals are in `bySource`.
|
|
374
|
-
- *"For each provider, which project ate the most tokens last week?"*
|
|
375
|
-
→ `usage_by_project({ range: "last_week" })` (each entry already carries `source`).
|
|
198
|
+
- *"Generate a Monday standup bullet list of what I shipped last week."*
|
|
199
|
+
- *"At my current burn rate, how much will I spend this month? If I run another 200K input + 50K output on Opus 4.7 today, what does that add?"*
|
|
376
200
|
|
|
377
|
-
### Privacy
|
|
201
|
+
### Privacy & troubleshooting
|
|
378
202
|
|
|
379
|
-
- **stdio only** in v1 — no network ports
|
|
380
|
-
- Reads only
|
|
381
|
-
- Absolute paths in error messages are scrubbed (`$HOME` → `~`)
|
|
382
|
-
- The MCP server uses a separate persisted cache (`~/.ccgauge/cache/index-mcp-v2.json`) so it never fights the dashboard for the same on-disk state file
|
|
383
|
-
|
|
384
|
-
### Troubleshooting
|
|
203
|
+
- **stdio only** in v1 — no network ports.
|
|
204
|
+
- Reads only existing JSONL files; absolute paths in error messages are scrubbed (`$HOME` → `~`).
|
|
385
205
|
|
|
386
206
|
| Symptom | Try |
|
|
387
207
|
| --- | --- |
|
|
388
|
-
| Client doesn't see
|
|
389
|
-
| First call is slow |
|
|
390
|
-
| "no providers detected"
|
|
391
|
-
| Want to see
|
|
208
|
+
| Client doesn't see tools | Restart client after editing config; run `ccgauge mcp --check` or `ccgauge doctor` |
|
|
209
|
+
| First call is slow | Cold start indexes all JSONL (~1–3s for 100 files); subsequent calls are O(1) |
|
|
210
|
+
| "no providers detected" | Pass `CLAUDE_CONFIG_DIR` / `CCGAUGE_CODEX_DIR` via `env` in MCP config |
|
|
211
|
+
| Want to see server logs | Watch client's MCP log — ccgauge writes to **stderr** (stdout is reserved for JSON-RPC) |
|
|
392
212
|
|
|
393
213
|
## Configuration
|
|
394
214
|
|
|
395
|
-
ccgauge auto-detects
|
|
215
|
+
ccgauge auto-detects standard locations:
|
|
396
216
|
|
|
397
217
|
| Provider | Default sources |
|
|
398
218
|
| --- | --- |
|
|
399
219
|
| Claude Code | `~/.claude/projects`, `~/.config/claude/projects` |
|
|
400
220
|
| OpenAI Codex CLI | `~/.codex/sessions`, `~/.codex/archived_sessions` |
|
|
401
221
|
|
|
402
|
-
Override
|
|
222
|
+
Override / extend via environment variables:
|
|
403
223
|
|
|
404
224
|
| Variable | Effect |
|
|
405
225
|
| --- | --- |
|
|
406
|
-
| `
|
|
407
|
-
| `
|
|
226
|
+
| `CLAUDE_CONFIG_DIR` | Add `<dir>/projects` as a Claude data source |
|
|
227
|
+
| `CCGAUGE_CONFIG_DIR` | Same as above (legacy ccgauge name) |
|
|
408
228
|
| `CCGAUGE_CODEX_DIR` | Add an extra Codex sessions directory |
|
|
409
229
|
| `CODEX_HOME` | Add `<dir>/sessions` and `<dir>/archived_sessions` |
|
|
410
|
-
| `CCGAUGE_STATE_DIR` | Override background service state/log directory |
|
|
411
|
-
|
|
412
|
-
## Architecture
|
|
413
|
-
|
|
414
|
-
```
|
|
415
|
-
~/.claude/projects/**/*.jsonl ──┐
|
|
416
|
-
├─► ProviderAdapter registry
|
|
417
|
-
~/.codex/sessions/**/*.jsonl ───┘ │
|
|
418
|
-
▼
|
|
419
|
-
scanAll() ─► dedup ─► aggregate by
|
|
420
|
-
time / model / project / session / 5h block
|
|
421
|
-
▼
|
|
422
|
-
Next.js RSC pages + client charts
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
1. **CLI** (`bin/cli.mjs`) normalizes flags, validates the standalone build, picks a port via [`get-port`](https://github.com/sindresorhus/get-port).
|
|
426
|
-
2. **Foreground** uses `fork()` and binds to your terminal; **background** uses detached `spawn()` with state in `~/.ccgauge/`.
|
|
427
|
-
3. **Provider adapters** (`lib/providers/<name>/index.ts`) own data dirs, JSONL parser, pricing table, and model-name formatter. The registry-driven design means adding a third provider is one file plus one registry line.
|
|
428
|
-
4. **Claude parser** reads each line as a typed event, extracts `usage` from assistant messages.
|
|
429
|
-
5. **Codex parser** uses a turn state machine, emits one record per `event_msg.token_count` from `last_token_usage` (avoids cumulative double-counting), folds `cached_input_tokens` into cache-read and `reasoning_output_tokens` into output.
|
|
430
|
-
6. **Pricing** ships built-in snapshots — Anthropic published rates for Claude (12 models) and OpenAI public rates for Codex (gpt-5 family + o-series). Codex cost is labelled "API equivalent" because subscription plans (Plus, Pro) bill differently.
|
|
431
|
-
7. **i18n + theme** is cookie-driven SSR with a no-flash inline script in `<head>` and `localStorage` mirror.
|
|
432
|
-
|
|
433
|
-
## Adding a provider
|
|
434
|
-
|
|
435
|
-
```
|
|
436
|
-
lib/providers/<name>/
|
|
437
|
-
index.ts ProviderAdapter implementation
|
|
438
|
-
parse-<name>.ts JSONL → AssistantRecord[]
|
|
439
|
-
pricing.ts model → Pricing
|
|
440
|
-
shorten-model.ts pretty model names
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
Register one line in `lib/providers/index.ts`, add the id to the `ProviderId` union, and you're done. `scan.ts`, the aggregator, the pricing module, and every page need no changes.
|
|
230
|
+
| `CCGAUGE_STATE_DIR` | Override background service state / log directory |
|
|
444
231
|
|
|
445
232
|
## Develop
|
|
446
233
|
|
|
447
|
-
This repo is a working Next.js project — run the dashboard against your live data while iterating.
|
|
448
|
-
|
|
449
234
|
```bash
|
|
450
235
|
git clone https://github.com/chengzuopeng/ccgauge.git
|
|
451
236
|
cd ccgauge
|
|
452
237
|
pnpm install
|
|
453
238
|
pnpm dev # http://localhost:3738
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
Scripts:
|
|
457
|
-
|
|
458
|
-
```bash
|
|
459
239
|
pnpm typecheck # tsc --noEmit
|
|
460
|
-
pnpm
|
|
461
|
-
pnpm
|
|
462
|
-
pnpm build # next build + copy static into .next/standalone
|
|
463
|
-
pnpm start # run bin/cli.mjs against the standalone build
|
|
464
|
-
pnpm screenshots # regenerate docs/screenshots/*.png
|
|
465
|
-
pnpm site:dev # marketing site dev server, http://localhost:4321
|
|
466
|
-
pnpm site:build # build only the site/ marketing site
|
|
467
|
-
pnpm clean # rm -rf .next node_modules
|
|
240
|
+
pnpm test # parser smoke tests (Node 22+)
|
|
241
|
+
pnpm build # next build + bundle MCP + bundle CLI report
|
|
468
242
|
```
|
|
469
243
|
|
|
470
|
-
|
|
244
|
+
The repo is a working Next.js project — hot-reload against your live data while iterating. Adding a third provider (Gemini CLI, Cursor, Aider, …) is one new directory in [`lib/providers/<name>/`](https://github.com/chengzuopeng/ccgauge/tree/main/lib/providers) plus one registry line — `scan.ts`, the aggregator, the pricing module, and every page need no changes.
|
|
471
245
|
|
|
472
|
-
|
|
473
|
-
pnpm pack # preview the tarball
|
|
474
|
-
pnpm publish --access public # runs `pnpm build` first via prepublishOnly
|
|
475
|
-
```
|
|
246
|
+
The marketing site lives in [`site/`](https://github.com/chengzuopeng/ccgauge/tree/main/site) (Astro + Tailwind) and ships separately from the npm package — run with `pnpm site:dev`.
|
|
476
247
|
|
|
477
248
|
## Troubleshooting
|
|
478
249
|
|
|
479
|
-
>
|
|
250
|
+
> First stop for any "why doesn't this work" question: **`ccgauge doctor`**. One screen, version + env + build artifacts + service state + per-provider scan. Paste into bug reports.
|
|
480
251
|
|
|
481
252
|
| Symptom | Try |
|
|
482
253
|
| --- | --- |
|
|
483
|
-
| Anything unexpected | `ccgauge doctor` — one-screen diagnostic for everything below |
|
|
484
254
|
| Port keeps drifting | `ccgauge --strict-port --port 3737` |
|
|
485
255
|
| Stale background service | `ccgauge status`, then `ccgauge stop --force` |
|
|
486
256
|
| Background didn't start | `ccgauge logs` reads `~/.ccgauge/ccgauge.log` |
|
|
487
|
-
| Need an isolated profile | `CCGAUGE_STATE_DIR=/tmp/ccgauge-test ccgauge start -b` |
|
|
488
257
|
| No data shown for Codex | Ensure `~/.codex/sessions` exists; check the **Settings** page for detected paths |
|
|
489
258
|
| Want to bypass auto-open | `ccgauge --no-open` |
|
|
490
259
|
|
|
491
260
|
## FAQ
|
|
492
261
|
|
|
493
|
-
**Does ccgauge upload
|
|
494
|
-
No.
|
|
262
|
+
**Does ccgauge upload anything?**
|
|
263
|
+
No. Runs entirely on your machine; reads JSONL files Claude Code and Codex CLI already store locally; zero outbound calls; no API credentials needed.
|
|
495
264
|
|
|
496
|
-
**How is this different from ccusage?**
|
|
497
|
-
|
|
265
|
+
**How is this different from [ccusage](https://github.com/ryoppippi/ccusage)?**
|
|
266
|
+
ccusage is a CLI that prints usage tables. ccgauge is a polished web dashboard with charts, per-session drill-down, a 5h rate-limit countdown, project / model breakdowns — and **also covers OpenAI Codex CLI** out of the box. Plus an MCP server so your LLM can answer questions about your usage in plain English, and an in-terminal TUI dashboard (`ccgauge report -d`) for when the browser isn't an option.
|
|
498
267
|
|
|
499
268
|
**Does it work for Claude Pro / Max / Team / Codex Plus subscribers?**
|
|
500
|
-
Yes. The dashboard always reports the **API-equivalent dollar value** of your usage
|
|
501
|
-
|
|
502
|
-
**Which models / providers are supported?**
|
|
503
|
-
- **Claude Code**: all `claude-*` models (Opus / Sonnet / Haiku, 3.x and 4.x)
|
|
504
|
-
- **OpenAI Codex CLI**: gpt-5 family (gpt-5, gpt-5-mini, gpt-5-nano, gpt-5.4, gpt-5.5, gpt-5.5-mini, gpt-5.5-nano), gpt-4.1 / gpt-4.1-mini, plus o-series (o3, o4-mini)
|
|
505
|
-
- Unknown models fall back to family-latest pricing automatically
|
|
506
|
-
|
|
507
|
-
**Can I add my own provider?**
|
|
508
|
-
Yes — see [Adding a provider](#adding-a-provider). The provider adapter layer is the explicit extension point.
|
|
509
|
-
|
|
510
|
-
**Does it require Anthropic or OpenAI credentials?**
|
|
511
|
-
No. ccgauge never calls upstream APIs. It reads the local JSONL transcripts those CLIs already write.
|
|
512
|
-
|
|
513
|
-
## Keywords
|
|
269
|
+
Yes. The dashboard always reports the **API-equivalent dollar value** of your usage — useful to gauge *"how much would this cost on PAYG?"*. Subscription plans bill differently; ccgauge is not your invoice.
|
|
514
270
|
|
|
515
|
-
|
|
516
|
-
`
|
|
517
|
-
`ai cli token tracker` · `ai coding assistant cost` · `claude pro plan usage monitor` ·
|
|
518
|
-
`claude max plan tracker` · `codex plus plan usage` · `prompt caching savings dashboard` ·
|
|
519
|
-
`5-hour block tracker` · `rate limit window monitor` · `ccusage alternative` · `ccusage web ui` ·
|
|
520
|
-
`token usage analytics` · `agentic coding stats` · `local ai usage monitor` · `self-hosted ai dashboard`
|
|
271
|
+
**Which models are supported?**
|
|
272
|
+
All `claude-*` (Opus / Sonnet / Haiku, 3.x and 4.x) and the gpt-5 family + gpt-4.1 family + o-series (o3, o4-mini). Unknown models fall back to family-latest pricing automatically.
|
|
521
273
|
|
|
522
274
|
## License
|
|
523
275
|
|