Skip to content
LUNAROUTEDocs

Pi

pi needs no config file from you. LunaRoute ships as a pi extension (@lunaroute/pi-extension) that registers the gateway as a provider and syncs models from /v1/models; the CLI installs it, and the credential lives in pi’s own ~/.pi/agent/auth.json.

Terminal window
npx @lunaroute/cli setup pi

It runs pi install npm:@lunaroute/pi-extension for you. That is the whole configuration: the extension registers the LunaRoute provider and pulls the model list at runtime, so nothing is written into pi’s settings and no model list goes stale.

Two things it will ask:

  • Decline the extension install and setup falls back to merging a providers.lunaroute block into ~/.pi/agent/models.json (backup kept, your other providers preserved). That path writes the key into the file, so it needs you logged in first — and it does not sync models later.
  • --key skips the browser step: npx @lunaroute/cli setup pi --key lr_… --yes verifies the key, installs the extension, and stores the key in ~/.pi/agent/auth.json.

pi itself must already be on your PATH, version 0.84.1 or newer — this installs the extension, not pi:

Terminal window
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
Terminal window
pi

Then, inside pi:

/login lunaroute # browser login, if setup carried no key
/model # pick a lunaroute/* model

Models sync from /v1/models on your first interactive run, so a scripted pi -p start before that finds no catalog. After the first run new models appear on refresh, and /model lists every model your organization serves.

Terminal window
pi remove npm:@lunaroute/pi-extension

That drops the extension and its provider; pi is back to its previous configuration. Signing out is separate — delete the lunaroute entry from ~/.pi/agent/auth.json, or replace it with a fresh /login lunaroute. A providers.lunaroute block left over from the models.json path has to go from that file by hand. lunaroute logout clears the CLI’s own stored credential (in ~/.config/lunaroute/), which nothing on this page needs once pi is signed in.

There is no one-session lunaroute run pi today; run covers Claude Code, Codex and Zed.

Terminal window
curl https://gw.lunaroute.com/v1/models \
-H "Authorization: Bearer $LUNAROUTE_API_KEY"
  • CLI — install, run, setup, and the Windows/WSL notes.
  • Harness setup — the other harnesses, and the MCP server.
  • OpenCode — the other extension-first harness.