Quick setup
export NI_API_KEY=ni_live_YOUR_KEY_HERE
export ANTHROPIC_BASE_URL=https://northerninference.ca/v1
export ANTHROPIC_AUTH_TOKEN="$NI_API_KEY"
claude --model anthropic/claude-sonnet-4.5 --effort xhigh
Use ANTHROPIC_AUTH_TOKEN so Claude Code sends Bearer auth to
NI. If your Claude Code version ignores ANTHROPIC_AUTH_TOKEN,
set ANTHROPIC_API_KEY to the same NI key. If either variable
is already set to a direct Anthropic key in the same shell, unset it before
launching Claude Code through NI.
Model selection
Set the model when launching Claude Code:
claude --model anthropic/claude-sonnet-4.5
You can also change it inside Claude Code with /model. When
ANTHROPIC_BASE_URL points at NI, Claude Code can list models
from NI's /v1/models endpoint. Use exact route IDs from
/models when you want explicit residency or provider
selection.
Thinking level
Claude Code calls this effort. Set it at launch:
claude --model anthropic/claude-sonnet-4.5 --effort low
claude --model anthropic/claude-sonnet-4.5 --effort medium
claude --model anthropic/claude-sonnet-4.5 --effort high
claude --model anthropic/claude-sonnet-4.5 --effort xhigh
claude --model anthropic/claude-sonnet-4.5 --effort max
In an active Claude Code session, use /effort to change the
level without restarting.
One-shot check
claude -p "Reply with NI ok." \
--model anthropic/claude-sonnet-4.5 \
--effort medium \
--tools ""
The request should appear in portal Usage within a few seconds. The response headers include the NI request ID, resolved route, resolved jurisdiction, and custody path.
Troubleshooting
Requests do not appear in Usage. Claude Code did not use
the NI endpoint or token from this shell. Check
ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN.
401 from NI. Confirm the token is an NI API key and the
environment variable is ANTHROPIC_AUTH_TOKEN.
Unknown request parameter: output_config. The gateway is running an older build without Claude Code effort support. Current Claude Code releases use this field for effort.
Anything not working as expected? Open a ticket. Include the X-NI-Request-ID if one was returned.