I kept getting surprised by Claude's rate limits mid-conversation. I'd be deep into debugging, brainstorming, or writing — and suddenly get throttled with no warning. No countdown, no heads-up. Just... stopped.
So I built Claude Usage Monitor — a native macOS menu bar app that shows your Claude.ai usage at a glance.
What It Does
The app lives in your menu bar (no Dock icon) and shows your current message count right next to a tree icon — something like 45/100. The icon changes colour as your usage climbs:
- Green — plenty of messages left (under 50%)
- Yellow — getting there (50–80%)
- Red — almost out (over 80%)
Click the icon to open a popover dashboard with a circular progress ring, a countdown to when your usage window resets, and rate limit status.
How It Works Under the Hood
This is where it gets interesting from an engineering perspective.
The app embeds a hidden WKWebView that loads claude.ai/settings/usage using your stored browser session. But instead of just scraping the DOM text (which is fragile and limited), I inject a JavaScript fetch/XHR interceptor at document-start — before any page script runs.
This interceptor hooks into fetch() and XMLHttpRequest.prototype.open to capture every API response that mentions usage, limits, or quotas. The intercepted JSON is forwarded to Swift via WKScriptMessageHandler.
Why does this matter? Because the session-window rate limit data (the 5-hour window) isn't always visible in the page's DOM — it comes through API responses that the page consumes internally. The interceptor catches this data before the page even renders it.
For cookie persistence, WKWebsiteDataStore.default() handles everything automatically — it persists cookies to disk between app launches, so you only need to log in once.
The Stack
- Pure Swift + SwiftUI — no Electron, no web frameworks, no dependencies
- WKWebView for headless web interaction
- JavaScript injection for API response interception
- Ad-hoc signed
.dmgfor easy distribution - MIT licensed, fully open source
Limitations (Being Honest)
- It scrapes Claude's usage page, so it can break when Anthropic changes their DOM or API
- Ad-hoc signed only (no Apple Developer ID yet) — you need to right-click → Open on first launch
- Currently arm64 only (Apple Silicon Macs)
- Auto-refresh is every 5 minutes to avoid overwhelming Claude's servers
Try It Out
The app is completely free and open source:
GitHub: github.com/theDanButuc/Claude-Usage-Monitor
Download the .dmg from the Releases page, or build from source with just swiftc (no full Xcode required).
Works with Free, Pro, Team, and Max Claude plans. Requires macOS 13 Ventura or later.
I'd love to hear your feedback — what usage data would be most useful to show? I'm considering adding usage history charts and notifications when approaching limits.
If you found this useful, a star on GitHub would mean a lot!
Top comments (0)