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 Aider
Mac and Linux:
curl -LsSf https://aider.chat/install.sh | sh
Windows PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"
Connect Aider to Northern Inference
Create a file named .env in your home folder (~/.env on Mac and Linux, C:\Users\you\.env on Windows) with these two lines:
OPENAI_API_KEY=ni_live_YOUR_KEY_HERE
AIDER_OPENAI_API_BASE=https://northerninference.ca/v1
Aider reads this file every time it starts, on every operating system. Then go to your project folder and run:
aider --model openai/claude-sonnet-4-6-t4
Send a message. It appears in the portal under Usage within a few seconds.
Why the model starts with openai/
Aider names models as <provider>/<model>. The openai/ part tells Aider to talk to Northern Inference as an OpenAI-compatible service, and Aider sends only the part after it, here claude-sonnet-4-6-t4. Always keep the prefix.
To use a different model, change the name after openai/:
aider --model openai/mistral-large-2402-t3
Names ending in -t3 run in Canada. Aider may say it does not know the model's context window or price; that is expected for Northern Inference names and does not stop it working.
Prefer environment variables?
Mac and Linux:
export OPENAI_API_KEY=ni_live_YOUR_KEY_HERE
export OPENAI_API_BASE=https://northerninference.ca/v1
aider --model openai/claude-sonnet-4-6-t4
Windows PowerShell, then open a new terminal:
setx OPENAI_API_KEY "ni_live_YOUR_KEY_HERE"
setx OPENAI_API_BASE "https://northerninference.ca/v1"
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 with openai/ in front, or type ni-models as a message to list the models your key can call.
Troubleshooting
| What you see | What to do |
|---|---|
| Aider asks for an OpenAI or Anthropic key | It did not find your settings. Check the .env file name and location, or open a new terminal after setx. |
| 401 | The key is wrong or was revoked. Copy it again from the portal under Keys. |
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. |
404 Model 'X' is not a route this key can call. | Check the name after openai/ against the Models page, or type ni-models. |