OpenCode plugin for OpenAI ChatGPT OAuth with multi-account management, Codex-compatible request modes, and dynamic model behavior controls.
Quick links: Getting Started · Configuration · Multi-account · Troubleshooting · Persona Tool
- Uses ChatGPT OAuth instead of API keys for OpenAI provider flows.
- Keeps account rotation state in a plugin-owned store (
codex-accounts.json). - Supports
nativeandcodexruntime modes. - Adds account-manager UX to
opencode auth login(quotas, toggles, scoped deletes, transfer).
Install and register the plugin (recommended):
npx -y @iam-brain/opencode-codex-auth@latestThen authenticate:
opencode auth loginUse an OpenAI model through OpenCode:
opencode run "say hi" --model=openai/gpt-5If that model is unavailable on your account, use any available openai/* model.
This plugin is intended for personal development use with your own ChatGPT account. For production multi-user systems, use the OpenAI Platform API.
By default, npx -y @iam-brain/opencode-codex-auth runs the installer.
The installer does four things:
- Ensures
@iam-brain/opencode-codex-auth@latestis present in~/.config/opencode/opencode.json. - Creates
~/.config/opencode/codex-config.jsonwith defaults when missing. - Synchronizes
~/.config/opencode/commands/create-personality.mdfor/create-personality(created/updated as needed). - Synchronizes
~/.config/opencode/skills/personality-builder/SKILL.md(plus references) for skill-driven personality workflows.
At plugin startup, managed templates are synchronized to the latest version:
/create-personalitycommand templatepersonality-builderskill bundle
Re-run installer (idempotent):
npx -y @iam-brain/opencode-codex-auth installKeep opencode.json minimal (plugin enablement only). Put runtime behavior in:
~/.config/opencode/codex-config.json
Canonical config/env docs (complete key + variable reference) are in docs/configuration.md.
Schemas for user-edited JSON files are in:
schemas/codex-config.schema.jsonschemas/opencode.schema.jsonschemas/codex-accounts.schema.json(advanced/manual recovery)
Personality files live in lowercase directories:
- project-local:
.opencode/personalities/ - global:
~/.config/opencode/personalities/
Create guided custom personalities with:
/create-personalitynative: native-plugin style identity/headers.codex: codex-rs style identity/headers.
- Provider auth marker:
~/.local/share/opencode/auth.json - Plugin multi-account store:
~/.config/opencode/codex-accounts.json - Session affinity cache:
~/.config/opencode/cache/codex-session-affinity.json - Quota snapshot cache:
~/.config/opencode/cache/codex-snapshots.json
Legacy sources can be imported explicitly from the auth menu:
~/.config/opencode/openai-codex-accounts.json~/.local/share/opencode/auth.json
- Docs portal
- Getting started
- Configuration
- Compaction
- Multi-account
- Troubleshooting
- Persona tool
- Development docs
- Upstream baseline/sync
npm install
npm run verify