A Windows taskbar widget that displays real-time Claude Code token usage, rate limits, and session costs.
TokenBar embeds a compact overlay on your Windows taskbar showing:
| Metric | Example | Description |
|---|---|---|
| 5h rate limit | * 42% |
Current 5-hour window usage |
| 7d rate limit | 7d 17% |
Rolling 7-day window usage |
| Reset timer | 3h22m |
Time until 5-hour limit resets |
| Session cost | $0.2381 |
Cumulative cost of current session |
Hover for a detailed tooltip with token breakdowns, session start time, and reset times. Right-click to reset session counters or exit. Drag to reposition the widget on the taskbar.
- Green — under 50% usage
- Orange — 50-80% usage
- Red — 80%+ usage
Claude Code ──stdin──▶ statusline.py ──writes──▶ token_data.json ◀──reads── tokenbar.py
-
statusline.pyis configured as Claude Code'sstatusLinehandler. After each turn, Claude Code pipes turn metadata (tokens, cost, rate limits) to it via stdin. It accumulates the data intotoken_data.json(atomic writes) and prints an ANSI status line back to the terminal. -
tokenbar.pyis a standalone Tkinter GUI that pollstoken_data.jsonevery 2 seconds and renders the metrics as a frameless, always-on-top window positioned on the Windows taskbar.
TokenBar/
├── shared.py # Atomic I/O, formatting, data schema
├── config.py # Configuration dataclass + config.json loader
├── win32_utils.py # Win32 API helpers + singleton mutex
├── tokenbar.py # GUI widget (Tkinter)
├── statusline.py # Claude Code stdin handler
├── pyproject.toml # Package metadata
├── config.json # User overrides (optional)
└── LICENSE
- Windows 10/11
- Python 3.10+ (standard library only — no pip packages needed)
- Claude Code CLI
Add to your Claude Code settings (~/.claude/settings.json):
{
"statusLine": "python C:/full/path/to/TokenBar/statusline.py"
}This tells Claude Code to pipe turn data to statusline.py after each interaction.
# Windowless mode (recommended — no console window)
pythonw tokenbar.py
# With console for debugging
python tokenbar.pyThe widget will appear on the left side of your taskbar. It auto-updates every 2 seconds.
Create a config.json next to the scripts to customize appearance and behavior:
{
"font_family": "JetBrains Mono",
"font_size": 11,
"alpha": 0.90,
"refresh_ms": 3000,
"initial_x": 200,
"theme": {
"bg": "#1E1E2E",
"fg_green": "#A6E3A1",
"fg_orange": "#FAB387",
"fg_red": "#F38BA8"
}
}Only include keys you want to override. See config.py for all available options.
Create a shortcut to pythonw.exe tokenbar.py in your Startup folder:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
pip install pyinstaller
pyinstaller --onefile --noconsole tokenbar.pytoken_data.json (auto-generated, shared between both scripts):
{
"session": {
"input_tokens": 15420,
"output_tokens": 8230,
"cost_usd": 1.2345,
"started_at": "2026-04-02T14:30:00.000000"
},
"daily": {
"2026-04-02": { "input_tokens": 50000, "output_tokens": 25000 }
},
"rate_limits": {
"five_hour": { "used_pct": 42, "resets_at": 1775196000 },
"seven_day": { "used_pct": 17, "resets_at": 1775484000 }
},
"last_updated": "2026-04-02T22:37:36.552490"
}