[PR #8912] feat(app): Add OAuth rate limits and usage dashboard #12907

Closed
opened 2026-02-16 18:17:47 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8912

State: closed
Merged: No


Summary

Adds visibility into OAuth rate limits and usage information for authenticated providers, particularly useful for Claude Max users to monitor their 5-hour and 7-day usage limits.

Closes #8911

Changes

Backend (packages/opencode)

  • src/auth/index.ts: Add getUsage() and fetchAnthropicUsage() functions to OAuthPool
  • src/server/server.ts: Add GET /auth/usage API endpoint
  • src/cli/cmd/auth.ts: Add opencode auth usage CLI command

Frontend (packages/app)

  • src/components/dialog-auth-usage.tsx: New dialog component with:
    • Provider list with account counts
    • Anthropic usage limits visualization (5-hour, 7-day)
    • Color-coded progress bars (green/yellow/red)
    • Account status with cooldown indicators
    • Refresh button
  • src/pages/layout.tsx: Add sidebar button to open usage dialog

Screenshots

The dialog displays:

  • Usage bars showing utilization percentage
  • Reset time countdown
  • Active account indicator
  • Cooldown status when rate-limited

Testing

  • Tested with Claude Max account
  • CLI command works correctly
  • API endpoint returns expected data

Note

This PR includes the OAuth multi-account failover commits from @gwizz as a foundation, since the usage dashboard builds on that infrastructure. Credit to gwizz for the excellent OAuth rotation system!

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8912 **State:** closed **Merged:** No --- ## Summary Adds visibility into OAuth rate limits and usage information for authenticated providers, particularly useful for Claude Max users to monitor their 5-hour and 7-day usage limits. Closes #8911 ## Changes ### Backend (`packages/opencode`) - **`src/auth/index.ts`**: Add `getUsage()` and `fetchAnthropicUsage()` functions to OAuthPool - **`src/server/server.ts`**: Add `GET /auth/usage` API endpoint - **`src/cli/cmd/auth.ts`**: Add `opencode auth usage` CLI command ### Frontend (`packages/app`) - **`src/components/dialog-auth-usage.tsx`**: New dialog component with: - Provider list with account counts - Anthropic usage limits visualization (5-hour, 7-day) - Color-coded progress bars (green/yellow/red) - Account status with cooldown indicators - Refresh button - **`src/pages/layout.tsx`**: Add sidebar button to open usage dialog ## Screenshots The dialog displays: - Usage bars showing utilization percentage - Reset time countdown - Active account indicator - Cooldown status when rate-limited ## Testing - [x] Tested with Claude Max account - [x] CLI command works correctly - [x] API endpoint returns expected data ## Note This PR includes the OAuth multi-account failover commits from @gwizz as a foundation, since the usage dashboard builds on that infrastructure. Credit to gwizz for the excellent OAuth rotation system!
yindo added the pull-request label 2026-02-16 18:17:47 -05:00
yindo closed this issue 2026-02-16 18:17:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12907