feat: Add OAuth rate limits and usage dashboard #6497

Closed
opened 2026-02-16 18:04:23 -05:00 by yindo · 2 comments
Owner

Originally created by @mguttmann on GitHub (Jan 16, 2026).

Originally assigned to: @thdxr on GitHub.

Summary

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

Problem

Users with Claude Max subscriptions currently have no visibility into their rate limits. This makes it difficult to:

  • Know when they're approaching limits
  • Understand why requests might be failing
  • See which OAuth account is currently active (for multi-account setups)

Proposed Solution

Desktop App

Add a new dialog accessible from the sidebar that displays:

  • Provider list with account counts
  • Anthropic Usage Limits: 5-hour and 7-day utilization with progress bars
  • Account Status: Active/inactive state, cooldown status, request counts
  • Color-coded progress bars (green → yellow → red)
  • Reset time countdown

CLI

Add a new opencode auth usage command that displays:

  • Account status per provider
  • Request success/failure counts
  • Cooldown state
  • Anthropic rate limit percentages

API

Add GET /auth/usage endpoint that returns usage data for all OAuth providers.

Technical Approach

  1. Backend

    • Add Auth.OAuthPool.getUsage() - Returns account health and status
    • Add Auth.OAuthPool.fetchAnthropicUsage() - Fetches rate limits from Anthropic's OAuth usage API
    • Add /auth/usage API endpoint
  2. Frontend

    • New DialogAuthUsage component with SolidJS
    • Progress bar visualization with color coding
    • Sidebar button integration
  3. CLI

    • New AuthUsageCommand subcommand

Additional Context

This feature builds on the OAuth multi-account failover system. It leverages the existing health tracking to provide meaningful usage statistics.

The Anthropic usage API (https://api.anthropic.com/api/oauth/usage) provides utilization percentages and reset times for:

  • 5-hour rolling limit
  • 7-day limit (all models)
  • 7-day limit (Sonnet-specific)
Originally created by @mguttmann on GitHub (Jan 16, 2026). Originally assigned to: @thdxr on GitHub. ## Summary Add visibility into OAuth rate limits and usage information, particularly useful for Claude Max users who need to monitor their 5-hour and 7-day usage limits. ## Problem Users with Claude Max subscriptions currently have no visibility into their rate limits. This makes it difficult to: - Know when they're approaching limits - Understand why requests might be failing - See which OAuth account is currently active (for multi-account setups) ## Proposed Solution ### Desktop App Add a new dialog accessible from the sidebar that displays: - Provider list with account counts - **Anthropic Usage Limits**: 5-hour and 7-day utilization with progress bars - **Account Status**: Active/inactive state, cooldown status, request counts - Color-coded progress bars (green → yellow → red) - Reset time countdown ### CLI Add a new `opencode auth usage` command that displays: - Account status per provider - Request success/failure counts - Cooldown state - Anthropic rate limit percentages ### API Add `GET /auth/usage` endpoint that returns usage data for all OAuth providers. ## Technical Approach 1. **Backend** - Add `Auth.OAuthPool.getUsage()` - Returns account health and status - Add `Auth.OAuthPool.fetchAnthropicUsage()` - Fetches rate limits from Anthropic's OAuth usage API - Add `/auth/usage` API endpoint 2. **Frontend** - New `DialogAuthUsage` component with SolidJS - Progress bar visualization with color coding - Sidebar button integration 3. **CLI** - New `AuthUsageCommand` subcommand ## Additional Context This feature builds on the OAuth multi-account failover system. It leverages the existing health tracking to provide meaningful usage statistics. The Anthropic usage API (`https://api.anthropic.com/api/oauth/usage`) provides utilization percentages and reset times for: - 5-hour rolling limit - 7-day limit (all models) - 7-day limit (Sonnet-specific)
yindo closed this issue 2026-02-16 18:04:23 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 16, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #8591: feat: OAuth Marathon - multi-account credential rotation

Feel free to ignore if none of these address your specific case.

Both issues focus on improving the OAuth experience for multi-account setups and providing visibility into account status. #8591 implements automatic credential rotation and health tracking, which provides foundational work that #8911 builds upon to add usage visualization.

@github-actions[bot] commented on GitHub (Jan 16, 2026): This issue might be a duplicate of existing issues. Please check: - #8591: feat: OAuth Marathon - multi-account credential rotation Feel free to ignore if none of these address your specific case. Both issues focus on improving the OAuth experience for multi-account setups and providing visibility into account status. #8591 implements automatic credential rotation and health tracking, which provides foundational work that #8911 builds upon to add usage visualization.
Author
Owner

@mguttmann commented on GitHub (Jan 17, 2026):

Closing to rework - will resubmit with improved documentation

@mguttmann commented on GitHub (Jan 17, 2026): Closing to rework - will resubmit with improved documentation
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6497