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.3.tar.gz (36.7 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.3-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tokenwatch-0.2.3.tar.gz
  • Upload date:
  • Size: 36.7 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.3.tar.gz
Algorithm Hash digest
SHA256 c30dcb508fbfd40af2a2a534f48b9853583f95d010bb11e0c4f6532962134a4d
MD5 627908b4302230e993ca0d5f4d7f4a90
BLAKE2b-256 91b48b9707b60e4faf1ea2f52d53b4870cc377a294da7fdcec4a67a91c385358

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tokenwatch-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 40.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2805c3414937daa09ba27532ee5c7dcc5a5c8befd8d2c10bfacade97985f4132
MD5 0f4968b6744e44f0e604a02d6b57433c
BLAKE2b-256 1c4d1be29fba7a93325ff40f6af65fa4c9ddafcfbf821189caf2a3c674808474

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