pi-codex-multi

Pi extension for multiple ChatGPT Plus/Pro Codex OAuth subscriptions with failover pools

Packages

Package details

extension

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
1.3.4
Published
Aug 8, 2026
Downloads
438/mo · 158/wk
Author
saammaaeel
License
MIT
Types
extension
Size
171.4 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-codex OAuth subscriptions (openai-codex-2, openai-codex-3, ...)
  • /subs account management and Codex quota snapshots
  • Rotation pools with round-robin, quota-first, scheduled, and custom strategies
  • round-robin switches 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

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.

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 }
      ]
    }
  ]
}

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