I got tired of getting blindsided by Claude Pro rate limits mid-session. The solution: a menu bar app that reads the same private API that claude.ai/settings/usage calls.
Here's what made it interesting to build:
The Cloudflare problem
Claude's API is behind Cloudflare. Regular requests or httpx get 403'd immediately. The fix: curl_cffi with impersonate="chrome131" to spoof the TLS fingerprint. This was the single biggest hurdle.
Browser cookie detection
Rather than making users copy-paste cookies, I used browser-cookie3 to read them directly from Chrome, Arc, Firefox, Safari, or Brave. Key insight: try Firefox first — it uses a plain SQLite database with no Keychain prompt. Chromium browsers need a one-time "Always Allow" dialog.
AppKit threading rule
rumps runs on the main thread. All UI updates (menu rebuilds) must happen there. My background fetch thread puts results in a queue.Queue, and a 0.25-second timer on the main thread drains it. Violate this and you get intermittent crashes.
Inconsistent API scale
The API returns five_hour (session) as a 0–1 fraction, but seven_day (weekly) as a 0–100 percentage. The fix: if raw > 1.0: already_pct else multiply_by_100. Spent embarrassing time debugging this.
One-line install
curl -fsSL https://raw.githubusercontent.com/yagcioglutoprak/AIQuotaBar/main/install.sh | bash
It also tracks ChatGPT usage in the same menu bar indicator.
MIT licensed, ~900 lines Python: https://github.com/yagcioglutoprak/AIQuotaBar
Happy to go deep on any of these implementation details in the comments.
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.