Sign in to OpenCode with your ChatGPT Plus/Pro subscription and start routing
Codex/GPT-5/GPT-6 models through oc-codex-multi-auth.
- OpenCode installed
- A ChatGPT Plus or Pro subscription
- Node.js
>=22.19for the installer
Personal use with your own subscription only. For production workloads use the OpenAI Platform API.
npx -y oc-codex-multi-auth@latest --modern--modern registers the plugin and writes the compact model catalog: 14 base
model families with 77 variants selectable through --variant. Alternatives:
| Flag | Use it when |
|---|---|
| (none) | OpenCode already supplies the model entries you need; registers the plugin only |
--full |
You also want explicit selector IDs such as openai/gpt-5.5-medium |
--legacy |
Older OpenCode that needs explicit-only entries |
--v2 |
OpenCode 2.0.16+ — see README V2 section |
--dry-run |
Preview the changes first |
Config files may be opencode.json or opencode.jsonc — comments and
trailing commas are fine, and the installer merges into the .jsonc file when
that is your effective config. It refuses to overwrite a config it cannot
parse — a JSONC file with an unterminated block comment is refused rather
than truncated. Rerun with update to refresh the cached package without
touching config at all.
opencode auth loginChoose OpenAI, then one of the four plugin OAuth methods:
Codex OAuth (ChatGPT Plus/Pro)— opens your browser; sign-in completes through a localhost callbackCodex OAuth (Open URL Manually)— prints the authorization URL; open it in any browser and the localhost callback still completes the loginCodex OAuth (Device Code)— for SSH/headless sessions without a browserCodex OAuth (Manual URL Paste)— paste the full callback URL, including itsstateparameter, after logging in elsewhere
The browser methods use the same callback port as Codex CLI: the local server
binds http://127.0.0.1:1455/auth/callback (and [::1]:1455), and the
authorize redirect is http://localhost:1455/auth/callback. Authorization and
token exchange go to auth.openai.com.
Run opencode auth login again per account to build a multi-account pool.
The shared global pool is used by default. Set CODEX_AUTH_PER_PROJECT_ACCOUNTS=1
or perProjectAccounts: true to opt into per-project storage, then log in from
the directory where you use OpenCode.
In OpenCode V2, the plugin service does not open a browser. Interactive
opencode auth login opens the authorization URL; in the TUI, press o or
open the displayed URL yourself. The localhost callback listener runs on the
service host. If the client and service are on different machines, choose
Device Code or Manual URL Paste before starting login unless port 1455 is
forwarded from the browser's machine to the service host.
- If port 1455 is reachable — including through
ssh -L 1455:localhost:1455 user@remote— useCodex OAuth (Open URL Manually)and open the printed URL anywhere. - If localhost is not reachable (containers, restricted networks), use
Codex OAuth (Device Code). - If device code is unavailable, fall back to
Codex OAuth (Manual URL Paste)and paste the complete callback URL.
oc-codex-multi-auth status # accounts + which storage file is in use
oc-codex-multi-auth doctor # config and credential diagnostics
opencode run "Summarize this repo" --model=openai/gpt-5.5 --variant=medium--variant presets exist only after a catalog install (--modern, --full,
or --legacy); after a plugin-only install, use the model entries OpenCode
itself provides.
There is no uninstall command — removal is manual:
- Delete the
oc-codex-multi-authplugin entry the installer added to~/.config/opencode/opencode.json(thepluginlist, orpluginsfor V2) and to~/.config/opencode/tui.json. - Optionally remove the model entries the catalog modes wrote to
provider.openai.modelsin the same file. - Runtime state stays under
~/.opencode(account pools, config, caches, logs). Leave it for a later reinstall, or delete it following privacy.md.
Restart OpenCode afterward; the plugin's entry point is only loaded at startup.
Requests go to the ChatGPT-backed Codex endpoint and stay stateless: every
body carries store: false and includes reasoning.encrypted_content for
multi-turn continuity. GPT-6 and GPT-5.6 models additionally use the
responses-lite request shape. The shipped templates in
config/ already encode all of this.
- tools-and-cli.md — the 25
codex-*tools and standalone commands - configuration.md — plugin config keys and env overrides
- upgrade.md — package renames and storage migration
- troubleshooting.md — when something breaks
- faq.md — short answers