@henryqw/pi-multi-codex3.2.1
Use multiple ChatGPT Codex OAuth accounts in Pi.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@henryqw/pi-multi-codex
Use multiple ChatGPT Codex OAuth accounts with quota-based selection and HTTP 429 failover.
Install
pi install npm:@henryqw/pi-multi-codex
Works with
| Package | Relationship | Purpose |
|---|---|---|
@henryqw/pi-footer |
Improves | Shows the active slot's quota status. |
@henryqw/pi-subagent |
Improves | Isolated children keep Main's active Codex slot. |
@henryqw/pi-task-models |
Improves | Numbered slots share one profile route. |
Use
Run /login and authenticate OpenAI Codex (legacy) for slot 1. Run /codex-add, then /login and select OpenAI Codex #<n>. Restart Pi or update model scope. Run /codex-status to verify the new account slot.
Commands and UI entries are for users.
| Surface | Type | Purpose |
|---|---|---|
/codex-add |
command | Create the next numbered slot for authentication. |
/codex-status |
command | Show shared usage snapshots and five-hour quota blocks without network waits. |
/codex-switch |
command | Select an authenticated, scope-allowed slot for the current Codex model. |
Pi model selector (OpenAI Codex (legacy), OpenAI Codex #<n>) |
ui | Choose an authenticated account slot. |
Pi status pi-multi-codex |
ui | Show active fresh quota, five-hour limit countdown, or stale/unavailable state. @henryqw/pi-footer displays it. |
Status stays unavailable until a successful usage snapshot. Footer and command reset countdowns use five hours for Free, Go, and Plus; seven days for Pro Lite and other tiers.
Flow
Eligible slots must be authenticated, registered, and scope-allowed, without known active five-hour quota blocks.
Before first agent work, the extension selects the eligible slot with the most fresh remaining quota. It repeats this selection before later starts only for a known active five-hour quota block. Explicit model selection wins for the next agent start.
After HTTP 429, it tries fresh known quota first, then slots with stale or missing quota in slot-number order. It tries each eligible slot at most once per agent run; retries stop when none remain.
Routing preserves physical model IDs. Virtual openai-codex models, such as openai-codex/auto, receive neither account-slot routing nor quota status.
Config
Package-owned: ~/.pi/agent/config/pi-multi-codex/config.json
| Name | Description | Values | Default |
|---|---|---|---|
autoSwitchOn429 |
Switch slots after HTTP 429. Set false to disable this switching. |
Boolean. | true |
Edit config manually; changes apply at the next session start. The extension never writes it; missing files use the default.
Startup warnings identify unknown keys, invalid values, and file paths. Unknown keys are ignored. Non-boolean or misspelled autoSwitchOn429, such as autoswitchOn429, disables HTTP 429 switching for the session.
Malformed JSON, invalid UTF-8, files above 64 KiB, read errors, and non-object roots also disable this switching with warnings. Fix the unchanged file and start a new session.
State and storage
Generated, credential-free quota cache: ~/.pi/agent/config/pi-multi-codex/usage.json.
Limits and recovery
The extension identifies slots from auth.json without directly editing credentials. Pi's auth resolver supplies quota-check tokens and can refresh expired OAuth credentials, updating its auth store.
Scoped sessions can switch only to exact scoped aliases.