Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt

Use this file to discover all available pages before exploring further.

Claude Code is Anthropic’s official command-line coding assistant. It hits api.anthropic.com by default — set ANTHROPIC_BASE_URL to point it at RuAPI instead, no proxy layer required.
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 → TokensCreate token to get a sk-... string. See Top-up and API keys & security.
2

Node.js ≥ 18

Claude Code needs Node.js 18+. Check with:
node --version
If missing, grab the LTS from nodejs.org, or on macOS:
brew install node

Install Claude Code

npm install -g @anthropic-ai/claude-code
Confirm:
claude --version

Point Claude Code at RuAPI

Three configuration methods, in order of preference: Edit ~/.claude/settings.json (macOS / Linux) or %USERPROFILE%\.claude\settings.json (Windows). Create it if missing:
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://www.ruapi.ai",
    "ANTHROPIC_API_KEY": "sk-your-RuAPI-token",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5"
  }
}
Do not append /v1 to ANTHROPIC_BASE_URL. The Anthropic SDK adds /v1/messages itself, and an extra /v1 causes 404s.
FieldMeaning
ANTHROPIC_BASE_URLThe RuAPI endpoint
ANTHROPIC_API_KEYYour RuAPI token (not the official Anthropic key)
ANTHROPIC_MODELDefault Claude model. claude-sonnet-4-6 is the best price/performance balance
ANTHROPIC_SMALL_FAST_MODELTiny model Claude Code uses for internal tasks (title generation, path completion) — claude-haiku-4-5 keeps costs low

Method 2: shell env vars

For a quick trial:
export ANTHROPIC_BASE_URL="https://www.ruapi.ai"
export ANTHROPIC_API_KEY="sk-your-key"
claude
Add the same lines to ~/.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:
cd ~/some-project
claude
In the interactive prompt, ask the simplest possible thing:
> Reply with one English sentence: hello
You should get an immediate Claude reply, and the RuAPI Console → Logs should show the request with a token-level cost line.
To double-check the call really went through RuAPI, open RuAPI Console → Logs and look at the newest entry — the model name should match claude-sonnet-4-6 (or whatever you configured).

Switch models on the fly

Inside a session:
/model claude-opus-4-7
/model claude-haiku-4-5
Full model list at the model gallery.

Troubleshooting

  • ANTHROPIC_API_KEY must be your RuAPI token (sk-...), not Anthropic’s sk-ant-....
  • Watch for trailing whitespace or line breaks when copying.
  • In RuAPI Console → Tokens, confirm the key is enabled and that the model allowlist (if any) doesn’t exclude the model you’re calling.
  • Typo in the model ID. Claude model names on RuAPI match Anthropic’s official IDs: claude-sonnet-4-6, claude-opus-4-7, claude-haiku-4-5.
  • Don’t add /v1 to ANTHROPIC_BASE_URL.
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.
  • Verify reachability: curl -I https://www.ruapi.ai
  • If you’re behind a corporate proxy, make sure HTTPS_PROXY isn’t routing to a dead endpoint.
  • No VPN required.
Use CC Switch for one-click toggling, or direnv to bind different env vars per project directory.

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.
For more Claude Code tips, see the official documentation.