What the extension does
Pi reads custom OpenAI-compatible providers from ~/.pi/agent/models.json. Hand-editing that file works, but the model list goes stale the day a model is added or retired.
The official extension registers anyrouter as a provider and refreshes the catalog from https://anyrouter.dev/api/v1, so /model in pi lists what AnyRouter can route that day. It delegates streaming to pi's built-in openai-completions implementation, so tool calls, usage accounting and cancellation keep working.
Install it
Two options. The extension gives you the live catalog, the AnyRouter CLI gives you the shortest path:
pi install npm:@anyr/pi
# or from git
pi install git:github.com/AnyRouterHQ/pi-anyrouter
# or, with the AnyRouter CLI
curl -fsSL https://anyr.dev/cli.sh | bash
anyr piThe extension is published to npm under the @anyr scope as @anyr/pi, so pi install npm:@anyr/pi is the short form. The CLI writes the provider, sets ANYROUTER_API_KEY and starts pi --provider anyrouter, which is the fastest path when you do not want to manage the file yourself.
The source, the tests and the protocol limits are in AnyRouterHQ/pi-anyrouter.
Why the compatibility flags matter
Pi decides how to talk to a provider from its host. For an unknown host it assumes a stock OpenAI endpoint and sends store, a developer role on reasoning models, max_completion_tokens and a long prompt-cache retention.
AnyRouter's chat endpoint does not document those fields. The extension sets pi's compat flags from each catalog row instead, so a request only sends parameters the model actually lists. Rows that list reasoning_effort get it, rows that list reasoning get the reasoning object, and rows that list neither get no reasoning field at all.
What it does not do
Chat completions is the protocol this provider speaks. Claude Code's own request shape is Anthropic Messages, which pi's anthropic-messages client can emit, but that client also sends Claude-only fields that are not verified for the rest of the catalog, so no second provider is registered. Codex's shape is the Responses API, and pi's Codex client targets the ChatGPT backend, not this gateway.
Both still work through chat completions with their model ids, which AnyRouter accepts.
Good to know
The catalog fetch is cached for five minutes per API key, matching the response max-age, and an offline refresh pass does not hit the network. Free models are $0 per token on Go and up with no daily cap, and bring-your-own-key routes carry $0 markup.
Pi has no MCP support, so there is nothing to auto-connect.
Pick a plan and start
Go is $2 a month for $4 in credits.
Pro is $10 a month for $20 in credits.
Pro+ is $45 a month for $100 in credits.
Max is $100 a month for $300 in credits.
Create an account, pay on the next screen, then call the model.