feat: add AI Quota tab showing Claude & Codex usage#1306
Conversation
Display real-time usage percentages for Claude (Anthropic) and Codex (ChatGPT) accounts in a new dedicated tab within the notch. Reads OAuth credentials via XPC helper (Keychain + file fallback) and queries the official usage APIs. Includes per-tier progress bars, reset countdowns, and auto-refresh every 5 minutes (only when enabled). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the Claude access token expires (401), the app was retrying every 2 minutes with the same bad token until it got rate-limited (429). Now it backs off on auth failures too (15 min) and shows a clear message. Other improvements: - Try XPC helper before Keychain fallback (avoids password prompts) - Preserve last successful quota on transient errors - Show "Updated X ago" timestamp on quota cards - Handle 429 with Retry-After header support - Use floor() for utilization percentage display - Reduce polling interval from 5 min to 2 min Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
✅ This PR now targets
|
- Remove unused `isTransient` property from AIQuotaRequestError - Update test script to cover new auth failure backoff and blockMessage API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I don't understand what this PR does, the description make it seem like a bug fix (while the title talks about a feature), but this can't be as there is no feature relating to Claude Code in the app right now. |
|
Hi @Ein-Tim, sorry for the confusing description! This PR adds a brand new AI Quota tab to boring.notch — it's a completely new feature, not a bug fix. The branch name and original description were misleading, apologies for that. What this PR addsA new AI Quota view accessible from the notch that shows real-time usage for:
The feature reads credentials from the local Claude Code CLI keychain and Codex CLI config, so it works out of the box if the user has either tool installed. The "fix" commitsThe Happy to update the PR description or split into separate PRs if that's easier to review. Let me know! |
|
Also wanted to mention — this is actually my first ever PR on GitHub, so I'm still learning the process! I just noticed myself that the branch is named |
|
One known issue I should flag: before the quota data loads successfully, the app prompts for the macOS keychain password multiple times. This happens because the app falls back to reading the Claude credentials directly from the system keychain (via We have an XPC helper that tries to read credentials from the filesystem first to avoid this, but it currently falls back to the keychain path too often. We haven't been able to fully resolve this yet and would appreciate any guidance from someone more familiar with the project's XPC/keychain setup. Happy to iterate on this if you have suggestions! |
Summary
Retry-Afterheader on 429 responses, default 30-min backofffloor()for percentage displayProblem
When the Claude OAuth access token expires, the app was:
Now it detects the 401 immediately and backs off with a clear "Token expired. Re-login with CLI." message.
Test plan
🤖 Generated with Claude Code