opencode-openai-multi-auth
v5.0.5
Published
OpenAI ChatGPT OAuth plugin for opencode with multi-account rotation on rate limits
Maintainers
Readme
Multi-Account ChatGPT OAuth for OpenCode
Use multiple ChatGPT Plus/Pro personal or organization accounts with OpenCode. Never hit rate limits again.
┌────────────────────────────────────────────────────────────────┐
│ │
│ Account 1 (rate limited) ──┐ │
│ Account 2 (rate limited) ──┼──► Auto-rotate ──► Keep coding │
│ Account 3 (available) ─────┘ │
│ │
└────────────────────────────────────────────────────────────────┘Why Multi-Account?
| Problem | Solution | |---------|----------| | Hit ChatGPT rate limits while coding | Add multiple accounts, auto-rotate when limited | | Team members share one subscription | Each person adds their own account | | Different orgs have separate subscriptions | Use accounts from multiple organizations | | One account gets throttled | Seamlessly switch to next available account |
Quick Start
# Install
npx -y opencode-openai-multi-auth@latest
# Add your first account
opencode auth login
# Select "ChatGPT Plus/Pro (Codex Subscription)"
# Add more accounts (optional but recommended)
opencode auth login
# Select "Add Another OpenAI Account"
# Start coding - accounts rotate automatically on rate limits
opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=mediumHow Multi-Account Works
Adding Accounts
# First account
opencode auth login
# → Select "ChatGPT Plus/Pro (Codex Subscription)"
# → Browser opens, login with ChatGPT
# → Account saved
# Second account (different email/org)
opencode auth login
# → Select "Add Another OpenAI Account"
# → Login with different ChatGPT account
# → Account added to rotation pool
# Repeat for as many accounts as you haveAutomatic Rotation
When you hit a rate limit:
- Plugin detects 429 (rate limited) response
- Marks current account as limited for that model
- Switches to next available account
- Retries your request automatically
- Shows toast notification:
Switched to [email protected]
Account Selection Strategies
| Strategy | Behavior | Best For |
|----------|----------|----------|
| sticky (default) | Stay with one account until rate limited | Single user, predictable usage |
| round-robin | Rotate through accounts on each request | Distribute load evenly |
| hybrid | Sticky within session, rotate across sessions | Multiple terminal sessions |
Set via environment variable:
OPENCODE_OPENAI_STRATEGY=round-robin opencode run "task"Team Usage
Each team member can add their own ChatGPT account:
# Developer 1 adds their account
opencode auth login # logs in as [email protected]
# Developer 2 adds their account
opencode auth login # → "Add Another OpenAI Account" → [email protected]
# Developer 3 adds their account
opencode auth login # → "Add Another OpenAI Account" → [email protected]All accounts are pooled - when one person's account is rate limited, the plugin uses the next available.
Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| OPENCODE_OPENAI_QUIET=1 | Disable toast notifications | Off |
| OPENCODE_OPENAI_DEBUG=1 | Enable debug logging | Off |
| OPENCODE_OPENAI_STRATEGY | Account selection strategy | sticky |
| OPENCODE_OPENAI_PID_OFFSET=1 | Offset account selection by PID | Off |
Account Management
View Accounts
cat ~/.config/opencode/openai-accounts.json | jq '.accounts[] | {email, planType}'Remove All Accounts
rm ~/.config/opencode/openai-accounts.jsonCheck Rate Limit Status
cat ~/.config/opencode/openai-accounts.json | jq '.accounts[] | {email, rateLimitResets}'Slash Commands (TUI)
/codex-statusShows usage status for all configured accounts.
Models
All GPT-5.2 and GPT-5.1 models with reasoning variants:
- gpt-5.2 (none/low/medium/high/xhigh)
- gpt-5.2-codex (low/medium/high/xhigh)
- gpt-5.1-codex-max (low/medium/high/xhigh)
- gpt-5.1-codex (low/medium/high)
- gpt-5.1-codex-mini (medium/high)
- gpt-5.1 (none/low/medium/high)
Note: The model selector reflects what the ChatGPT OAuth backend advertises. API-only models (like gpt-5-mini/nano) may not appear until the backend exposes them.
Configuration
- Modern (OpenCode v1.0.210+):
config/opencode-modern.json - Legacy (v1.0.209 and below):
config/opencode-legacy.json
# Modern install
npx -y opencode-openai-multi-auth@latest
# Legacy install
npx -y opencode-openai-multi-auth@latest --legacy
# Uninstall
npx -y opencode-openai-multi-auth@latest --uninstallFeatures
- Multi-account rotation - Add unlimited ChatGPT accounts, auto-rotate on rate limits
- Per-model rate tracking - Each model's limits tracked separately per account
- Toast notifications - Visual feedback when accounts switch
- OAuth authentication - Same secure flow as official Codex CLI
- 22 model presets - All GPT-5.2/5.1 variants pre-configured
- Automatic token refresh - Never manually re-authenticate
- Multimodal support - Image input enabled for all models
Documentation
Credits
Maintained by ZenysTX Original implementation by Numman Ali Inspired by opencode-google-antigravity-auth
Usage Notice
This plugin is for personal development use with your own ChatGPT Plus/Pro subscriptions.
