Skip to content

Conversation

@PSU3D0
Copy link

@PSU3D0 PSU3D0 commented Dec 17, 2025

Summary

This PR introduces a multi-account load-balancing architecture for the Gemini OAuth plugin, allowing users to "stack" multiple Google accounts to maximize throughput and bypass single-account rate limits.

Changes

  • Multi-Account Registry: Refactored the refresh token storage to support a semicolon-separated pool of account credentials.
  • Load Balancing Fetch: Implemented a randomized account selection strategy in the plugin's fetch wrapper.
  • Reactive Rate Limiting: Added a 429 error interceptor that tracks rate-limited accounts in memory using Retry-After headers, temporarily removing them from the pool to maintain high throughput.
  • Cumulative Login Flow: Updated the OAuth callback logic to append new accounts to the pool instead of overwriting existing ones.
  • Granular Token Management: Refactored token refresh logic to handle accounts individually, improving resilience against single-token revocations.

Impact

Users can now log in multiple times via opencode auth login google to aggregate the quotas of multiple GCP projects/accounts, effectively load balancing requests at the plugin level

@PSU3D0 PSU3D0 marked this pull request as draft December 17, 2025 20:32
@PSU3D0
Copy link
Author

PSU3D0 commented Dec 17, 2025

Not ready for prime time. Corner cases

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