---
title: "@henryqw/pi-multi-codex"
seo:
  description: "Use multiple ChatGPT Codex OAuth accounts in Pi."
---

<div class="not-prose my-6 flex flex-wrap items-center gap-3"><span class="text-sm text-muted-foreground">v0.3.19</span><a href="https://www.npmjs.com/package/@henryqw/pi-multi-codex" aria-label="View @henryqw/pi-multi-codex on npm"><img alt="Monthly npm downloads" height="20" src="https://img.shields.io/npm/dm/%40henryqw%2Fpi-multi-codex?cacheSeconds=7200&amp;color=1d4ed8&amp;label=downloads&amp;labelColor=101828&amp;style=flat-square" width="144"></a></div>

Use multiple ChatGPT Codex OAuth accounts in Pi.

![Pi showing Codex account quotas and the active footer slot](https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-multi-codex/example.png)

## Why

- **Created for**: Use multiple ChatGPT Codex OAuth accounts from one Pi installation.
- **Advantage**: Before work starts, quota-aware routing selects the eligible managed slot with the most remaining seven-day quota. It does not change in-progress sessions.

## Install

```bash
pi install npm:@henryqw/pi-multi-codex
```

## With

| Package | Why |
| --- | --- |
| `@henryqw/pi-footer` | Improves. Shows the active slot's quota or five-hour block in the footer. |
| `@henryqw/pi-subagent` | Improves. Isolated children keep Main's active Codex slot. |
| `@henryqw/pi-task-models` | Improves. Numbered slots share one profile route. |

## Use

| Surface | Type | Purpose |
| --- | --- | --- |
| `/codex-add` | command | Create the next numbered slot, then authenticate that slot. |
| `/codex-status` | command | Show shared quota snapshots and five-hour blocks. Never waits on network. |
| `/codex-switch` | command | Pick an authenticated slot. |

A numbered slot is one Codex account position in Pi.

- The extension reads `auth.json`. It never writes or refreshes credentials.
- Before the first agent start, a fresh snapshot routes a managed Codex model to the eligible slot with the most seven-day quota.
- A slot whose reported five-hour window has reached 100% is excluded until that window resets.
- Routing preserves model ID and never changes in-progress work.
- The footer shows the active slot's fresh quota or five-hour block.
- Scoped sessions can switch only to exact scoped aliases.
- Restart or update model scope after adding a slot.

Generated credential-free quota cache: `~/.pi/agent/config/pi-multi-codex/usage.json`. The extension maintains it.
