Before you start
- Create an API key. In the portal, open Keys and click Create Key. Your key starts with
ni_live_. - Add credit. New accounts start with a balance of $0, and every request is refused until you add credit. Open Billing and click Buy credits.
- Pick a model. Northern Inference model names end in a tier tag, for example
claude-sonnet-4-6-t4. See them all on the Models page.
Install pi
Mac and Linux:
curl -fsSL https://pi.dev/install.sh | sh
Windows PowerShell:
powershell -c "irm https://pi.dev/install.ps1 | iex"
The installers also set up Node.js if you need it. If you prefer npm, run npm install -g --ignore-scripts @earendil-works/pi-coding-agent (Node.js 22.19 or newer). The older @mariozechner/pi-coding-agent package is deprecated.
Connect pi to Northern Inference
Create the file ~/.pi/agent/models.json (on Windows, C:\Users\you\.pi\agent\models.json) and paste this, with your key in place of ni_live_YOUR_KEY_HERE:
{
"providers": {
"northerninference": {
"baseUrl": "https://northerninference.ca/v1",
"api": "openai-completions",
"apiKey": "ni_live_YOUR_KEY_HERE",
"models": [
{ "id": "claude-sonnet-4-6-t4" },
{ "id": "DeepSeek-V4-Flash-t4" }
]
}
}
}
Start pi, type /model, choose a model under northerninference and press Ctrl+S to make it the default for new sessions. Send a message. It appears in the portal under Usage within a few seconds.
Each id is sent to Northern Inference exactly as written, so it must match a name on the Models page, including its case. To add a model, add another { "id": "..." } line.
Make sure you are using Northern Inference
In /model, always pick an entry under northerninference. If you have also signed in to another provider in pi, its models appear in the same list, and picking one of those sends your request to that provider instead.
If a model name is not recognized
Northern Inference answers with HTTP 404 and Model 'X' is not a route this key can call. It never swaps in a different model. Use a name from the Models page, or type ni-models as a message to list the models your key can call.
Troubleshooting
| What you see | What to do |
|---|---|
Your Northern Inference models are missing from /model | pi shows a model only when it can read its key. Check that models.json is valid JSON (quotes, commas, braces) and that the field is spelled apiKey. |
| 401 | The key is wrong or was revoked. Paste it again, without extra quotes or spaces. |
402 Insufficient credits. Add credits in the portal under Billing (https://northerninference.ca/portal/?page=billing) to continue. | Add credit in the portal under Billing. |
403 privacy_tier_not_allowed | Your key is limited to some tiers, and this model is in another one. Pick a model your key allows, or change the key's allowed tiers in the portal under Keys. |
400 ambiguous_model_route | The name is the same model on more than one route your key can call. Use one of the route names the message lists. |
404 Model 'X' is not a route this key can call. | Use a name from the Models page, or type ni-models. |
Keep your key safe
If your key has been pasted into a chat, a screenshot or a shared screen, revoke it in the portal under Keys, create a new one and put it in models.json.