Claude Code जोड़ना
Claude Code Anthropic Messages API उपयोग करता है। ANTHROPIC_BASE_URL को /v1 के बिना NordRouter root पर रखें और key/model को environment variable या settings.json में दें।
- ~/.claude/settings.json terminal और VS Code दोनों के लिए काम करता है।
- Claude Code /v1/messages स्वयं जोड़ता है।
- Login, 401 या /v1/v1 पर login option, key और address जाँचें।
पूरे उदाहरण
मूल गाइड के सभी चलने योग्य उदाहरण नीचे सुरक्षित रखे गए हैं। केवल अपने टूल और ऑपरेटिंग सिस्टम से संबंधित ब्लॉक चलाएँ।
json
{
"env": {
"ANTHROPIC_API_KEY": "sk-nr-YOUR-KEY",
"ANTHROPIC_BASE_URL": "https://nordrouter.com",
"ANTHROPIC_MODEL": "anthropic/claude-opus-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-4.6",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5",
"ANTHROPIC_SMALL_FAST_MODEL": "anthropic/claude-haiku-4.5",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"allow": [],
"deny": []
}
}bash
export ANTHROPIC_BASE_URL=https://nordrouter.com
export ANTHROPIC_API_KEY=sk-nr-YOUR-KEY
export ANTHROPIC_MODEL=anthropic/claude-opus-5
claudepowershell
$env:ANTHROPIC_BASE_URL = "https://nordrouter.com"
$env:ANTHROPIC_API_KEY = "sk-nr-YOUR-KEY"
$env:ANTHROPIC_MODEL = "anthropic/claude-opus-5"
claudeआधिकारिक दस्तावेज़ और लिंक
| Variable | Meaning |
|---|---|
ANTHROPIC_API_KEY | Your sk-nr-… key |
ANTHROPIC_BASE_URL | https://nordrouter.com — no trailing /v1 |
ANTHROPIC_MODEL | Main model. You can also set anthropic/claude-sonnet-5 or anthropic/claude-fable-5 |
ANTHROPIC_DEFAULT_*_MODEL | So the /model opus|sonnet|haiku command picks the correct IDs from our catalog |
ANTHROPIC_SMALL_FAST_MODEL | Fast background model for Claude Code's utility tasks |
| Error | Cause | Fix |
|---|---|---|
Missing Bearer API key | The key wasn't picked up: empty ANTHROPIC_API_KEY or an "apiKeyHelper": "echo ''" line in the config | Set the key; delete the apiKeyHelper line |
Auth conflict: Both a token … and an API key are set + endless retries | A stale ANTHROPIC_AUTH_TOKEN (from a previous login) overrides your key — the server receives the wrong credential and returns 401 | Unset it: $env:ANTHROPIC_AUTH_TOKEN = $null (Windows) / unset ANTHROPIC_AUTH_TOKEN (macOS/Linux); make sure it's not in settings.json |
Invalid URL (POST /v1/v1/messages) | /v1 appended to ANTHROPIC_BASE_URL | Remove /v1: it must be exactly https://nordrouter.com |
No pricing available for model claude-opus-5 | Claude Code requests a model by its "bare" ID | Set ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_*_MODEL as in the config above |
Invalid or malformed JSON in settings.json | Broken JSON: missing braces/commas or "smart" quotes pasted from a chat | Replace the file contents entirely with the config above |
Invalid API key | Typo in the key, or the key was deleted | Check the key in the dashboard |
संबंधित गाइड
पहले न्यूनतम text request से कनेक्शन जाँचें, फिर streaming, tool calls, images और दूसरी advanced सुविधाएँ जोड़ें। API key को public code या browser frontend में कभी न रखें।