Pi
Run Pi against AnyRouter as a custom OpenAI-compatible provider with one key.
Pi reads custom OpenAI-compatible providers from ~/.pi/agent/models.json. Register AnyRouter once to run Pi on any AnyRouter model with one sk-ar- key.
Fastest path
curl -fsSL https://anyrouter.dev/cli.sh | bash
anyr piThe launcher writes a Pi agent dir (PI_CODING_AGENT_DIR) with AnyRouter in models.json, sets ANYROUTER_API_KEY, and starts pi --provider anyrouter. Use anyr pi --install --ok to install Pi too. Pi has no MCP support, so Auto-connect does not apply.
Manual setup
-
Create a key in the dashboard and export it (add to
~/.zshrcor~/.bashrcto persist):export ANYROUTER_API_KEY="sk-ar-your-anyrouter-key" -
Add AnyRouter to
~/.pi/agent/models.json:{ "providers": { "anyrouter": { "baseUrl": "https://anyrouter.dev/api/v1", "api": "openai-completions", "apiKey": "ANYROUTER_API_KEY", "models": [ { "id": "openai/gpt-5.4-mini" }, { "id": "anthropic/claude-sonnet-4-6" } ] } } }apiKeyis the environment variable name, not the secret. Do not paste yoursk-ar-key here. -
Run Pi:
pi --provider anyrouter --model "openai/gpt-5.4-mini"
Add more models from the catalog as entries in models, with the id exactly as listed (for example google/gemini-3.1-flash-lite). The call appears in your request logs.
Troubleshooting
| Symptom | Fix |
|---|---|
| 401 or 403 | echo $ANYROUTER_API_KEY must print your key, and the key must be active. |
| Model not found | The id in Pi must match an AnyRouter model id exactly. |
| 429 | Pi can send agent calls quickly. Wait for the window to reset or use a key with a higher limit. |
AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer