Install
Install with PiG
pig install npm:pi-sub-aliasesInstall with Pi
pi install npm:pi-sub-aliasesPackages 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/alexei-led/pi-sub-aliases/main/assets/alias.png",
"extensions": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.2.4 (README.md). PiG does not review it.
pi-sub-aliases
Use multiple Claude and ChatGPT subscriptions in Pi without logging in and out of the
built-in anthropic and openai-codex providers.
Pi has one OAuth slot per provider id. This extension creates named provider aliases. Each alias reuses Pi's built-in OAuth flow and live model catalog, but stores credentials separately.
Example result:
anthropic-work/claude-opus-4-8
anthropic-personal/claude-sonnet-4-6
openai-codex-work/gpt-5.5
The active alias is also exposed to extension status integrations such as
pi-powerline-footer under the status key sub-aliases:
claude-work · opus-4.8
codex-work · gpt-5.5
Requirements
Pi 1.x starting at 1.5.2 (tests use Pi 1.5.2 dependencies). Aliases reuse Pi's own built-in OAuth flows and model catalog on a stock install.
Install
pi install npm:pi-sub-aliases
For local development:
pi install /absolute/path/to/pi-sub-aliases
Config
Create ~/.pi/agent/sub-aliases.json:
{
"aliases": [
{ "slug": "work", "label": "Work", "handle": "claude-work" },
{ "slug": "personal", "label": "Personal", "handle": "claude-me" },
{ "provider": "openai-codex", "slug": "work", "label": "Codex Work" }
]
}
Optional project override (merged over global config in trusted projects):
.pi/sub-aliases.json
Rules:
provideris"anthropic"(default) or"openai-codex"slugcreates the provider id:anthropic-<slug>oropenai-codex-<slug>labelis shown during OAuth login (defaults to the title-cased slug)handleis used by integrations such aspi-fusion; defaults toclaude-<slug>orcodex-<slug>per provider- later entries with the same
(provider, slug)replace earlier ones (this is how project config overrides global); the same slug may be reused across providers - handles must be unique across global and project config files
Models and metadata (context window, max tokens, cost) are cloned from Pi’s effective model registry when a session starts and on model selection or turns. New models from Pi’s catalog or configuration appear after the next refresh event. Initial registration uses Pi’s bundled catalog before the session registry is available.
Use
Login once per alias:
/login anthropic-work
/login openai-codex-work
Select models normally:
/model anthropic-work/claude-opus-4-8
/model openai-codex-work/gpt-5.5
pi-fusion can use handles as shorthand:
{ "model": "claude-work/opus-4.8" }
For openai-codex aliases the extension also keeps the Codex environment
(OPENAI_CODEX_*, CHATGPT_ACCOUNT_ID) in sync with the selected alias account, so
pi-sub-bar tracks the active subscription.
Migration
From pi-claude-alias
- Package renamed: replace
npm:pi-claude-aliaswithnpm:pi-sub-aliasesin~/.pi/agent/settings.json. - Config file renamed: move
~/.pi/agent/claude-alias.jsonto~/.pi/agent/sub-aliases.json(same schema;provideris optional and defaults toanthropic). There is no legacy fallback. - Footer status key renamed:
claude-alias→sub-aliases. - Provider ids are unchanged (
anthropic-<slug>), so stored OAuth credentials andmodel-router.jsonpatterns keep working — no re-login needed.
From @carlosgtrz/pi-codex-aliases
- Replace
npm:@carlosgtrz/pi-codex-aliaseswithnpm:pi-sub-aliasesand declare your Codex accounts insub-aliases.jsonwith"provider": "openai-codex". - Provider ids are unchanged (
openai-codex-<slug>), so stored OAuth credentials keep working — no re-login needed. - Model metadata is cloned live from Pi's registry, so alias models no longer drift from the built-in catalog.
Non-goals
No proxy. No router. No failover. No quota logic. Just separate OAuth slots with useful names.
Attribution
The Codex stream wrapper (src/codex-stream.ts) and Codex env sync
(src/codex-env.ts) are derived from
CarlosGtrz/carlosgtrz-pi-extensions
(MIT).