← Catalog

@hcflabs/pi-multi-codex

Use multiple ChatGPT Codex OAuth accounts in Pi.

Package

Install

Install with PiG

pig install npm:@hcflabs/pi-multi-codex

Install with Pi

pi install npm:@hcflabs/pi-multi-codex
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "image": "https://raw.githubusercontent.com/hcflabs/pi-harness/main/extensions/pi-multi-codex/example.png",
  "extensions": [
    "./extensions"
  ]
}

README

Written by the package's publisher, shown as published in version 3.2.6 (README.md). PiG does not review it.

@hcflabs/pi-multi-codex

Use multiple ChatGPT Codex OAuth accounts with quota-based selection and HTTP 429 failover.

Pi showing Codex account quotas and the active footer slot Flowchart separating fresh-quota startup ranking from broader HTTP 429 failover

Install

pi install npm:@hcflabs/pi-multi-codex

Works with

PackageRelationshipPurpose
@hcflabs/pi-footerImprovesShows the active slot's quota status.
@hcflabs/pi-subagentImprovesDelegated children keep Main's active Codex slot.
@hcflabs/pi-task-modelsImprovesNumbered 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.

SurfaceTypePurpose
/codex-addcommandCreate the next numbered slot for authentication.
/codex-statuscommandShow shared usage snapshots and five-hour quota blocks without network waits.
/codex-switchcommandSelect an authenticated, scope-allowed slot for the current Codex model.
Pi model selector (OpenAI Codex (legacy), OpenAI Codex #<n>)uiChoose an authenticated account slot.
Pi status pi-multi-codexuiShow active fresh quota, five-hour limit countdown, or stale/unavailable state. @hcflabs/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

NameDescriptionValuesDefault
autoSwitchOn429Switch 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.