This is a newcomer-friendly guide to set up OpenCode with the same stack I use:
- Multi-account ChatGPT OAuth rotation for Codex (this plugin)
- Codex Token Dashboard (web UI) for accounts/tokens/quotas
- Antigravity auth (Gemini/Claude through OpenCode) for background agents
- Oh My OpenCode (agent harness + extra tooling)
- MCP servers (Chrome DevTools, Firecrawl)
The goal: after you finish, OpenCode feels "ready" and fast to use.
- OpenCode Desktop +
opencode-cliworking - Multiple ChatGPT Plus/Pro accounts added, automatic rotation
- Selecting GPT-5.2 Codex in OpenCode can still use Codex 5.3 via backend mapping (until OpenCode lists 5.3 natively)
- A web dashboard to inspect accounts, refresh tokens, refresh quotas, add/remove accounts, notes/tags
You need:
- OpenCode Desktop installed (includes
opencode-cli) - Node.js installed (for MCP tools like
npx ...) - Bun installed (OpenCode uses Bun for plugin installs)
Quick checks:
node -v
bun -v
ls /Applications/OpenCode.app/Contents/MacOS/opencode-cliIf Node/Bun are missing, install them first.
Install this repo into OpenCode's config directory:
bun add github:guard22/opencode-multi-auth-codex#v1.0.9 --cwd ~/.config/opencodeIf you prefer tracking main (not recommended for beginners):
bun add github:guard22/opencode-multi-auth-codex --cwd ~/.config/opencodeThese are optional but part of the "1:1" setup I use.
bun add opencode-antigravity-auth@1.4.5 --cwd ~/.config/opencodebun add oh-my-opencode@3.1.6 --cwd ~/.config/opencodeEdit (or create) this file:
~/.config/opencode/opencode.json
Below is a known-good baseline.
Important:
- Replace placeholders like
PASTE_FIRECRAWL_API_KEY_HEREwith your value. - Replace
YOUR_USERwith your macOS username. - Do not share this file if it contains secrets.
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"oh-my-opencode@3.1.6",
"opencode-antigravity-auth@1.4.5",
"file:///Users/YOUR_USER/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/index.js"
],
"permission": {
"delegate_task": "allow",
"task": { "*": "allow" },
"skill": { "*": "allow" }
},
"compaction": {
"auto": true,
"prune": true
},
"model": "google/antigravity-gemini-3-pro-high",
"provider": {
"openai": {
"options": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": ["reasoning.encrypted_content"],
"store": false
},
"models": {
"gpt-5.2": {
"name": "GPT-5.2",
"limit": { "context": 272000, "output": 128000 },
"modalities": { "input": ["text", "image"], "output": ["text"] }
},
"gpt-5.2-codex-medium": {
"name": "GPT 5.2 Codex Medium (OAuth)",
"limit": { "context": 400000, "output": 128000 },
"modalities": { "input": ["text", "image"], "output": ["text"] },
"options": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": ["reasoning.encrypted_content"],
"store": false
}
},
"gpt-5.2-codex-high": {
"name": "GPT 5.2 Codex High (OAuth)",
"limit": { "context": 400000, "output": 128000 },
"modalities": { "input": ["text", "image"], "output": ["text"] },
"options": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium",
"include": ["reasoning.encrypted_content"],
"store": false
}
}
}
},
"google": {
"models": {
"antigravity-gemini-3-pro-high": {
"name": "Gemini 3 Pro High (Antigravity)",
"limit": { "context": 250000, "output": 65535 },
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
},
"gemini-3-flash": {
"name": "Gemini 3 Flash (Antigravity)",
"limit": { "context": 250000, "output": 65536 },
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
},
"claude-opus-4-5-thinking-high": {
"name": "Claude Opus 4.5 Thinking High (Antigravity)",
"limit": { "context": 200000, "output": 64000 },
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
}
}
}
},
"mcp": {
"chrome-devtools": {
"type": "local",
"command": ["npx", "-y", "chrome-devtools-mcp@latest", "--channel", "stable"],
"enabled": true
},
"firecrawl-mcp": {
"type": "local",
"command": ["npx", "-y", "firecrawl-mcp"],
"environment": {
"FIRECRAWL_API_KEY": "PASTE_FIRECRAWL_API_KEY_HERE"
},
"enabled": true
}
}
}You can add accounts via OpenCode UI or via this plugin CLI.
In OpenCode:
- Providers / Auth
- OpenAI
- Choose "ChatGPT OAuth (Multi-Account)"
- Enter an alias (e.g.
acc1,work,backup) - Complete login in your browser
Repeat for each account.
node ~/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/cli.js add acc1
node ~/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/cli.js add acc2
node ~/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/cli.js statusAccount store file:
~/.config/opencode-multi-auth/accounts.json
Security note:
- Treat it like a password vault. It contains refresh tokens.
OpenCode may not list openai/gpt-5.3-codex yet. This plugin can still use it.
Default behavior:
- If you select
openai/gpt-5.2-codex(oropenai/gpt-5-codex), the plugin will send requests asgpt-5.3-codex.
Env vars:
OPENCODE_MULTI_AUTH_PREFER_CODEX_LATEST=0disables mapping.OPENCODE_MULTI_AUTH_CODEX_LATEST_MODEL=gpt-5.3-codexoverrides target.OPENCODE_MULTI_AUTH_DEBUG=1prints mapping logs.
OPENCODE_MULTI_AUTH_DEBUG=1 \
OPENCODE_MULTI_AUTH_CODEX_LATEST_MODEL=gpt-5.3-codex \
/Applications/OpenCode.app/Contents/MacOS/opencode-cli run \
-m openai/gpt-5.2-codex "Reply ONLY with OK." \
--print-logs --log-level INFOExpected:
- log contains
model map: gpt-5.2-codex -> gpt-5.3-codex - response is
OK
Start local dashboard:
node ~/.config/opencode/node_modules/@guard22/opencode-multi-auth-codex/dist/cli.js web --host 127.0.0.1 --port 3434Open:
http://127.0.0.1:3434
What it's for:
- See all accounts
- Refresh tokens
- Refresh limits/quotas (active or all accounts)
- Add/remove accounts
- Notes/tags
- Basic logs
Rotation found zero usable accounts (expired/invalid/rate-limited).
Fix:
- Open dashboard and look for ERROR badges.
- Re-auth the failing account.
- Add more accounts, or wait for cooldown.
This is almost always account-level.
Fix:
- Re-login that specific alias.
/Applications/OpenCode.app/Contents/MacOS/opencode-cli debug config --print-logsYou should see entries like:
... opencode-multi-auth-codex ... loading plugin... opencode-antigravity-auth ... loading plugin... oh-my-opencode ... loading plugin