Skip to content

gehariharan/Tokenwatcher

Repository files navigation

TokenWatcher

TokenWatcher

A native Windows system-tray app that shows your OpenAI Codex and Claude usage limits at a glance.

The Windows alternative to CodexBar — same idea (live OpenAI Codex + Claude rate-limit windows in your menu bar), built from scratch for Windows users who want the same experience without WSL, browser-cookie scraping, or admin tricks.

Release License Platform

CodexBar for Windows — Inspired by steipete/CodexBar on macOS. This is a Windows-specific Electron implementation, rebuilt from scratch to avoid WSL, browser-cookie scraping, and admin requirements.


What it shows

  • OpenAI Codex — live 5h / 7d window utilization, plan, account email
  • Claude — live 5h / 7d / Sonnet / Opus utilization, plan tier, account email

Hover the tray icon, and the panel slides up. No clicks, no extra windows.

Install (end-users)

Three ways:

winget (recommended — no SmartScreen warnings)

winget install gehariharan.TokenWatcher

(Available once the winget submission is merged.)

Microsoft Store

Get it from Microsoft (coming soon — see submission notes)

Direct download

  1. Grab TokenWatcher-Setup-x.y.z.exe from the Releases page
  2. Run it (Windows SmartScreen will warn — click More info → Run anyway; it's unsigned but open-source)
  3. Pin the tray icon: click the ^ near the clock and drag the TokenWatcher icon onto the taskbar

Configuration

Click the gear icon ⚙ in the panel header to:

  • Toggle Watch OpenAI Codex — disable if you don't use Codex
  • Toggle Watch Claude — disable to skip the Edge sign-in flow entirely

Settings live at %APPDATA%\TokenWatcher\settings.json.

Updates

TokenWatcher checks for new versions on launch and every 6 hours while running. When a new version is published to GitHub Releases:

  1. The newer installer is downloaded silently in the background (only changed bytes via electron-builder blockmap — typically a few MB instead of the full 86 MB)
  2. A teal Update banner appears at the top of the panel showing the new version + a one-line release-note summary (full notes on hover)
  3. Click the banner or the Restart & install button to apply, or it applies automatically on next launch

No need to re-download from GitHub or run winget upgrade — installed users get every release automatically.

How it works

  • Codex — reads the OpenAI Codex CLI's OAuth token from ~/.codex/auth.json and calls the same private endpoint the CLI uses (chatgpt.com/backend-api/wham/usage). No additional sign-in needed if you already use the codex CLI.
  • Claude — a one-time sign-in launches Microsoft Edge against claude.ai/login with a dedicated user-data-dir. After you sign in, TokenWatcher reads the sessionKey cookie via Edge's DevTools Protocol, encrypts it with Windows DPAPI, and stores it locally. Live usage data is then fetched directly from claude.ai's usage API.
Component Purpose
Electron shell System tray, side-panel BrowserWindow, IPC routing
Pure Node Codex provider Reads ~/.codex/auth.json + HTTPS GET to chatgpt.com
Python sidecar Claude provider Edge CDP login flow + DPAPI session storage + curl_cffi (defeats Cloudflare's TLS fingerprinting)

Why a Python sidecar?

claude.ai sits behind Cloudflare with TLS / JA3 fingerprinting. Plain Node fetch (and Python requests) get blocked with "Just a moment…". Python's curl_cffi impersonates Chrome's TLS handshake and gets through cleanly. The sidecar is shipped as a single PyInstaller .exe inside the installer — users never see Python.

Privacy & security

  • TokenWatcher only ever talks to chatgpt.com and claude.ai. No third-party servers, no telemetry.
  • The Claude sign-in launches Edge with a dedicated profile directory (~/.tokenwatcher/edge-profile/) — your normal Edge profile is never touched.
  • The captured sessionKey cookie is encrypted with Windows DPAPI before being written to disk. Only your Windows user account can decrypt it.
  • Source code is open and auditable.

Build from source

Prerequisites

  • Windows 10 / 11
  • Node.js 18+
  • Python 3.10+ (for the Claude sidecar; not needed at runtime — only at build time)
  • Microsoft Edge (preinstalled on Windows)

Setup

git clone git@github.com:gehariharan/Tokenwatcher.git
cd Tokenwatcher

# Install Electron + dev deps
npm install

# Set up the Python venv for the sidecar
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r sidecar\requirements.txt

# Run in dev mode
npm start

In dev mode the app spawns the sidecar via the venv's Python — no need to compile it. To exit, right-click the tray icon → Quit.

Build a Windows installer

# Bundle the Python sidecar into resources/claude_fetch.exe
.\build-sidecar.bat

# Build the NSIS installer (output: dist/TokenWatcher Setup x.y.z.exe)
npm run build

Regenerate icons

If you change the source assets/icon-source.png, regenerate the multi-resolution outputs:

.\.venv\Scripts\python.exe scripts\gen-icons.py

Cut a release

Push a tag — the GitHub Actions release workflow builds the sidecar with PyInstaller, builds the NSIS installer, and uploads it to a draft GitHub Release automatically:

git tag v0.1.0
git push origin v0.1.0

Project layout

TokenWatcher/
├── src/
│   ├── main.js              # Electron main: tray, panel, IPC
│   ├── preload.js           # Context bridge
│   └── renderer/            # Side-panel UI (HTML/CSS/JS)
├── src-node/
│   ├── codex.js             # Pure-Node Codex provider
│   ├── claude.js            # Sidecar invoker
│   └── settings.js          # Settings persistence
├── sidecar/
│   └── claude_fetch.py      # Self-contained: Edge CDP + DPAPI + curl_cffi
├── assets/                  # Icons (PNG / ICO)
├── scripts/
│   └── gen-icons.py         # Regenerate icons from source PNG
└── .github/workflows/
    └── release.yml          # Tag push → installer release

Related projects

Keywords

CodexBar for Windows · CodexBar Windows alternative · Codex usage tracker · Claude usage tracker · OpenAI rate limit monitor · ChatGPT rate limit · Claude rate limit · system tray usage monitor · Windows menu-bar app for Codex · Codex 5h window · Claude 5h window

License

MIT