pi-auth-profiles
v0.1.2
Published
Auth profile switching for pi — save and switch between named credential profiles via slash commands
Maintainers
Readme
pi-auth-profiles
Save and switch between named credential profiles in pi without leaving your session.
Install
pi install npm:pi-auth-profilesOr for a single run:
pi -e npm:pi-auth-profilesUsage
Save the current credentials as a profile
/auth-save workCopies ~/.pi/agent/auth.json → ~/.pi/agent/auth.json.work.
Switch to a saved profile
/auth-switch personalCopies the profile back to auth.json and reloads credentials in-memory. Your session context, ACM state, and conversation history are completely unaffected.
List saved profiles
/auth-listShows all profiles with their providers and marks which one matches the active credentials.
Delete a profile
/auth-delete workRemoves the profile file after confirmation.
How it works
~/.pi/agent/
├── auth.json ← active credentials (what pi reads)
├── auth.json.work ← saved profile
├── auth.json.personal ← saved profile
└── ...Profiles are full copies of auth.json. Switching replaces the entire file and calls authStorage.reload() to update pi's in-memory credential cache immediately.
- Same provider, different accounts (e.g., two Anthropic subscriptions): seamless switch, session continues.
- Different providers (e.g., Anthropic → OpenAI): auth switches, but you may need to
/modelto select a model from the new provider.
Notes
- Profile files are stored with mode
0600(owner read/write only) - Tab completion works on
/auth-switchand/auth-delete - OAuth tokens in saved profiles may expire — pi handles refresh automatically on next use
