o-O-o o-o o o o--o o o o o o o-O-o o-O-o o-o o-o
| o o | / | |\ | | \ / | | / |
| | | OO O-o | \ | | O | | O o-o
| o o | \ | | \| | | | | \ |
o o-o o o o--o o o O---o o o o-O-o o-o o--o
tokenlytics is an open source token tracker. watches your ~/.claude and ~/.codex folders. all local. optionally compete with your friends to see who becomes the first token trillionaire of your feud.
CLI |
Web |
curl -fsSL https://ultracontext.com/tokenlytics.sh | shor from source:
cargo install --git https://github.com/ultracontext/tokenlyticshttp://localhost:6969
live token usage with sparklines, trends, and per-model breakdown. realtime via server-sent events. open in your browser any time the daemon is up.
when the first-run wizard asks for a port, it is for the local dashboard/API.
tokenlytics # show your stats (auto-starts the daemon)
tokenlytics on # start the background daemon
tokenlytics off # stop the daemon
tokenlytics status # is it running?
tokenlytics update # fetch the latest
tokenlytics --versionbare tokenlytics auto-starts the daemon if it's not running. ctrl+c on tokenlytics on doesn't kill it (detached via setsid) — only tokenlytics off does.
opt-in. picked during the first-run wizard, changeable via tokenlytics --reconfigure.
- off — just track yourself locally
- global — compete with everyone running tokenlytics. live at ultracontext.com/tokenlytics
- friends — host or join a private leaderboard
display name, token totals, and aggregate per-model token totals are the only things that leave your machine, and only if you enabled it.
| local | over the network | |
|---|---|---|
| token counts | ✓ | |
| dashboard | ✓ | |
| your messages, prompts, code | ✓ | |
| display name + totals + per-model totals | leaderboard server (if enabled) |
if leaderboard is off, nothing leaves your machine.
every token event is mirrored into ~/.tokenlytics/usage.db (SQLite, bundled). claude and codex delete sessions after ~30 days; tokenlytics keeps them forever.
tokenlytics update and any rebuild never touch your data — the binary lives in ~/.cargo/bin/ or /usr/local/bin/, your data lives in ~/.tokenlytics/.
~/.tokenlytics/
config.toml your name, port, leaderboard mode
usage.db every token event, ever
leaderboard.json friend rankings (if you host)
tokenlytics.log daemon stdout/stderr
tokenlytics.pid daemon pid (cleaned by `off`)
run tokenlytics in server mode to back a public or private leaderboard.
LEADERBOARD=1 LEADERBOARD_SERVER=1 \
TOKENLYTICS_ADMIN_TOKEN=$(openssl rand -hex 32) \
tokenlytics serve --no-setupserver mode locks the API surface to a tight whitelist:
| public | locked down |
|---|---|
GET /api/leaderboard |
GET / (no dashboard) |
GET /api/version |
/api/usage /api/tokens /api/models /api/stream |
POST /api/leaderboard/submit |
POST /api/self-update |
with TOKENLYTICS_ADMIN_TOKEN set you also get admin endpoints (Authorization: Bearer <token>):
# wipe entire leaderboard
curl -X POST https://your-host/api/admin/wipe \
-H "Authorization: Bearer $TOKEN"
# delete one entry
curl -X DELETE https://your-host/api/admin/entry/<name> \
-H "Authorization: Bearer $TOKEN"without the env var, admin paths return 404 (they don't exist). the global host at tokenlytics.ultracontext.com runs this exact setup behind Cloudflare + nginx + systemd. ready-made deploy script in scripts/vps-deploy.sh.
tokenlytics updatere-runs the install script and atomically replaces the binary in place — works on macOS and Linux, even with the daemon running.
auto-update: each release bumps the global server's MIN_CLIENT_VERSION to its own version. Older clients hitting the leaderboard get HTTP 426; the dashboard then triggers /api/self-update on the local daemon, which fetches the new binary and re-execs itself. You see a brief "updating…" banner and the page reloads on the new version. No manual step.
- macOS or Linux
- claude code usage in
~/.claude, codex usage in~/.codex, or both
cargo run -- on # run locally without installing
cargo testmade by Fabio Roma · [ ultracontext ]

