-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Feature Request
I've built a fork with multi-account support that I'd love to contribute back to this project.
Features Added
- Multiple accounts: Add multiple Claude Pro/Max accounts with custom labels
- Automatic failover: When one account hits rate limits (429), automatically switches to the next available account
- Rate limit tracking: Tracks which accounts are rate-limited with expiry times
- API key fallback: Falls back to
ANTHROPIC_API_KEYenv var when all OAuth accounts are exhausted - CLI management tool: Standalone
multi-authCLI for account management outside of OpenCode - Backwards compatible: Automatically migrates existing single-account auth to multi-account format
CLI Tool
Account management via multi-auth command (run before starting OpenCode):
multi-auth add [label] # Add account (opens browser for OAuth)
multi-auth list # List accounts with token status
multi-auth info # Detailed info (expiry times, tokens)
multi-auth rename <n> <name>
multi-auth remove <n>
multi-auth statusExample output:
$ multi-auth list
📋 Connected Accounts
1. "Personal" - 🟢 valid (7h 56m left)
2. "Work" - 🟢 valid (7h 56m left)
3. "Backup" - 🔴 expired (will auto-refresh)
Use Case
For users with multiple Claude subscriptions (personal + work, or team accounts), this allows seamless switching when hitting rate limits, maximizing productivity without manual intervention.
Implementation
The fork is available at: https://github.com/cvrt-gmbh/opencode-anthropic-multi-auth
Key changes:
- Storage format changed from
type: "oauth"totype: "multi-oauth"with accounts array - Config stored in
~/.config/opencode/multi-auth.json(shared between CLI and plugin) - Added rate limit tracking with
retry-afterheader parsing - Automatic retry with next available account on 429
- Standalone CLI tool for account management
Collaboration
I'm happy to:
- Submit a PR with these changes
- Adapt the code to match your project's style/conventions
- Discuss alternative implementation approaches
- Help maintain the feature going forward
Let me know if you're interested in incorporating this functionality!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels