Claude Code Setup
Step-by-step guide to connecting Claude Code to OneProvider: set two environment variables, run a test call and fix the most common setup problems fast.
Anthropic's CLI on the OneProvider endpoint. Setup is two env vars and a verify call.
All models, capabilities, and prices Documentation index for AI agents:https://oneprovider.dev/docs/llms.txt Operating system Before you start: a key from your cabinet Open your cabinet: the Telegram bot @oneprovider_robot (Account) or app.oneprovider.dev . Press “Issue a key”, give it a name (for example, this client) and a spend limit, and copy the key. You top up the balance in the same place. More about the cabinet and keys . Using the Claude Desktop app? The Code tab of Claude Desktop is set up differently, through the app’s built-in gateway mode: Claude Desktop guide . This page is for the claude command line. Install
bashcurl -fsSL https://claude.ai/install.sh | bash
# or:
brew install --cask claude-code Option 1: environment variables (current session)
The fastest path is to set the variables only in the current terminal. They won’t persist across sessions — see “Make persistent” at the bottom if you want them to survive a reboot.
bashexport ANTHROPIC_BASE_URL=https://api.oneprovider.dev
export ANTHROPIC_AUTH_TOKEN=sk-your-key-here Option 2: persistent settings
Claude Code reads user settings from settings.json. The default model and family aliases below come from the catalog’s current active models.
File path: ~/.claude/settings.json
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.oneprovider.dev",
"ANTHROPIC_AUTH_TOKEN": "sk-your-key-here",
"ANTHROPIC_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
},
"model": "claude-sonnet-5-5"
} Verify
bashclaude -p "say hi in one sentence" You should see a single-sentence reply within a second or two. If you see 401, the key is wrong; 400 invalid_request_error means the model name doesn’t match the canonical list (the response lists the supported ids).
Common issues
Claude Code asks me to log in or shows “Auth conflict” — what now? You don’t need to log in. The OneProvider key works without a Claude account. ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer, takes precedence over a saved claude.ai login and needs no approval prompt. If a saved claude.ai login is still there and Claude Code shows the login screen or an Auth conflict warning, run /logout inside Claude Code: your variables stay, the extra login goes away. Check /status: it should show Auth token: ANTHROPIC_AUTH_TOKEN and Anthropic base URL: https://api.oneprovider.dev. Do not run unset ANTHROPIC_AUTH_TOKEN: that removes your key and Claude Code falls back to the login. Full write-up: Troubleshooting · Claude Code login . JSON parse error in settings.json (or an unexplained 429) The most common cause is “smart” quotes (“ ”) in ~/.claude/settings.json. They appear when you paste from messengers or Notion, and the JSON parser rejects them. Sometimes a broken config surfaces as a 429 because the client treats the missing answer as a rate limit. One-line fix: bash # validate the file
jq . ~/.claude/settings.json
# auto-replace smart quotes with ASCII
sed -i.bak $'s/[\u201c\u201d]/"/g' ~/.claude/settings.json Best prevention: copy the config straight from this documentation — the quotes are already correct here. Full write-up: Troubleshooting · JSON parse / 429 . Connections drop — do I need a VPN? No VPN needed, and a VPN usually hurts. OneProvider doesn’t geoblock traffic; VPN or VLESS proxies frequently break SSE streaming (the response cuts off mid-output) and HTTP/2 ALPN. If Claude Code dies mid-output for no obvious reason, disable the VPN and retry. Full write-up: Troubleshooting · VPN . Full list of 400 / 401 / 403 / 404 / 429 / 503 / 504 symptoms → causes → fixes lives on the Troubleshooting page .
Tool use
Claude Code uses the Anthropic-native tools schema. The API accepts every tool name (Read, Write, Edit, Bash, Grep, Glob, TodoWrite, etc.) with tool_choice: auto — which is what the CLI emits by default. No anthropic-beta header is required.
If your custom orchestrator sets tool_choice: {"type": "any"} or tool_choice: {"type": "tool", "name": "X"}, the API rewrites those to auto + a system-prompt nudge. See Tool use for the full table.
ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer, ANTHROPIC_API_KEY as x-api-key. The API accepts both, but Claude Code picks ANTHROPIC_AUTH_TOKEN first, so don’t leave a foreign token in it. Make persistent
Once everything works and you want the variables to survive across terminal sessions, add them to your shell rc-file (macOS / Linux) or to the user environment registry (Windows). New terminals will pick them up automatically.
bash# append to ~/.zshrc (default macOS shell)
cat >> ~/.zshrc <<'EOF'
export ANTHROPIC_BASE_URL=https://api.oneprovider.dev
export ANTHROPIC_AUTH_TOKEN=sk-your-key-here
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
EOF
# apply to the current session:
source ~/.zshrc Which model to choose
Claude Code speaks the Anthropic protocol, so it works best with the Claude family. Use claude-sonnet-5-5 as the everyday default: balanced price and quality for edits, tests and explanations. Switch to claude-opus-5-5 for architecture decisions, large refactors and bugs you cannot pin down; it costs more per token. Use claude-haiku-5-5 for quick questions, commit messages and background work where speed matters more than depth. Inside a session run /model to switch, or start with claude --model claude-opus-5-5. The settings above map the sonnet, opus and haiku aliases to these ids. Current ids are on the models page and rates on the pricing page . Prices are per million tokens, so put a spend limit on the key and watch Usage in your dashboard.
Common errors and fixes
claude: command not found after install
Open a new terminal first: the installer puts the binary in ~/.local/bin. If it is still missing, add it with export PATH="$HOME/.local/bin:$PATH" in your shell rc-file. With Homebrew, check that brew install --cask claude-code finished without errors.
400 invalid_request_error about the model
The model id is not in the catalog, often an old alias such as claude-3-5-sonnet. Set ANTHROPIC_MODEL and the three ANTHROPIC_DEFAULT_*_MODEL variables as in the settings.json above, or list the valid ids with curl -s https://api.oneprovider.dev/v1/models -H "x-api-key: $KEY".
404 or “The requested API endpoint does not exist”
ANTHROPIC_BASE_URL must be exactly https://api.oneprovider.dev: no /v1 and no /v1/messages at the end. Claude Code adds the path itself.
429 “Insufficient balance on this API key”
The cabinet balance or the key’s spend limit is used up. Retrying will not help: top up the balance or raise the limit in the cabinet, then send the request again.
The response stops in the middle or the connection resets
Turn off any VPN or VLESS proxy: they buffer streams and break HTTP/2. OneProvider does not geoblock and does not buffer streams. A request must start answering within 6 minutes and is capped at 10 minutes in total, see error codes .
I changed settings.json but nothing changed
Claude Code reads the env block at start, so quit and start claude again. Keep the variables in ~/.claude/settings.json or your shell: a project .claude/settings.json is read after first-run setup and may be too late.
FAQ
Do I need a Claude account or subscription?
No. The OneProvider key is enough. Claude Code never has to log in to claude.ai; if it shows a login screen, follow the Auth conflict steps above.
Can I use GPT or other models in Claude Code?
Claude Code sends Anthropic Messages requests, so use Claude ids there. For GPT models use Codex , Cursor or Cline .
How do I go back to my Anthropic login?
Delete the ANTHROPIC_* variables you set above from the settings.json env block and your shell rc-file, open a new terminal and run /login.
Where can I see what a session cost?
In the dashboard Usage page of the key: every request with its model and token counts. A per-key spend limit stops a runaway agent.
Does it work on Windows?
Yes. Pick Windows in the operating system switcher at the top: the same two variables are set with PowerShell, and settings.json lives in your user profile under .claude.
Is the Claude Code VS Code extension the same?
It shares the settings file. See Claude Code in VS Code .
Quick answers
Which base URL do I use?
Claude Code and Anthropic SDKs use https://api.oneprovider.dev. OpenAI SDKs and OpenAI-compatible clients use https://api.oneprovider.dev/v1. One key works behind both; the model list is on the models page ; rates are on the pricing page .
How do I authenticate?
Send the raw sk-… key in x-api-key or Authorization: Bearer: one of them, never both. Keep the key in an environment variable, not in a file that gets committed. More on authentication .
Where do I get a key?
Open your cabinet in the Telegram bot @oneprovider_robot or at app.oneprovider.dev, top up the balance and press “Issue a key”. Each key can carry its own spend limit. Cabinet & API keys .
What do 401, 404 and 429 mean?
401: the key is missing, mistyped or sent in the wrong header; paste the whole key without quotes or spaces. 404: usually a wrong base URL, for example a missing or doubled /v1. 429 with “Insufficient balance”: the cabinet balance or the key’s spend limit is used up, so top up instead of retrying; any other 429 is a rate limit, so wait for Retry-After. Details: error codes and troubleshooting .
Why do streams cut off or reset?
VPN and VLESS proxies often buffer SSE or break HTTP/2 negotiation. OneProvider has no regional restrictions and does not buffer streams, so turn the proxy off and retry.
Where do I ask if this is not enough?
Message @Oneproviderhelpbot on Telegram or open “Support” in the web cabinet, with the HTTP status code and the exact error message. How support works .
Last updated: 2026-10-05 Found a bug? @Oneproviderhelpbot