feat: display provider usage limits in settings
Fixes #228.
What Changed
Added provider usage limits to the settings flow end to end for all 4 providers (Codex, Claude, Cursor, OpenCode):
- the shared contract now includes the usage-limits schema
- the server persists and exposes provider usage limits
- the web app renders the limits in Settings
Note: For OpenCode, only the official OpenCode-managed providers (OpenCode Go, OpenCode Zen) are shown.
Why
Users need a visible place to confirm provider usage limits without digging through logs or backend state. This keeps the value available across sessions and makes the current limits easy to inspect from the UI.
UI Changes
The Settings panel now shows provider usage limits in the provider section.
Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [ ] I included before/after screenshots for any UI changes
- [ ] I included a video for animation/interaction changes
[!NOTE] Medium Risk Provider status checks now spawn short-lived PTY/CLI probes and extra Codex/OpenCode RPCs, which can slow or flake health checks but does not change auth or billing paths.
Overview Adds subscription/quota usage to provider snapshots and surfaces it in Settings on each provider instance card.
Contracts & snapshot plumbing: Introduces
ServerProviderUsageLimits/ usage windows onServerProvider, threaded throughProviderProbeResultandbuildServerProvider.Per-provider collection during status checks:
- Codex — reads
account/rateLimits/readfrom the app-server probe and maps primary/secondary windows (API-key accounts get an explicit unavailable reason).- Claude — optional PTY probe runs
claude --print /usage(JSON); API-key auth skips probing.- Cursor — optional PTY probe drives the agent TUI
/usagepanel and parses “Included” utilization.- Grok — ACP
auth/check_subscriptionfor auth metadata plus optional PTY/usagefor weekly limits; unauthenticated snapshots warn with a login message.- OpenCode — derives windows from connected OpenCode Go / Zen inventory usage fields; falls back to unavailable when connected providers omit usage.
Infrastructure: Shared
providerUsageLimitsnormalization,ptyProbeSupportfor ANSI stripping and probe timeouts, andPtyAdapterwired into driver creation/hydration so Claude/Cursor/Grok probes can run where a PTY exists.UI:
ProviderUsageBarsonProviderInstanceCardshows per-window progress, remaining %, and reset times (or the server’s unavailable reason).Reviewed by Cursor Bugbot for commit 199335036caa610fa46d33b73560f42f90cba1ac. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Display provider usage limits and progress bars in settings
- Adds
usageLimitsto theServerProvidercontract, including structured usage windows (session/weekly),usedPercent,resetsAt, and availability metadata.- Implements per-provider usage probes:
probeClaudeUsageLimitsparses Claude CLI/usageoutput (including print-mode JSON with IANA time zones),probeCursorUsageLimitsandprobeGrokUsageLimitsdrive PTY sessions to collect usage data, andresolveCodexRateLimitSnapshotUsageLimitsconverts Codex app-server rate limit snapshots.- Adds
ProviderUsageBarstoProviderInstanceCardin the settings UI, rendering color-coded progress bars (green/warning/destructive at 70%/90%) with remaining percent and optional reset date per window.- Threads
PtyAdapterinto driver creation context so Claude, Cursor, and Grok probes can spawn TUI processes during status checks.- Risk: PTY-based probes add latency to provider status checks; spawn failures are handled gracefully by returning an unavailable snapshot rather than erroring.
Macroscope summarized 1993350.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
1ee2bf19-dba6-4b48-840f-cced02ce3debYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
[!WARNING] Your free Security trial is over. An organization admin can activate Security or dismiss this notice.
Comment @coderabbitai help to get the list of available commands.
For now, I’ve added two images to illustrate the UI:
1. Free tier view
This screenshot reflects my current setup. I don’t have subscriptions to Codex or Claude Code, I’m using Copilot Pro (available to me as a student). It shows how the weekly usage limit appears in the interface.
2. Pro tier (mocked example)
This second screenshot uses dummy data to demonstrate how the UI could look for users on a Pro plan (Codex or Claude Code). It includes both session-based limits and weekly limits for clarity.
Approvability
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR introduces a substantial cross-provider usage-limit capability with new CLI/PTY probes, live runtime ingestion, shared snapshot concurrency logic, and web/mobile UI changes. Its broad production impact and several unresolved comments describing concrete runtime or display risks require human review.
You can add or adjust custom eligibility rules. Learn more.
Hey @juliusmarminge, could you take a look at this PR when you get a moment? Thanks!
Randomly found this PR because wanted to add usage to T3. I think this is great as a user but also I think the UI should match the Codex App usage,it's minimal and clean, would be better than AI tabs
You would need to redo the settings button though,something Julius needs to approve. I genuinely think settings button should match Codex App, would love to open PR for that.
A few concerns after checking the code:
- Codex can prefer stale persisted usage over freshly probed usage in the same refresh path.
checkCodexProviderStatus()readscachedUsageLimitsfirst, then later resolves account state, but ultimately usescachedUsageLimits ?? accountUsageLimits. That means a refresh can still emit an older persisted value even when the same refresh just fetched newer limits from the provider probe. If the goal is to show the freshest available snapshot, I think the precedence likely needs to be reversed, or persisted data should only be used when no fresh usage was fetched. - The persisted cache looks too coarse-grained for account/config changes.
The new table is keyed only by
provider_name, and the repo API is alsogetByProvideronly. That seems risky if the user changes auth state, swaps CodexhomePath, changes binary path, or otherwise changes the effective account behind a provider. In those cases we can still surface previously persisted usage for the provider even though it may belong to a different account/config. Is that safe, or should this cache be scoped more tightly (for example by provider + account/config fingerprint) or suppressed when provider health/auth no longer matches the cached source? - A usage-limit update currently looks like it can trigger full provider refresh work.
ProviderServicepersistsaccount.rate-limits.updated, thenProviderRegistrylistens to repository changes and callsrefresh(change.provider). That refresh path eventually reruns the provider'scheckProviderflow rather than just updating already-known snapshot state. For a quota-bar style UI update, this feels heavier than necessary and could add extra CLI churn to a hot path. Would it be simpler to keep usage attached to the provider snapshot/update flow directly instead of going through persistence -> repository stream -> provider refresh?
I can test further and commit to this PR if you're okay with it, @Aditya190803. Genuinely want to see this merged - it would be super useful
this is on my list to review still! Just dealing with some larger prep work so haven't had time yet.
As for the "it must be more visible and sjhould be 1:1 like codex app":
How often do you guys check your limits to warrant it being one click ??? I check it at most a few times a week, so hiding it in settings next to the provider status is fine!
this is on my list to review still! Just dealing with some larger prep work so haven't had time yet.
As for the "it must be more visible and sjhould be 1:1 like codex app":
How often do you guys check your limits to warrant it being one click ??? I check it at most a few times a week, so hiding it in settings next to the provider status is fine!
I've been checking usage a lot in Codex - a couple of times daily since I was on the $20 plan with 2x limits till April, so I was curious how it was going. My take is that the current settings are genuinely fine, but I think it'll get crowded soon. With usage, OpenCode and Cursor support, and I'm sure there are PRs that extend the settings further it's going to contain a lot of content before long. Codex shows a small tab with everything you need: usage, general info, and language (something I'd tuck away in settings). I think the Cursor settings approach is a good reference here too.
Yes when the single settings page gets too large we'll split it to subpages. We already did the work adding the sidebar when adding the archive
can't see claude limits:
@juliusmarminge, pushed updates for the usage limits changes.
Also, should OpenCode show usage for all providers or just the OpenCode-maintained ones?
Just use codexbar, so much easier
@brrock Please explain how this can be integrated since the entire app is written in Swift. How can it be incorporated into this app?
I meant just use it instead of having to do this
It can only be used by people using a Mac. What about those using Windows or Linux?
@juliusmarminge
I've added Cursor and OpenCode usage limits to the PR
could you take a look when you get a moment?
Thanks!
@juliusmarminge I've added Cursor and OpenCode usage limits to the PR could you take a look when you get a moment? Thanks!
Will review next week when I'm back from Miami
just merged my broader provider changes so if you can get this up to date and resolve the conflcits i can review it after that !
@juliusmarminge Done! I’ve updated everything and resolved the conflicts. Could you take a look when you get a chance?
Fails to load Claude usage? And when am i expected to see OpenCode usage? Also can we return Resets at ? Just the percentage isn't the most useful thing if you don't know when it refreshes?