Skip to main content

A Claude Code token-usage meter for the Windows taskbar

Project description

English · Español

Claude Code Meter

A Claude Code usage meter for Windows that shows your real plan limits — the same numbers you see in /usage — right inside the taskbar, next to the clock:

  • 5h — % used of your session window (the rolling 5-hour limit)
  • 7d — % used of your weekly window (resets on its own)
  • M — your month-to-date usage, on the same scale as your plan (auto-calibrated)

Claude Code Meter embedded in the Windows taskbar

Each percentage is colored by level: 🟢 < 70 % · 🟡 < 90 % · 🔴 ≥ 90 %. Right-click for reset times, the calibrated weekly limit, and a weekly history of previous weeks.


How it gets your real limits

The percentages in /usage aren't stored on disk — they arrive in the API's rate-limit headers on every response. The meter makes a tiny probe request (max_tokens: 1, ~1 token) every few minutes using the OAuth token Claude Code keeps in ~/.claude/.credentials.json, and reads:

anthropic-ratelimit-unified-5h-utilization   → session window (5 h)
anthropic-ratelimit-unified-7d-utilization   → weekly window (7 days)
anthropic-ratelimit-unified-…-reset          → auto-reset timestamps

The 7d value matches your /usage screen exactly.

The monthly figure (auto-calibrated)

Your plan has no monthly quota — only the 5 h and 7 d windows. So the meter derives a monthly view: knowing that your current week is at X% and how many tokens you've used in that same window (from the local .jsonl logs), it works out — by simple proportion — how many tokens 100% of your weekly limit is, and expresses the month on that scale. It saves the best observation to calib.json (the higher the utilization, the sharper the estimate) and refines it over time. The same rule of three reconstructs the history of previous weeks, which the header no longer remembers.

Importantly, the weekly window is anchored to the plan's real reset (e.g. Friday 11 pm), not the calendar week — so the tokens it counts line up with what the plan is actually measuring.


What it measures (and what it doesn't)

  • ✅ Your real plan limits (session + weekly), from the API headers, plus a calibrated month-to-date figure from local logs (~/.claude/projects/**/*.jsonl).
  • ❌ It does not track Claude on the web/app or other computers (the plan figures are your account-wide limits; the monthly token count is local-only).
  • ℹ️ Local token counts ignore cache reads by default (they'd inflate the numbers ~100× as context is resent); it counts real work input + output + cache_write.

Requirements

  • Windows 10/11
  • A Claude subscription (Pro/Max): the meter uses the OAuth token Claude Code stores in ~/.claude/.credentials.json. API-key-only setups don't return the unified rate-limit headers, so the plan percentages won't show.
  • Python 3.9+ (with tkinter, included in the official Python installer) — or just the .exe.

Install

Option A — Download the .exe (no Python needed)

Download the latest claude-code-meter.exe from the Releases page and double-click it. It shows up in the taskbar right away.

Option B — pip (needs Python 3.9+)

pip install claude-code-meter

Adds the claude-code-meter command and pulls in the dependencies (Pillow, pystray). State (config.json, calib.json, generated logo) lives in %APPDATA%\ClaudeCodeMeter.

Or from source: git clone … && cd claude-code-meter && pip install -e .

Usage

claude-code-meter          # taskbar (default, recommended — the real-limits view)
claude-code-meter tray     # system-tray icon
claude-code-meter panel    # floating panel in the corner

(Equivalent: python -m claude_code_meter.main [bar|tray|panel].)

Note: the bar style is the one with the real plan limits described above. tray and panel are simpler presentations that still show local token usage against a personal target — see config.json.

Configuration

Optional config.json in %APPDATA%\ClaudeCodeMeter (start from config.example.json):

{
  "refresh_sec": 60,          // how often the window repositions / repaints
  "limits_refresh_sec": 300,  // how often it probes the API for plan limits (~1 token each)
  "count_cache_read": false   // include cache reads in local token counts
}

The API is probed at most every limits_refresh_sec (default 5 min) precisely because each probe costs ~1 token — the number reflects your real usage, not an inflated one.

Auto-start (Windows)

Put a shortcut in the Startup folder (Win+Rshell:startup):

  • Downloaded .exe: point the shortcut straight to claude-code-meter.exe.
  • pip install: point it to …\Scripts\claude-code-meter.exe with bar as the argument.

Both run without a console window. The repo also ships Iniciar Meter.vbs, which runs pythonw -m claude_code_meter.main bar.

How the bar version works

Windows 11 repaints the taskbar on top of windows inserted with SetParent, so bar.py uses a topmost window placed by screen coordinates just left of the clock (TrayNotifyWnd) and re-raised every 0.7 s. Same idea as TrafficMonitor / XMeters.

License

MIT — see LICENSE.

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

claude_code_meter-0.2.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

claude_code_meter-0.2.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file claude_code_meter-0.2.0.tar.gz.

File metadata

  • Download URL: claude_code_meter-0.2.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claude_code_meter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a680b93e120f2a5dafff10f5cfc22da7e38c2f3659af18320ec6b2bc4a3ab1e6
MD5 d2d53b432ad5e273bb7a33dd9092ccb7
BLAKE2b-256 90abef56c57f24dbff9602d5a62c0246374ecc044474d323d451bd1692501849

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_code_meter-0.2.0.tar.gz:

Publisher: publish.yml on marcmayol/claude-code-meter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_code_meter-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_code_meter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5f407a95538e3fd9c1e03379a69fda30e12a9191a1cc1d1a1e599155e9c8cdf
MD5 1f3ea843b9922a887d91224009179b14
BLAKE2b-256 d2119215fc4ea67ed1614c2aad9f5bffb2426d8b129b76764043bce3fbe34724

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_code_meter-0.2.0-py3-none-any.whl:

Publisher: publish.yml on marcmayol/claude-code-meter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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