Repository navigation
feat(dashboard): show remaining subscription usage per agent account - #256
Merged
Merged
Conversation
The project dashboard gets a collapsible "Subscription usage left" section listing each connected agent account with its plan and how much of each rate-limit window is left. - Claude Code: reads plan windows from the Agent SDK's /usage control request against an idle CLI (no prompt is sent, so no model tokens are spent). The result is cached for 60s on the server. - Codex: reports the newest rate_limits snapshot that Codex writes into its session logs, reading only the tails of the most recent files, and shows when that snapshot was recorded. - Gemini: always "not available". Neither Gemini CLI nor Gemini API keys expose remaining quota locally. New endpoint: GET /api/subscription-usage (authenticateToken). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the "Subscription usage left" section from the bottom of the project dashboard to just below the Projects heading, and open it by default. A viewer who collapses it keeps it collapsed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Subscription usage left section to the top of the project dashboard (right under the Projects heading, open by default). It lists each connected agent account with its plan and how much of each rate-limit window is left.
/usagecontrol request against an idle CLI. No prompt is sent, so no model tokens are spent. The server caches the result for 60s and collapses concurrent requests.rate_limitssnapshot Codex writes into its session logs (~/.codex/sessions). Only the tails of the newest files are read. The UI shows when the snapshot was recorded.New endpoint:
GET /api/subscription-usage(?refresh=1bypasses the cache), behindauthenticateToken.The two commits were first written on another branch and are cherry-picked onto
mainhere without changes.Test plan
npm test: newserver/utils/__tests__/subscriptionUsage.test.jspasses. The full suite passes apart fromcodexCli.test.js, which fails only because this worktree'snode_modulesis a symlink to another checkout; it passes in a normal checkout.npm run typecheckNote
If #255 (Antigravity CLI) lands first, the Gemini row's label should read "Antigravity CLI". It is a one-line follow-up in
SubscriptionUsage.tsx.🤖 Generated with Claude Code