This guide covers install, login, migration transfer, and first verification.
- Node.js 22.x
- OpenCode installed and working
Published install:
npx -y @iam-brain/opencode-codex-auth@latestWhat this does:
- Adds
@iam-brain/opencode-codex-auth@latestto resolved<config-root>/opencode.json($XDG_CONFIG_HOME/opencodewhen set, otherwise~/.config/opencode) - Creates
codex-config.jsoncat resolved config root ($XDG_CONFIG_HOME/opencodewhen set, otherwise~/.config/opencode) if missing - Synchronizes
/create-personalitycommand at<config-root>/commands/create-personality.md - Synchronizes
personality-builderskill at<config-root>/skills/personality-builder/SKILL.md
Re-run installer (idempotent):
npx -y @iam-brain/opencode-codex-auth@latest installInstaller flags:
--config <path>: use a customopencode.jsonpath.--plugin <specifier>: override plugin specifier written intoopencode.json.
codex-config.jsonc is created at the default resolved config location when no config exists. To load config from a custom path at runtime, set OPENCODE_OPENAI_MULTI_CONFIG_PATH.
opencode.json should contain plugin enablement only.
Example:
{
"plugin": ["@iam-brain/opencode-codex-auth@latest"]
}Put all plugin behavior flags in:
- resolved
<config-root>/codex-config.jsonc($XDG_CONFIG_HOME/opencodewhen set, otherwise~/.config/opencode) - compatibility fallback:
<config-root>/codex-config.jsonwhencodex-config.jsoncis absent
Use docs/examples/codex-config.jsonc as a baseline.
Use schemas for autocomplete/validation:
schemas/codex-config.schema.jsonschemas/opencode.schema.jsonschemas/codex-accounts.schema.json
opencode auth loginAccount manager highlights:
- Add multiple accounts in one run (
Add new accountreturns to menu) - Check live quotas (
5h,Weekly,Credits) - Receive quota warning toasts at low-remaining thresholds (
25%,20%,10%,5%,2.5%,0%) - Auto-switch accounts when
5horweeklyquota is exhausted - Enable/disable accounts
- Refresh tokens
- Scoped delete and delete-all actions
Legacy import is explicit, not automatic.
If codex-accounts.json is missing and legacy sources exist, the auth menu offers:
Transfer OpenAI accounts from native & old plugins?
Import sources:
- resolved
<config-root>/openai-codex-accounts.json ${XDG_DATA_HOME:-~/.local/share}/opencode/auth.json
opencode run "say hi" --model=openai/gpt-5.4If that model is not available on your account, pick any available openai/* model.
The plugin now tracks the live Codex catalog, so exact GPT-5-family availability still depends on your account's current entitlements.
Add a serviceTier override in codex-config.jsonc:
{
"global": {
"serviceTier": "priority"
}
}This maps to request-body service_tier: "priority" for gpt-5.4* only.
If your host/request already sets service_tier, the plugin leaves it alone.
GPT-5.4 in Codex exposes experimental long-context support via request-level model_context_window and model_auto_compact_token_limit.
Those are not plugin config keys; they come from your OpenCode/request configuration, and the plugin preserves them through request rewriting while clamping them to the currently documented GPT-5.4 long-context limits.
Notes:
- The live Codex catalog still advertises a standard
272000context window forgpt-5.4. - Larger
model_context_windowvalues are explicit request overrides. - The plugin clamps
model_context_windowto1,050,000,model_auto_compact_token_limittomin(922,000, model_context_window - 128,000), andmax_output_tokensto128,000when they are set ongpt-5.4*requests. - The
922,000ceiling is the full-window practical safe-input budget derived from the documented1,050,000total context window minus the documented128,000max output budget. - If you request a smaller
model_context_window, the plugin preserves the same output headroom by clampingmodel_auto_compact_token_limittomodel_context_window - 128,000. - OpenAI's current GPT-5.4 guidance says prompts above the standard
272,000input window are billed at higher long-context rates.
Run:
/create-personalityThis guided flow writes a profile into:
.opencode/personalities/<key>.md(project scope), or<config-root>/personalities/<key>.md(global scope)
Runtime mode is configured in codex-config.jsonc.
native: defaultcodex
Prompt cache key strategy is also configurable under runtime.promptCacheKeyStrategy:
default: keeps upstream session-based keyingproject: uses a project-path + mode hash
Managed templates are synchronized at plugin startup:
/create-personalitycommand is refreshed to the managed latest templatepersonality-builderskill bundle is refreshed to the managed latest template- pinned Codex prompts cache is refreshed best-effort (
codex-prompts-cache*.json) - orchestrator agent visibility is reconciled based on effective collaboration profile
npm install
npm run buildThen use a file plugin path in your local opencode.json:
{
"plugin": ["file:///absolute/path/to/opencode-codex-auth/dist"]
}