opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(app): Add OAuth rate limits and usage dashboard

Open mguttmann opened this issue 5 days ago • 2 comments

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!

mguttmann avatar Jan 16 '26 15:01 mguttmann

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

Related PR:

This PR is related because the current PR (#8912) explicitly mentions that it builds on the OAuth multi-account failover infrastructure, likely from this OAuth Marathon implementation. However, they serve different purposes - #8590 appears to handle the credential rotation logic, while #8912 adds the usage monitoring dashboard on top of that infrastructure.

This is not a duplicate but rather a dependent feature. No exact duplicates found.

github-actions[bot] avatar Jan 16 '26 15:01 github-actions[bot]

@mguttmann screenshots please

adamdotdevin avatar Jan 16 '26 23:01 adamdotdevin

Closing to rework - will resubmit with improved documentation covering both features (multi-account OAuth rotation + usage dashboard)

mguttmann avatar Jan 17 '26 08:01 mguttmann