Cursor speaks OpenAI-compatible API. NI's gateway is OpenAI-compatible, so it slots in directly.
1. Get an NI API key
northerninference.ca/portal → Keys → Create key. Copy the ni_live_… string (you won't see it again).
Optional: toggle BYOK on the key if you want to use your own OpenAI / Anthropic keys at a reduced routing-only fee (NI still handles the custody chain + PII + residency layer).
2. Configure Cursor
Cursor → Settings (cog top-right) → Cursor Settings → Models.
In the API Keys section:
- Enable OpenAI API Key
- Paste your
ni_live_…key - Enable Override OpenAI Base URL
- Set URL:
https://northerninference.ca/v1 - Click Save
3. Add NI models to Cursor's model list
Scroll up on the same panel to Add or search model. Enter the NI model ID, click Add, toggle it on. (Cursor may ask you to verify — type any text into the chat once to confirm.)
Popular model IDs to start with:
anthropic/claude-sonnet-4.5
anthropic/claude-opus-4.6
anthropic/claude-haiku-4.5
openai/gpt-4o
openai/gpt-4.1
vertex_ai/gemini-2-5-flash
vertex_ai/gemini-2-5-pro
mistral/mistral-large
meta/llama-3-70b
Full catalog: northerninference.ca/portal → Models shows every model ID your account can currently call, with pricing and privacy tier. You can also hit the public catalog directly:
curl https://northerninference.ca/api/billing/models | jq '.models[].model_id'
That prints every provider/model-name routing key the gateway recognizes. Pick the ones you want; add each one to Cursor's model list.
IMPORTANT: add as custom OpenAI models, not Cursor's built-in entries
Cursor's Override OpenAI Base URL setting is scoped to the OpenAI provider slot only. If you pick a model from Cursor's built-in picker that Cursor classifies as Anthropic, Google, or xAI (e.g. "Gemini 2.0 Flash", "Claude Sonnet 4.5"), Cursor will call that provider directly and your request will not hit NI at all. No custody chain, no residency guarantee, no PII substitution, no usage row in your NI portal.
To route Gemini / Claude / Mistral / Llama through NI, you must:
- Add the NI canonical model name (e.g.
vertex_ai/gemini-2-5-flash) under
the Model Names list in the OpenAI panel above.
- Select that custom entry from Cursor's model picker, not Cursor's
built-in "Gemini 2.0 Flash" / "Claude Sonnet" entries.
A quick way to verify: after sending a request, open northerninference.ca/portal → Usage and confirm the request shows up within a few seconds. If it doesn't, Cursor sent it somewhere else.
Cursor tracks this as a known limitation; there is currently no per-model base-URL override, and no way to force "route everything through the OpenAI slot."
4. Pick your privacy tier (optional but recommended)
Cursor doesn't have a UI for extra_body parameters, so by default your requests land at NI's default tier (managed_canadian_cloud. Canadian data residency via Bedrock / Azure Canada East).
To force a different tier, issue a different API key from the portal with the tier baked in as a default. Keys → Create key → Default privacy tier. All requests from that key will pin to that tier regardless of what the client asks for.
5. Verify it's working
Open a chat in Cursor, type:
What model are you?
You should see the model name in the response, and the request should appear at northerninference.ca/portal → Usage within a few seconds.
You can also curl the same endpoint to confirm the routing:
curl https://northerninference.ca/v1/chat/completions \
-H "Authorization: Bearer $NI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.5",
"messages": [{"role": "user", "content": "say hi"}],
"max_tokens": 10
}'
The response headers will include X-NI-Custody-Path, X-NI-Resolved-Jurisdiction, X-NI-Request-ID.
Troubleshooting
"Invalid API key" in Cursor but curl works. Cursor caches the old key - quit and relaunch.
Requests don't show up in the NI Usage dashboard. You almost certainly picked a model from Cursor's built-in picker (Gemini, Claude, xAI) that routes to the native provider, not through NI. See "the base-URL override only applies to custom OpenAI models" above. Fix: add the NI canonical model name as a custom OpenAI model and pick that entry instead.
"Model 'gpt-5.x' is not deployed" from NI. You reached NI (good — the base-URL override is working) but the exact model string you picked isn't in NI's catalog. Check GET /api/billing/models or the portal Models page for the canonical names. NI returns 400 with the full available-models list embedded in the error body.
Completions are slow on first request after a gap. That's normal cold-start latency on the provider side (especially for Bedrock). Subsequent requests in the same conversation reuse the warm path.
Want to use Cursor's Composer / Cmd+K with NI? Those both go through the same OpenAI-compatible pipe, so once the Models panel is configured you get them for free.
Want to scope spend per project? Issue a separate API key per project from the portal, and use the Max spend per day field on the key create form.