codex-token-tracker 0.1.0 → 0.2.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/CHANGELOG.md +58 -0
- package/README.md +40 -7
- package/dist/cli.js +709 -180
- package/dist/main.js +393 -81
- package/dist/preload.js +2 -0
- package/dist/renderer/renderer.js +131 -4
- package/dist/renderer/styles.css +30 -0
- package/package.json +17 -14
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `codex-token-tracker`. This project follows [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## 0.2.0 — 2026-09-01
|
|
6
|
+
|
|
7
|
+
Pricing accuracy, an honest tokens/s number, and self-update.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`codex-token-tracker` command.** Installing globally now puts **two** equivalent executables on your
|
|
12
|
+
PATH — `codex-token-tracker` (matching the package name) and the existing `codex-tracker` alias. Both
|
|
13
|
+
run the same CLI; nothing you already scripted breaks.
|
|
14
|
+
- **Self-update.** `codex-token-tracker update` checks the npm registry and installs the newest release
|
|
15
|
+
with the package manager this copy came from (npm / pnpm / yarn / bun). `--check` reports without
|
|
16
|
+
installing. The menu bar app shows an **Update** banner and a *Check for updates* item in the tray
|
|
17
|
+
menu; installing from there asks you to restart to apply.
|
|
18
|
+
- Checks are cached for 6 h in `~/.codex-tracker/update.json` and send no usage data or identifiers.
|
|
19
|
+
- Disable with `config set checkUpdates false`; point at a mirror with `CODEX_TRACKER_REGISTRY`.
|
|
20
|
+
- `codex-tracker status` prints a one-line notice when a newer version exists.
|
|
21
|
+
- **Long-context pricing tiers.** Models that OpenAI bills at a higher rate above 272K input tokens
|
|
22
|
+
(`gpt-5.4`, `gpt-5.5`, the `gpt-5.6-*` family and their `-pro` variants) are now priced per request at
|
|
23
|
+
the correct tier instead of always at the standard rate.
|
|
24
|
+
- New config key `checkUpdates` (default `true`).
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Pricing table rebuilt** from <https://developers.openai.com/api/docs/pricing>. Adds `gpt-5.6-sol`,
|
|
29
|
+
`gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.6-cyber`, `gpt-5.5`, `gpt-5.5-pro`, `gpt-5.5-cyber`, `gpt-5.4`,
|
|
30
|
+
`gpt-5.4-mini`, `gpt-5.4-nano`, `gpt-5.4-pro`, `gpt-5.3-codex`, `gpt-5-search-api` and `chat-latest`,
|
|
31
|
+
plus explicit `-codex` entries so Codex CLI model ids resolve exactly rather than through the family
|
|
32
|
+
fallback. Models in current use — `gpt-5.6-sol` above all — are now exact matches and lose the *est.*
|
|
33
|
+
badge. The catch-all fallback moved from `gpt-5.2` to `gpt-5.3-codex`.
|
|
34
|
+
- **Codex-only accounting.** Usage on non-OpenAI models is dropped from totals, cost, the model mix, the
|
|
35
|
+
heatmap and uploads. Sources such as Cline/Roo/Kilo and OpenCode can drive Anthropic, Google or local
|
|
36
|
+
models; costing those against an OpenAI price table produced meaningless dollars. The dashboard also
|
|
37
|
+
filters rows and sessions uploaded by older clients.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **Live tokens/s was wildly overstated** (6,000+ tok/s where the real rate is tens). Each request's
|
|
42
|
+
`input` counts the *entire prompt re-sent for that turn* — hundreds of thousands of context tokens —
|
|
43
|
+
so summing `total` over a 60 s window measured context replay, not generation. The rate is now
|
|
44
|
+
**output tokens only**, and the divisor is clamped to the part of the window the session has actually
|
|
45
|
+
existed for, so a session seconds old is not diluted by time that never happened. The 10 s burst
|
|
46
|
+
figure is computed the same way.
|
|
47
|
+
|
|
48
|
+
## 0.1.1 — 2026-08-31
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- Self-install the Electron runtime on first run when npm ≥ 11 / pnpm ≥ 10 skipped its install script.
|
|
53
|
+
|
|
54
|
+
## 0.1.0 — 2026-08-31
|
|
55
|
+
|
|
56
|
+
First public release: macOS menu bar app, Windows tray app, headless `agent` mode, Codex/pi/OpenCode/
|
|
57
|
+
Cline/Roo/Kilo/Hermes session readers, live rate limits, activity heatmap, device-code login and
|
|
58
|
+
dashboard sync.
|
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Menu bar / system tray app **and** headless agent that tracks your [OpenAI Codex](https://github.com/openai/codex) usage — tokens, cache hit rate, model mix, tokens per second of the running session, subscription rate limits and the **API-equivalent cost in dollars** — and syncs it to your team's Codex Tracker dashboard (Next.js + Clerk + Convex).
|
|
4
4
|
|
|
5
5
|
- macOS menu bar app and native Windows tray app (Electron)
|
|
6
|
-
- `codex-tracker agent` headless mode for **WSL2**, Linux and servers
|
|
6
|
+
- `codex-token-tracker agent` headless mode for **WSL2**, Linux and servers
|
|
7
|
+
- Self-update: `codex-token-tracker update`, plus an in-app "Update" button when a newer version is published
|
|
7
8
|
- Reads Codex CLI / Codex Desktop rollout logs (`~/.codex/sessions`) locally — no API keys, no proxies
|
|
8
|
-
- Real-time: today's totals,
|
|
9
|
+
- Real-time: today's totals, the live session's generation speed (tokens/s), context window use, weekly / 5-hour rate limits
|
|
9
10
|
- Activity heatmap merged from **local data + your other devices** (realtime database)
|
|
10
11
|
- English / 中文, follows your OS language and can be switched and persisted
|
|
11
12
|
- Light / dark follows the system theme
|
|
@@ -20,6 +21,14 @@ npm install -g codex-token-tracker
|
|
|
20
21
|
npx codex-token-tracker
|
|
21
22
|
```
|
|
22
23
|
|
|
24
|
+
This installs two equivalent commands on your PATH: **`codex-token-tracker`** and the shorter alias
|
|
25
|
+
`codex-tracker`. Every example below works with either name.
|
|
26
|
+
|
|
27
|
+
Already installed? `codex-token-tracker update` fetches the newest published version and installs it
|
|
28
|
+
with whichever package manager you used (npm / pnpm / yarn / bun).
|
|
29
|
+
|
|
30
|
+
> **npm 11+ / pnpm 10+ block Electron's install script by default.** That's fine: the first `codex-tracker` run downloads the Electron runtime itself (~100 MB, once). To do it during install instead: `npm install -g codex-token-tracker --allow-scripts=electron`.
|
|
31
|
+
|
|
23
32
|
Node.js 20+ is required. Electron is an *optional* dependency: if its binary cannot be downloaded (locked-down servers, WSL without a desktop), the package still installs and runs in agent mode.
|
|
24
33
|
|
|
25
34
|
## Quick start
|
|
@@ -55,13 +64,15 @@ The tracker discovers the Convex deployment through `<dashboard>/api/config`.
|
|
|
55
64
|
| `codex-tracker paths` | Detected Codex session directories |
|
|
56
65
|
| `codex-tracker config get [key]` / `config set <key> <value>` | Settings (see below) |
|
|
57
66
|
| `codex-tracker lang <en\|zh\|auto>` | Display language |
|
|
67
|
+
| `codex-tracker update [--check]` | Install the newest published version; `--check` only reports it |
|
|
58
68
|
| `codex-tracker --version` / `--help` | |
|
|
59
69
|
|
|
60
70
|
## Menu bar app
|
|
61
71
|
|
|
62
72
|
- Tray title shows today's tokens (`12.4k`) — `config set trayTitle tokens|cost|none`
|
|
63
73
|
- Click: popover with Today, Live session (tokens/s, context window, rate limits), Activity heatmap, Models, Account
|
|
64
|
-
- Right-click: Open dashboard, Sign in/out, Language, Launch at login, Refresh, Quit
|
|
74
|
+
- Right-click: Open dashboard, Sign in/out, Language, Launch at login, Refresh, Check for updates, Quit
|
|
75
|
+
- A banner appears at the top of the popover when a newer version is published; **Update** installs it and the app asks you to restart
|
|
65
76
|
- Launch at login uses a LaunchAgent on macOS and the registry run key on Windows
|
|
66
77
|
|
|
67
78
|
## Windows and WSL2
|
|
@@ -100,16 +111,38 @@ Config lives in `~/.codex-tracker/` (override with `CODEX_TRACKER_HOME`):
|
|
|
100
111
|
| `extraSessionDirs` | `[]` | Extra session folders (comma-separated in `config set`) |
|
|
101
112
|
| `launchAtLogin` | `false` | macOS / Windows |
|
|
102
113
|
| `trayTitle` | `tokens` | `tokens`, `cost` or `none` |
|
|
114
|
+
| `checkUpdates` | `true` | Ask the npm registry (once per 6 h) whether a newer version exists |
|
|
103
115
|
|
|
104
116
|
`CODEX_HOME` is honoured when locating `sessions/` and `archived_sessions/`.
|
|
105
117
|
|
|
106
|
-
###
|
|
118
|
+
### Updates
|
|
119
|
+
|
|
120
|
+
`checkUpdates` (default on) asks `registry.npmjs.org` for the package's `latest` dist-tag at most once
|
|
121
|
+
every 6 hours and caches the answer in `~/.codex-tracker/update.json`. Nothing else is sent — the request
|
|
122
|
+
carries no usage data and no identifiers. Turn it off with `codex-tracker config set checkUpdates false`;
|
|
123
|
+
`codex-tracker update` still works on demand. Set `CODEX_TRACKER_REGISTRY` (or `npm_config_registry`) to use
|
|
124
|
+
a mirror.
|
|
125
|
+
|
|
126
|
+
Global installs can fail for reasons the app cannot fix — a root-owned npm prefix, a proxy, a read-only
|
|
127
|
+
volume. When that happens the exact command is shown so you can run it yourself.
|
|
128
|
+
|
|
129
|
+
### Pricing
|
|
130
|
+
|
|
131
|
+
Costs are "API-equivalent" — [standard OpenAI list prices](https://developers.openai.com/api/docs/pricing)
|
|
132
|
+
per 1M tokens (input, cached input, output; reasoning tokens are billed as output). Models with a
|
|
133
|
+
long-context tier are billed at the higher rate for requests whose prompt exceeds 272K tokens. `-codex`
|
|
134
|
+
variants are priced at their base model's rate.
|
|
135
|
+
|
|
136
|
+
**Codex only.** Some supported sources (Cline/Roo/Kilo, OpenCode) can also drive Anthropic, Google or local
|
|
137
|
+
models. That usage is *not* counted: this tool reports Codex consumption, and pricing a Claude request
|
|
138
|
+
against an OpenAI table would be meaningless.
|
|
107
139
|
|
|
108
|
-
|
|
140
|
+
Models missing from the built-in table are priced by family and marked **est.** Override or add prices in
|
|
141
|
+
`~/.codex-tracker/pricing.json`:
|
|
109
142
|
|
|
110
143
|
```json
|
|
111
144
|
{
|
|
112
|
-
"gpt-5.
|
|
145
|
+
"gpt-5.7-nova": { "input": 1.75, "cachedInput": 0.175, "output": 14 }
|
|
113
146
|
}
|
|
114
147
|
```
|
|
115
148
|
|
|
@@ -118,7 +151,7 @@ Costs are "API-equivalent" — standard OpenAI list prices per 1M tokens (input,
|
|
|
118
151
|
The tracker reads the local transcripts of every agent that can use a Codex subscription (ChatGPT login) and
|
|
119
152
|
attributes usage to an **agent** (shown as "Sources" chips in the popover, a `Sources` line in `codex-tracker status`,
|
|
120
153
|
and as a tag on live sessions / model rows). Only Codex-subscription providers are counted unless
|
|
121
|
-
`trackAllProviders` is `true
|
|
154
|
+
`trackAllProviders` is `true`, and **only OpenAI models are counted at all** — see [Pricing](#pricing).
|
|
122
155
|
|
|
123
156
|
| Source | Where it looks | Notes |
|
|
124
157
|
|---|---|---|
|