Usage
The 1-based index of the account to activate. Shown in
codex auth list output.How It Works
- Loads the account at the specified index (1-based)
- Updates the active account pointer in storage
- Syncs the selection to Codex CLI state
- All future API requests use the new active account
Examples
Switch to first account
Switch to third account
Switch and verify
Index Validation
The command validates the index before switching:Invalid Index (Too High)
Invalid Index (Zero or Negative)
Non-Numeric Index
Account Selection Priority
When you switch accounts, the plugin uses the new account for:- Immediate requests - Next API call uses the switched account
- Session affinity - Conversations continue with the same account
- Forecast fallback - If switched account fails, forecast picks the next best
Syncing with Codex CLI
The switch command updates both:- Multi-auth storage:
~/.codex/multi-auth/openai-codex-accounts.json - Codex CLI state:
~/.codex/cli/state.json
Exit Codes
Success - account switched
Error - invalid index, no accounts, or storage failure
Related Commands
codex auth list- Show account indicescodex auth status- Verify active accountcodex auth check- Validate switched account healthcodex auth forecast- Find best account to switch to
Dashboard Alternative
You can also switch accounts in the interactive dashboard:Per-Family Active Index
If you use multiple model families (e.g.,gpt-5-codex and gpt-5-turbo), each family can have a different active account.
The switch command updates the active index for all families by default.
To switch only for the current model family, use the dashboard’s per-family switching.