pi-codex-multi
Pi extension for multiple ChatGPT Plus/Pro Codex OAuth subscriptions with failover pools
Package details
Install pi-codex-multi from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-codex-multi- Package
pi-codex-multi- Version
2.0.1- Published
- Aug 25, 2026
- Downloads
- 462/mo · 54/wk
- Author
- saammaaeel
- License
- MIT
- Types
- extension
- Size
- 182.6 KB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./extensions/multi-sub.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-codex-multi
Pi extension exclusively for ChatGPT Plus/Pro subscriptions through OpenAI Codex OAuth. Add multiple Codex accounts and rotate them through failover pools.
Install
Install from npm:
pi install npm:pi-codex-multi
For development, install directly from the fork:
pi install git:github.com/thelastbodhisattva/pi-codex-multi
Features
- Multiple
openai-codexOAuth subscriptions (openai-codex-2,openai-codex-3, ...) /subsaccount management and Codex quota snapshots- Rotation pools with
round-robin,quota-first,scheduled, andcustomstrategies round-robinswitches to the next eligible account before each external user turn; extension-injected failover retries do not consume another slot.- Fallback chains and Codex-only model presets
- Project-level allow-lists and pool/chain overrides
- Retry progress preserved across failover attempts
- Failover cascade tries every eligible candidate before giving up (bounded
by the optional
maxRetriessetting, default 3; previously the bound was the implicit pool size) - Transient provider overload ("overloaded"/"capacity"/5xx) rotates once without marking the account exhausted; only genuine per-account limits (429/quota/usage-limit wording) trigger cooldowns
- Exhaustion cooldowns honor
Retry-Afteror the account's known quota reset when available (clamped to 60s–30min, otherwise a 5-minute fallback), and survive restarts via~/.pi/agent/multi-pass.state.json
This fork does not register Anthropic, GitHub Copilot, Gemini CLI, Antigravity, or arbitrary providers. Legacy non-Codex config entries are ignored rather than causing startup failures.
Security notes
- Custom pool selector scripts (
selectorScript) are honored only from the global config (~/.pi/agent/multi-pass.json). Project-level.pi/multi-pass.jsonfiles haveselectorScriptstripped during load, so a checked-in project file cannot execute arbitrary code. Breaking change: pools that previously definedselectorScriptin project config must move that setting to the global config.
Quick start
/subs add # choose OpenAI Codex and label the account
/subs login # runs OAuth for the selected subscription
/subs limits
/pool create
/subs login now runs the OAuth flow and stores credentials for the selected provider (for example openai-codex-2). /login openai-codex-2 remains available as Pi's native equivalent. When an account hits a rate limit, the extension retries with the next eligible Codex account in its pool or chain.
Configuration
Global: ~/.pi/agent/multi-pass.json
Project overrides: .pi/multi-pass.json
{
"subscriptions": [
{ "provider": "openai-codex", "index": 2, "label": "work" }
],
"pools": [
{
"name": "codex-pool",
"baseProvider": "openai-codex",
"members": ["openai-codex", "openai-codex-2"],
"enabled": true,
"strategy": "round-robin"
}
],
"presets": [
{
"name": "coding",
"enabled": true,
"entries": [
{ "provider": "openai-codex", "model": "gpt-5.4", "enabled": true }
]
}
],
"maxRetries": 3
}
maxRetries bounds how many failover switch attempts one cascade may make
across pool members and chain entries (default 3).
Restrict a project to exact Codex accounts:
{ "allowedSubs": ["openai-codex-2"] }
Optional environment configuration:
export MULTI_SUB="openai-codex:2"
Commands
/subs— add, remove, login, logout, switch, list, status, and limits/pool— create, list, inspect, toggle, remove, and configure project pools/chains/mp-preset— create, activate, list, toggle, and remove Codex model presets
Pool strategies
/pool create asks for a strategy; existing pools expose it through their action menu. The default is round-robin. Other choices are quota-first, scheduled, and custom.
Codex quota support
/subs limits reads ChatGPT/Codex usage from https://chatgpt.com/backend-api/wham/usage (or CHATGPT_BASE_URL) and reports the five-hour and seven-day subscription windows for each logged-in Codex account.
License
MIT