pi-seat

Named multi-account manager for Pi: exclusive OAuth profile store, per-session pinning via PI_SEAT, and terminal usage meters for Anthropic and OpenAI Codex

Packages

Package details

extension

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

$ pi install npm:pi-seat
Package
pi-seat
Version
0.3.0
Published
Aug 27, 2026
Downloads
683/mo · 10/wk
Author
ohlulu
License
MIT
Types
extension
Size
203.5 KB
Dependencies
1 dependency · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/extension/index.ts"
  ]
}

Security note

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

README

pi-seat

English | 繁體中文 | 日本語 | Español | Français

Named multi-account manager for Pi — switch between Anthropic and OpenAI Codex OAuth accounts per session, with usage meters in your terminal.

  • Named profileswork, personal, team… each holding its own OAuth grant in an exclusive store. Pi's own auth.json is never written.
  • Session pinning — run two Pi sessions on two different accounts at the same time via the PI_SEAT env var.
  • Usage meters — 5-hour and weekly usage bars for every profile, right in the CLI. Bars are coloured by burn rate, not level: red when the current pace projects past the limit before the window resets, yellow when it is close, green when there is room to spare.
  • Fail-closed — if a credential cannot be refreshed and verified, turns on that provider abort. No request ever rides a stale or wrong account, and a dead profile never blocks a turn running on another provider.

Requirements

  • bun
  • Pi with Anthropic and/or OpenAI Codex OAuth login

Install

pi install npm:pi-seat    # extension — adds /seat to Pi

That is the whole install. /seat covers every command: login, use, rm, rename, status, whoami, usage.

The extension imports nothing from the CLI, so add one only for what /seat structurally cannot do — --plain / --json output for a shell prompt segment, and reading usage without starting a Pi session.

pi install already placed a working executable at ~/.pi/agent/npm/node_modules/.bin/seat; it is simply not on your PATH. Link it into a directory that is:

ln -sf ~/.pi/agent/npm/node_modules/.bin/seat /usr/local/bin/seat

bun add -g pi-seat also works, but it downloads the same package a second time and leaves you two installs to keep in sync.

git clone https://github.com/ohlulu/pi-seat.git && cd pi-seat && bun install

Add the repo path to packages in ~/.pi/agent/settings.json. For the optional CLI, put a seat shim on your PATH:

printf '#!/bin/sh\nexec bun /path/to/pi-seat/src/cli/main.ts "$@"\n' > /usr/local/bin/seat
chmod +x /usr/local/bin/seat

Quick start

Inside a Pi session:

/seat login work        # mint a new OAuth grant, store it as "work"
/seat use work          # make "work" the global default
/seat use work -a w     # …and point the alias "w" at it
/seat status            # usage meters, default and pin — ↑↓ select, enter switch, esc/q close

/seat and /seat status open an interactive usage view in a TUI session, and fall back to plain text everywhere else (RPC, pi -p). In the view, ↑↓/jk move between accounts and enter makes the highlighted one that provider's default — selecting a built-in row hands the provider back to Pi's own login.

Pin a session to an account (overrides the default, this session only):

PI_SEAT=work pi         # bare label = anthropic
PI_SEAT="anthropic:work,openai-codex:team" pi

Check usage from the shell:

seat                    # usage bars for all profiles
seat status --plain     # TSV output for shell prompts

use default clears the default and restores Pi's built-in login. rm, rename, and repeatable -a <alias> (on both login and use) work as expected.

How it stays safe

Profiles live in ~/.pi/agent/seat.json (0600, file-locked, atomic writes). Every profile owns an exclusive OAuth grant — credentials are never copied from or into Pi's auth.json, because Anthropic refresh tokens are single-use and a shared grant would double-spend. Token refreshes are single-flight across processes.

License

MIT. Credential lifecycle layer adapted from pi-accounts (MIT) — see NOTICE.