Skip to main content

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.

tokenwatch.observer · Report a bug


Install

pip install tokenwatch

Requires Python 3.11+ · Works on macOS, Linux, Windows

Run

tokenwatch

Opens http://localhost:7842 automatically. That's it.


Troubleshooting — I see no data

Run the built-in diagnostic:

Visit http://localhost:7842/api/debug in your browser after starting TokenWatch. It checks:

  • Whether your Claude Code log directory exists
  • Whether session files are present
  • Whether the log format is readable
  • What the most recent session contains

Common fixes:

Problem Fix
"No .jsonl files found" Run claude in a project folder first, then refresh
"Claude projects directory not found" Claude Code hasn't been used yet on this machine
Dashboard shows $0.00 Your session has no usage data — check the diagnostic
Numbers look wrong Click ↺ Refresh on the prices panel to fetch live rates

Still stuck? Open an issue on GitHub or email hello@tokenwatch.observer


Commands

tokenwatch                   # start dashboard + open browser
tokenwatch status            # print today's cost in terminal
tokenwatch export            # export 30 days to CSV (Pro)
tokenwatch seed              # generate demo data
tokenwatch seed --clean      # remove demo data
tokenwatch config            # show current settings
tokenwatch license --key tw_live_...   # activate Pro license

Auto-start on login

macOS:

bash install_autostart.sh

Linux (systemd):

# Create ~/.config/systemd/user/tokenwatch.service
[Unit]
Description=TokenWatch

[Service]
ExecStart=/usr/local/bin/tokenwatch --no-browser
Restart=always

[Install]
WantedBy=default.target

# Enable
systemctl --user enable tokenwatch
systemctl --user start tokenwatch

Windows: Coming soon. For now, add tokenwatch --no-browser to your startup folder.


Configuration

Settings live in ~/.claude/tokenwatch_config.json. Edit directly or use the ⚙ Settings panel in the dashboard.

Key Default Description
daily_budget 10.00 Daily spend limit (USD)
alert_at_pct [80, 100] Notification thresholds (Pro: customizable)
history_days 7 Days of history (Free: max 7, Pro: max 90)
port 7842 Server port
open_browser true Auto-open on start
digest_email "" Weekly email (Pro + RESEND_API_KEY required)

Free vs Pro

Feature Free Pro ($9/mo)
Live cost dashboard
7-day history
Budget alerts
Session drill-down
Project breakdown
90-day history
CSV / JSON export
Weekly email digest
Custom alert thresholds

Get Pro →


Cancel subscription

Go to ⚙ Settings in the dashboard → Manage subscription (Pro users only). Or email info@consulting-ai.tech.


How it works

Claude Code writes JSONL session logs to ~/.claude/projects/<project>/<session>.jsonl. TokenWatch watches that directory with OS-native file events, reads new entries within 300ms, and streams cost updates to the dashboard via Server-Sent Events.

Costs = token counts × live Anthropic prices (fetched from LiteLLM's community-maintained price list).


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

tokenwatch-0.2.4.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokenwatch-0.2.4-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file tokenwatch-0.2.4.tar.gz.

File metadata

  • Download URL: tokenwatch-0.2.4.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for tokenwatch-0.2.4.tar.gz
Algorithm Hash digest
SHA256 b0367fce4fcb5fba8549a63a1940fa6a640cc75bb3ded4600b9e990aab510cb3
MD5 9339bb41fede43ca6ddfe914d0bdf974
BLAKE2b-256 2e653471ef50f7244c60941a044ef6927d9799363b9790b7c25edb02e26e6dff

See more details on using hashes here.

File details

Details for the file tokenwatch-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: tokenwatch-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for tokenwatch-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 11b2fd4a7e865ef526e608fb646bfcd1f60ec3c9c52e7c45d12865966cf643b5
MD5 97895a5613708c7e7881eff436f408ab
BLAKE2b-256 5ee943ed5ca0d0ccf2a974d7eb6a7f60ada43cddac2c94614ad6610d12bfacf6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page