Pi
Add FreshRouter to the Pi coding agent with every model: one command, or one prompt for your agent.
There are two ways to set up Pi, and neither asks you to pick a model: run one command, or paste one prompt into a coding agent. Right after you create a key, the console shows both with your key already filled in, and its Connect page has them any time later.
Run one command
The command needs Node.js, which Pi itself runs on. On macOS and Linux it asks for your API key; in PowerShell the key goes into the command:
curl -fsSL https://freshrouter.com/install/pi.js | node -To skip the question, put the key after node -. The console fills it in for you.
curl -fsSL https://freshrouter.com/install/pi.js | node - sk-your-freshrouter-keyPut your key in place of sk-your-freshrouter-key. The console fills it in for you.
irm https://freshrouter.com/install/pi.js | node - sk-your-freshrouter-keyThe installer adds the freshrouter provider to ~/.pi/agent/models.json with every model your key can use, and makes it the default in ~/.pi/agent/settings.json. It keeps everything else in both files and backs them up first, so you can run it again any time, for example to pick up new models. Then start Pi with pi.
Or have your coding agent do it
Paste this into a coding agent on the same computer. It asks you for your key, runs the command above and falls back to making the change by hand.
Set up the Pi coding agent on this computer to use FreshRouter. First ask me for my FreshRouter API key (it starts with sk-), then put it below in place of <key>.
Run this in a terminal (macOS or Linux):
curl -fsSL https://freshrouter.com/install/pi.js | node - <key>
On Windows, run this in PowerShell instead:
irm https://freshrouter.com/install/pi.js | node - <key>
It needs Node.js. It adds the "freshrouter" provider to ~/.pi/agent/models.json with every model my key can use, makes it the default in ~/.pi/agent/settings.json, keeps everything else in both files and backs them up first. It's safe to run again.
If you can't run the command, make the same change by hand: follow "Set it up by hand" in https://freshrouter.com/docs/pi.md
Don't ask me which model to use: it starts on claude-sonnet-5-5, and I'll switch with /model. When it's done, tell me to start Pi with: piChange the model
Nothing has to be chosen up front: Pi starts on claude-sonnet-5-5. Inside Pi, /model opens the list of FreshRouter models.
Set it up by hand
Add a provider to ~/.pi/agent/models.json (%USERPROFILE%\.pi\agent\models.json on Windows). Claude models use the Anthropic format and FreshRouter's address without /v1; every other model uses the provider's own settings:
{
"providers": {
"freshrouter": {
"name": "FreshRouter",
"baseUrl": "https://freshrouter.com/v1",
"api": "openai-completions",
"apiKey": "sk-your-freshrouter-key",
"models": [
{
"id": "claude-sonnet-5-5",
"name": "Claude Sonnet 5.5",
"api": "anthropic-messages",
"baseUrl": "https://freshrouter.com",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 128000
},
{
"id": "gpt-6.1-sol",
"name": "GPT-6.1 Sol",
"input": ["text", "image"],
"contextWindow": 1050000,
"maxTokens": 128000
}
]
}
}
}Add a model for each ID you want: id is the only required field. Then make FreshRouter the default in ~/.pi/agent/settings.json, keeping whatever else is there:
{
"defaultProvider": "freshrouter",
"defaultModel": "claude-sonnet-5-5"
}