All use cases
Pi
Run Pi through AnyRouter
Add AnyRouter as a custom OpenAI-compatible provider in Pi's models.json — one key, the Chat Completions catalog, and request logs.
What this is for
Pi ships with its own provider list. Pointing it at a gateway means a custom provider entry, and without one every model switch needs a separate key.
Steps, then copy
- 1.Install Pi, then create an AnyRouter key in the dashboard (sk-ar-…) and export it as ANYROUTER_API_KEY.
- 2.Add AnyRouter to ~/.pi/agent/models.json as an openai-completions provider.
- 3.Open /model in Pi, pick an anyrouter model, and confirm the call in request logs.
Install Pi
bash
curl -fsSL https://pi.dev/install.sh | sh
export ANYROUTER_API_KEY="sk-ar-..."~/.pi/agent/models.json
json
{
"$schema": "https://pi.dev/schemas/models.schema.json",
"providers": {
"anyrouter": {
"baseUrl": "https://anyrouter.dev/api/v1",
"api": "openai-completions",
"apiKey": "$ANYROUTER_API_KEY",
"models": [
{ "id": "anyrouter/auto" }
]
}
}
}Limits
- Pi reads models.json each time you open /model. Add one entry per model id you want in the picker.
Ready to try it
The guide has the full walkthrough. Sign up if you still need a key.
Links
Next playbooks
- Run OpenCode through AnyRouterOne CLI command injects an AnyRouter provider for the session, or add a custom provider in opencode.json — one key, the Chat Completions catalog, and request logs.
- Run Claude Code through AnyRouterInstall the anyr CLI, then anyr claude — it injects the base URL, key, and model. Env vars are the fallback if you already run claude yourself.
- Run every coding agent through one URLClaude Code, Codex, OpenCode, Cursor, and other OpenAI-compatible tools share 272+ models, one balance, and one request log.