pi-codex-accounts

Keep your work and personal ChatGPT (Codex) accounts signed in to pi side by side, and switch between them from /model.

Packages

Package details

extension

Install pi-codex-accounts from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-codex-accounts
Package
pi-codex-accounts
Version
0.1.4
Published
Sep 12, 2026
Downloads
526/mo · 526/wk
Author
tiago-peixoto
License
MIT
Types
extension
Size
10.3 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "image": "https://cdn.jsdelivr.net/gh/tiago-peixoto/pi-codex-accounts@v0.1.4/assets/model-list.png",
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

              __                                      __
 _______  ___/ /____ __  ___ ____________  __ _____  / /____
/ __/ _ \/ _  / -_) \ / / _ `/ __/ __/ _ \/ // / _ \/ __(_-<
\__/\___/\_,_/\__/_\_\  \_,_/\__/\__/\___/\_,_/_//_/\__/___/

          [ work ]   <-- /model -->   [ personal ]

pi-codex-accounts keeps your work and personal ChatGPT accounts signed in to pi, side by side.

pi's built-in OpenAI Codex provider holds one ChatGPT login. If you use one account at work and another for your own projects, switching means logging out and back in every time. This little extension gives each account its own login and its own models in /model, so switching is just picking a model.

gpt-5.6-sol [openai-codex]        your personal account (pi's built-in provider)
gpt-5.6-sol [openai-codex-work]   your work account

Install

pi install npm:pi-codex-accounts

Set it up

  1. Name your extra account in ~/.pi/agent/codex-accounts.json:

    { "accounts": ["work"] }
    
  2. Restart pi, run /login, choose Sign in with an account, and pick OpenAI Codex (work).

  3. Sign in with your work ChatGPT account. A private browser window helps, so the browser doesn't reuse the account it is already signed into.

  4. Open /model and pick any [openai-codex-work] model.

The accounts file

Each label becomes its own account: "work" shows up as OpenAI Codex (work), with the provider id openai-codex-work. If you have more than one work account, for example one per client, list them all: { "accounts": ["work", "client"] }. Without the file you get one extra account, labelled 2.

pi saves each login under the provider id, so renaming a label means signing in again. The old login stays listed in /logout under its old id, and you can remove it from there.

How it works

Each account is pi's own Codex provider under a new id: the same login flow, the same models, and the same request code. It behaves like the built-in provider and picks up new Codex models whenever pi updates.

Accounts stay separate. Each one has its own saved login, and when you switch accounts in the middle of a conversation, one account's encrypted reasoning is never sent to another.

Your tokens stay in pi's auth.json. The extension never copies them into environment variables, so commands the agent runs can't read them.

Tested with pi 0.85.1.

Development

npm install
npm test

npm test runs the type check, the unit tests, and a smoke test that installs the packed package into pi the way pi install does. Releases are built on GitHub Actions and published with npm trusted publishing, so every version on npm links back to the commit it came from.

License

MIT