npm.io
0.1.1 • Published 11h ago

pi-login-manager

Licence
MIT
Version
0.1.1
Deps
0
Size
58 kB
Vulns
0
Weekly
0

pi-login-manager

A Pi extension that registers third-party model vendors and manages their logins — one adapter per vendor, credentials stored by pi itself in ~/.pi/agent/auth.json.

Vendors

Provider id Auth paths Notes
commandcode Browser OAuth (localhost callback) or paste API key Static model catalog registered instantly, upgraded to the live catalog in the background
r4coder Paste API key (r4.codes dashboard login is not automatable — Cloudflare Turnstile) Static 10-model catalog, compat.sendSessionAffinityHeaders preserved

Install

pi install npm:pi-login-manager

Or try it without installing:

pi -e npm:pi-login-manager

Usage

After installing, pi loads the extension on session start and both providers are registered automatically. Then:

/login commandcode   # browser OAuth, or paste a key
/login r4coder       # paste the coder_* key from the r4.codes dashboard

Credentials are stored by pi in ~/.pi/agent/auth.json — the same place pi's native logins live. No plaintext keys in models.json, no scraping.

Credential expiry

When a stored credential is expired or near expiry, the extension says which vendor expired and how to re-login, instead of leaving you with a raw 401.

Legacy models.json migration

If your ~/.pi/agent/models.json still defines r4coder with a plaintext apiKey, the extension warns on session start (models.json entries shadow registered providers). Delete that entry — after one /login r4coder the key lives in auth.json and models.json can go.

Requirements

  • Pi coding agent
  • Node 22+ (pi's bundled runtime)

What this is not

  • No usage/billing surface (see docs/adr/); use a usage extension for that
  • No dashboard scraping; R4 login is intentionally paste-key only

License

MIT

Keywords