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.
This page covers direct setup. If you’d rather manage multiple providers in a GUI, see CC Switch.
Prerequisites
1
RuAPI account + API key
If you haven’t yet: register at www.ruapi.ai, top up with USDT, then Console → API Keys → Create API key to get a
sk-... string. See Top-up and API keys & security.2
Node.js ≥ 22 (for the npm install)
Installing via npm requires Node.js 22 or newer. Check with:If it’s missing or older, grab the LTS from nodejs.org, or on macOS:The official installer (below) doesn’t need Node.js at all.
Install Claude Code
- macOS / Linux
- Windows
Via npm:Or with the official installer (no Node.js needed):Confirm:
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 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)
~/.zshrc or ~/.bashrc to make them permanent.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:
Switch models on the fly
Inside a session:Troubleshooting
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 — see the pricing page for exact names.
- Don’t add
/v1toANTHROPIC_BASE_URL.
403 / insufficient balance
403 / insufficient balance
Check USD balance on the Console home page and top up more USDT. Long-context conversations and tool calls burn tokens fast — 5–10 USD is a reasonable starting buffer.
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.