api.anthropic.com by default — set ANTHROPIC_BASE_URL to https://www.ruapi.ai to point it at RuAPI instead, no proxy layer required. You don’t need an Anthropic subscription or an Anthropic login for this.
RuAPI accepts the native Anthropic Messages format (/v1/messages) — the format the Claude Code docs describe for a gateway connected through ANTHROPIC_BASE_URL (LLM gateway protocol). So you need no converter such as claude-code-router or LiteLLM.
Updated: Nov 5, 2026
For a short overview of why it’s better to connect Claude Code from Russia through RuAPI rather than an Anthropic account, see www.ruapi.ai/claude-code-v-rossii; the setup steps are below.
Prerequisites
RuAPI account + API key
sk-... string. See Top-up and API keys & security.Node.js ≥ 22

Console → API Keys: the “Connect Claude Code, Cline & more” button

The “Connect an app” window with Claude Code selected: the address and key are filled in (key hidden in the screenshot)
Install Claude Code
- macOS / Linux
- Windows
Point Claude Code at RuAPI
Three configuration methods, in order of preference:Method 1: settings.json (recommended)
Edit ~/.claude/settings.json (macOS / Linux) or %USERPROFILE%\.claude\settings.json (Windows). Create it if missing and paste this in, with your own key:
What each field does
What each field does
Why the model goes in model, not ANTHROPIC_MODEL
Why the model goes in model, not ANTHROPIC_MODEL
ANTHROPIC_MODEL variable also sets the model, but it overrides the model field: while it is set, the default you pick in /model resets after a restart. If ANTHROPIC_MODEL is still in env from an older setup, remove it.Why AUTH_TOKEN and not ANTHROPIC_API_KEY
Why AUTH_TOKEN and not ANTHROPIC_API_KEY
ANTHROPIC_API_KEY works too (RuAPI accepts both headers), but with it Claude Code asks on first launch whether to use that key — answer “no” by accident and requests bypass RuAPI. ANTHROPIC_AUTH_TOKEN skips that question. The old ANTHROPIC_SMALL_FAST_MODEL variable is deprecated — use ANTHROPIC_DEFAULT_HAIKU_MODEL instead.Method 2: shell env vars
For a quick trial:- macOS / Linux (zsh / bash)
- Windows (PowerShell)
ANTHROPIC_MODEL sets the model for this window only. For a permanent setup use method 1: if you put ANTHROPIC_MODEL in ~/.zshrc or ~/.bashrc, the default you pick in /model stops being saved.Method 3: use CC Switch
If you bounce between RuAPI and your official account, install CC Switch and manage providers from a GUI.First call
Open a new terminal (so env vars are loaded),cd into any project:
Check with /status
Inside Claude Code, type /status:
- the
Anthropic base URLline should showhttps://www.ruapi.ai; - the
Auth tokenline should nameANTHROPIC_AUTH_TOKEN.
settings.json. More on the Claude Code in Russia page.
Switch models on the fly
Inside a session:deepseek-flash, gpt-5.4-mini, gemini-3.8-flash, kimi-k3.1-pro, glm-5.3, qwen3.8-max, MiniMax-M3.1-Flash, grok-4.7:
/model menu lists all of these models your key can use; other vendors’ models appear with an anthropic/ prefix (for example anthropic/kimi-k3.1-pro), because Claude Code requires it. The /model command accepts both forms, with or without the prefix. The full list with prices is on the pricing page. DeepSeek has its own guide — Claude Code on DeepSeek.
How to save money
Reading code, small edits, tests and routine questions are handled fine bydeepseek-flash, which costs many times less than Claude Sonnet. Make it your main model ("model": "deepseek-flash" in settings.json) and switch only for a hard task (a big refactor, a tangled bug):
/model deepseek-flash; if you made Sonnet the default in the /model menu, set deepseek-flash back as the default there, or the next launch will start on Sonnet too. Switch between tasks rather than in the middle of one: each model has its own prompt cache, so after a switch the long context is paid in full the first time. To run all of Claude Code on DeepSeek, background tasks included, see Claude Code on DeepSeek; more ways to cut the bill are in Saving on Claude Code and Cline.
Troubleshooting
You don’t need a Claude Pro or Max subscription for this setup — see Claude Code without a subscription. If a direct connection to Anthropic is rejected with “403 Request not allowed”, see Claude: Request not allowed.Unable to connect to Anthropic services / Failed to connect to api.anthropic.com
Unable to connect to Anthropic services / Failed to connect to api.anthropic.com
api.anthropic.com on first launch even when ANTHROPIC_BASE_URL is set, and that address is unreachable from Russia. The workaround is on the Claude Code in Russia page.Model not found (503) or 404
Model not found (503) or 404
- Typo in the model ID. Claude model families on RuAPI are Claude Sonnet, Claude Opus, and Claude Haiku; for the exact names of all models, see the
/modelmenu or the pricing page. - Don’t add
/v1toANTHROPIC_BASE_URL.
403 / insufficient balance
403 / insufficient balance
Network timeout / can't connect
Network timeout / can't connect
- Verify reachability:
curl -I https://www.ruapi.ai - If you’re behind a corporate proxy, make sure
HTTPS_PROXYisn’t sending requests through a proxy that’s down. - No VPN required.
Advanced
- MCP servers: independent of which backend API you use — configure as usual.
- Tool calls / function calling: RuAPI forwards Anthropic’s tool calls unchanged.
- Streaming / SSE: on by default, nothing extra to configure.
anthropic-versionandanthropic-betaheaders sent by Claude Code are supported.- Prompt caching:
cache_controlmarkers are passed to the Anthropic API — see Prompt caching.