Skip to content

feat(dashboard): show remaining subscription usage per agent account - #256

Merged
bbsngg merged 2 commits into
mainfrom
claude/subscription-usage
Nov 11, 2026
Merged

bbsngg merged 2 commits into
mainfrom
claude/subscription-usage

Conversation

@bbsngg

@bbsngg bbsngg commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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.

  • Claude Code: plan windows (5h / 7d / per-model 7d) come from the Agent SDK's /usage control 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.
  • Codex: the newest rate_limits snapshot 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.
  • Gemini: always "not available". Nothing local reports remaining quota.
  • API keys instead of a plan are shown as "not available: API key, no plan limits". A window whose reset time has passed shows "reset since last seen" instead of a stale percentage.

New endpoint: GET /api/subscription-usage (?refresh=1 bypasses the cache), behind authenticateToken.

The two commits were first written on another branch and are cherry-picked onto main here without changes.

Test plan

  • npm test: new server/utils/__tests__/subscriptionUsage.test.js passes. The full suite passes apart from codexCli.test.js, which fails only because this worktree's node_modules is a symlink to another checkout; it passes in a normal checkout.
  • npm run typecheck
  • Ran the summary builder against real signed-in accounts: Claude (Max) and Codex returned live windows; Gemini reported unavailable.
  • Dev server with a fresh HOME: the section renders under the Projects heading and shows "not signed in" for all three agents.

Note

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

bbsngg and others added 2 commits November 6, 2026 10:17
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>
@bbsngg
bbsngg merged commit ee252ce into main Nov 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant