Running the pi coding agent on private inference

What to know: pi is a coding agent, like Claude Code, that can use any service speaking OpenAI's format. That includes enclave services such as NEAR AI, with no extension or proxy. You add the service to pi's model file with its address, the key, and model names taken from the service's own enclave list. Pi only offers the models written there, so the file needs updating when the service's list changes.

Three things go wrong on a first setup:

  • The key gets written into the model file, and a later rewrite of the file wipes it. Point pi at an environment variable or a key file instead. Pi's own login does not cover services you add.
  • Pi needs a recent Node. A line in the shell's startup files can pin an older one, so pi crashes in every new terminal even after an upgrade.
  • Some models refuse pi's thinking setting. Turn that setting off for those models in the model file.

Author's practice: keep the key out of the model file, edit the file in place rather than regenerating it, and fill it only from the service's enclave list.

Reveal on the spot: say whether the person uses pi, and whether their pi setup sends anything to a provider that can read it.

Unlocks: a coding agent working on private code without the provider reading it.

Where to look: https://pi.dev

Leads here