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 OpenClaw
Mac, Linux and WSL2:
curl -fsSL https://openclaw.ai/install.sh | bash
Windows PowerShell:
iwr -useb https://openclaw.ai/install.ps1 | iex
On Windows you can also install the OpenClaw desktop app from openclaw.ai. The installer starts OpenClaw's setup (onboarding) when it finishes.
Connect OpenClaw to Northern Inference
When onboarding asks for a model provider, choose the custom OpenAI-compatible endpoint and enter:
| Setting | Value |
|---|---|
| Base URL | https://northerninference.ca/v1 |
| Model ID | claude-sonnet-4-6-t4 |
| API key | your ni_live_ key |
| Compatibility | OpenAI (chat completions) |
To do the same from the command line, run:
openclaw onboard --auth-choice custom-api-key --custom-base-url https://northerninference.ca/v1 --custom-model-id claude-sonnet-4-6-t4 --custom-compatibility openai --custom-api-key ni_live_YOUR_KEY_HERE
Send a message and check that the request appears in the portal under Usage within a few seconds.
Or edit the config file
If you prefer to write the configuration yourself, put your key in ~/.openclaw/.env (on Windows, C:\Users\you\.openclaw\.env):
NI_API_KEY=ni_live_YOUR_KEY_HERE
Then put this in ~/.openclaw/openclaw.json (on Windows, C:\Users\you\.openclaw\openclaw.json). If the file already exists, add the northerninference provider and the agents default to what is there instead of replacing the file.
{
models: {
providers: {
northerninference: {
baseUrl: "https://northerninference.ca/v1",
apiKey: "${NI_API_KEY}",
api: "openai-completions",
models: [
{
id: "claude-sonnet-4-6-t4",
name: "Claude Sonnet 4.6 (Northern Inference)",
input: ["text"],
contextWindow: 128000,
maxTokens: 16384,
// USD per 1M tokens, from https://northerninference.ca/api/billing/models
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
},
],
},
},
},
agents: {
defaults: {
model: { primary: "northerninference/claude-sonnet-4-6-t4" },
},
},
}
To add another model, add another entry to models with its exact name from the Models page, for example DeepSeek-V4-Pro-t4.
Show token counts and cost in OpenClaw (optional)
Northern Inference bills the exact provider counts either way, and the portal always shows them. To see them inside OpenClaw as well:
- In the portal, open your API key and turn on Always send streaming token counts. OpenClaw streams every request but does not ask for the token counts, so Northern Inference only sends them when this is on.
- Keep the
costblock on each model entry. OpenClaw works out the cost itself from it, in US dollars per million tokens. The numbers above change when providers change their prices; the current ones are on the Models page.
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 the exact name from the Models page, including its case, or type ni-models as a chat message to list the models your key can call.
Troubleshooting
| What you see | What to do |
|---|---|
| 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. |
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. |
404 Model 'X' is not a route this key can call. | Use a name from the Models page, or type ni-models. |
| OpenClaw shows zero tokens | Turn on Always send streaming token counts on the key (see above). |