OpenAI ChatGPT (Codex backend) OAuth auth plugin for opencode - use your ChatGPT Plus/Pro subscription instead of API credits
npm install opencode-openai-codex-multi-auth!Image 1: opencode-openai-codex-auth
Fork maintained by iam-brain.
Upstream project (credit): numman-ali/opencode-openai-codex-auth


One install. Every Codex model. Multi-account aware.
Install Β· Models Β· Configuration Β· Docs
NOTE:
Currently, the CLI (opencode auth login) path does not work correctly due to a possibly unintentional bug in how Opencode handles provider logins in their CLI. The TUI (opencode > ctrl + x m > ctrl + a, OpenAI) path works perfectly as it functions as intended.
> Related issue: Issue #10898
> Related PRs: Pull #11058 // Pull #11076
---
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β ChatGPT OAuth β Codex backend β OpenCode β
β One command install, full model presets, done. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
`
---
π Quick Start
`bash
npx -y opencode-openai-codex-multi-auth@latest
`
Then:
`bash
opencode auth login
opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=medium
`
Legacy OpenCode (v1.0.209 and below):
`bash
npx -y opencode-openai-codex-multi-auth@latest --legacy
opencode run "write hello world to test.txt" --model=openai/gpt-5.2-medium
`
Uninstall:
`bash
npx -y opencode-openai-codex-multi-auth@latest --uninstall
npx -y opencode-openai-codex-multi-auth@latest --uninstall --all
`β οΈ Migration Note (Multi-Plan Accounts)
If you used multiple plans or emails under the same ChatGPT accountId on older versions, the
previous matching logic could overwrite entries. To regenerate a clean layout:`bash
rm ~/.config/opencode/openai-codex-accounts.json
opencode auth login
`---
π¦ Models
- 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)
---
π§© Configuration
- Modern (OpenCode v1.0.210+): config/opencode-modern.json
- Legacy (OpenCode v1.0.209 and below): config/opencode-legacy.jsonMinimal configs are not supported for GPTβ5.x; use the full configs above.
---
β¨οΈ Slash Commands (TUI)
In the OpenCode TUI, you can use these commands to manage your accounts and monitor usage:| Command | Description |
|---------|-------------|
|
/codex-status | Shows current rate limits (5h/Weekly), credits, and account status (percent left). |
| /codex-switch-accounts | Switch the active account by its 1-based index from the status list. |
| /codex-toggle-account | Enable or disable an account by its 1-based index (prevents auto-selection). |---
β
Features
- ChatGPT Plus/Pro OAuth authentication (official flow)
- 22 model presets across GPTβ5.2 / GPTβ5.2 Codex / GPTβ5.1 families
- Variant system support (v1.0.210+) + legacy presets
- Multimodal input enabled for all models
- Usageβaware errors + automatic token refresh
- Multi-account support with sticky selection + PID offset (great for parallel agents)
- Account enable/disable management (via opencode auth login manage)
- Strict account identity matching (accountId + email + plan)
- Hybrid account selection strategy (health score + token bucket + LRU bias)
- Optional round-robin account rotation (maximum throughput)
- OpenCode TUI toasts + codex-status / codex-switch-accounts tools
- Authoritative Codex Status: Real-time rate limit monitoring (5h/Weekly) with ASCII status bars
---
π Docs
- Getting Started: docs/getting-started.md
- Configuration: docs/configuration.md
- Multi-Account: docs/multi-account.md
- Troubleshooting: docs/troubleshooting.md
- Architecture: docs/development/ARCHITECTURE.md
---
β οΈ Usage Notice
This plugin is for personal development use with your own ChatGPT Plus/Pro subscription.
For production or multiβuser applications, use the OpenAI Platform API.Credits
- Original implementation and ongoing upstream work: Numman Ali and contributors (
numman-ali/opencode-openai-codex-auth)
- Multi-account strategy + UX inspiration (rotation modes, PID offset approach, toasts): NoeFabris and contributors (NoeFabris/opencode-antigravity-auth`)Built for developers who value simplicity.