Real-time Claude Code cost dashboard — know exactly what you're spending
Project description
TokenWatch
Real-time Claude Code cost dashboard. Know exactly what you're spending — per session, per project, per day.
No proxy. No SDK wrapping. No API key required. Reads Claude Code's local session logs directly.
Install
pip install tokenwatch
Run
tokenwatch
Opens http://localhost:7842 automatically. That's it.
Commands
tokenwatch # start dashboard + open browser
tokenwatch start # same as above
tokenwatch status # print today's cost in terminal
tokenwatch export # export 30 days to CSV
tokenwatch export --format json --days 90
tokenwatch seed # generate demo data (no real logs needed)
tokenwatch seed --clean # remove demo data
tokenwatch config # show current settings
Options
tokenwatch --budget 20 # set $20/day budget
tokenwatch --port 8080 # different port
tokenwatch --no-browser # don't open browser
Features
- Live cost meter — updates in real time as Claude Code responds
- Daily budget bar — turns orange at 80%, red at 100%
- Desktop notifications — alerts at configurable thresholds (macOS, Linux)
- Session drill-down — click any session to see per-message cost breakdown
- Project breakdown — doughnut chart showing cost by project
- CSV/JSON export — one-click download
- Live pricing — fetched from Anthropic on startup, cached locally
- Weekly email digest — optional (requires
RESEND_API_KEY) - Auto-start on login — run
bash install_autostart.shonce (macOS)
Configuration
Settings live in ~/.claude/tokenwatch_config.json. Edit directly or use the ⚙ button in the dashboard.
| Key | Default | Description |
|---|---|---|
daily_budget |
10.00 | Daily spend limit (USD) |
alert_at_pct |
[80, 100] | Notification thresholds |
history_days |
30 | Days of history to show |
port |
7842 | Server port |
open_browser |
true | Auto-open on start |
digest_email |
"" | Weekly email (needs RESEND_API_KEY) |
Weekly digest email
export RESEND_API_KEY=re_...
tokenwatch # set digest_email in Settings
Auto-start on macOS login
bash install_autostart.sh
How it works
Claude Code writes JSONL session logs to ~/.claude/projects/<project>/<session>.jsonl.
TokenWatch watches that directory with OS-native file events (FSEvents on macOS, inotify on Linux),
reads new entries within 300ms, and streams cost updates to the dashboard via Server-Sent Events.
Costs = token counts × live Anthropic prices. Cache tokens are priced correctly (10× cheaper than input).
Publishing to PyPI
# Tag a release
git tag v0.2.0 && git push --tags
# GitHub Actions auto-publishes via trusted publishing
Or manually:
make publish
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tokenwatch-0.2.0.tar.gz.
File metadata
- Download URL: tokenwatch-0.2.0.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05c42352a7175dab4e5e38b5eb33a53f0a40d502b74c813cfe6f5092df56080d
|
|
| MD5 |
5c5a0c667c04b56b856dee14928855f7
|
|
| BLAKE2b-256 |
67d90c36b9970e6f27b71ed90987f7c56280df3aed143a50405939ba5366612f
|
File details
Details for the file tokenwatch-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tokenwatch-0.2.0-py3-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ebc827740cc087de97d55cd9320bb7d07635502634dc822f8c348a6b8d5c79d
|
|
| MD5 |
e869a677a7c464b3c664ea305a0aaf9a
|
|
| BLAKE2b-256 |
c5e372bf49ccdc30a898fa373524a436275f7cda6c5aa1da0dfbbbed6f8d50e3
|