feat(auth): multi-account support with auto-rotation#13378
feat(auth): multi-account support with auto-rotation#13378IsraelAraujo70 wants to merge 12 commits intoanomalyco:devfrom
Conversation
- New auth store format: { provider: { accounts: {}, activeAccount } }
- Auto-migration from legacy format (single credential per provider)
- New functions: add, getAccounts, use, setEnabled, getNextAccount
- CLI updates: interactive account selection, enable/disable accounts
- Round-robin auto-rotation for rate-limit handling
- Use Auth.add instead of Auth.set for OAuth/API callbacks - Auth.get now automatically returns active account or first available
- OPENCODE_ACCOUNT_<PROVIDER> to select specific account - OPENCODE_ACCOUNT as general override - Example: OPENCODE_ACCOUNT_OPENAI=work
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several potentially related PRs: Potential Duplicates/Related PRs:
Note: PR #13218 and #11832 appear to be the most directly related to PR #13378, as they both address multi-account support with similar goals. You may want to check if these are addressing the same requirements or if they can be consolidated. |
- Add isRateLimitError() helper
- Add withRetry() function that auto-switches accounts on rate-limit
- Usage: Auth.withRetry('openai', async (info) => { ... })
Summary
Add multi-account support to OpenCode authentication system, inspired by the Antigravity plugin.
Changes
opencode auth loginOPENCODE_ACCOUNT_OPENAI=workfor account selectionExample Usage
Related