Claude Code
Menu
Coding tools

Claude Code

Run Anthropic's terminal coding agent Claude Code on models served by RuToken.

Claude Code is Anthropic's agentic coding tool for the terminal. It reads your codebase, edits multiple files, runs commands and integrates with VS Code and JetBrains IDEs. Claude Code talks to the Anthropic Messages API, which RuToken serves natively, so you only need to change the endpoint and the token.

Prerequisites

  • An API key: open the console, go to API Keys and create a dedicated key (for example, named Claude Code). Make sure it is allowed to use the Claude models you need.
  • macOS, Linux or Windows 10+. On Windows, Git for Windows is required.

Installation

Use the official native installer:

macOS / Linux
curl -fsSL https://claude.ai/install.sh | bash
Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex

Alternatively, with Node.js 18+ installed:

bash
npm install -g @anthropic-ai/claude-code

If the installer asks you to add ~/.local/bin to PATH, run the command it prints, then open a new terminal and check the installation:

bash
claude --version

Configuration

Claude Code needs two values:

Variable Value
ANTHROPIC_BASE_URL https://rutoken.ai (no /v1 — Claude Code adds /v1/messages itself)
ANTHROPIC_AUTH_TOKEN your API key, e.g. sk-xxxx

Option A: environment variables

Set them for the current session:

macOS / Linux
export ANTHROPIC_BASE_URL="https://rutoken.ai"
export ANTHROPIC_AUTH_TOKEN="sk-xxxx"
Windows (PowerShell)
$env:ANTHROPIC_BASE_URL = "https://rutoken.ai"
$env:ANTHROPIC_AUTH_TOKEN = "sk-xxxx"

To make them permanent:

macOS / Linux
# Use ~/.bashrc instead of ~/.zshrc if your shell is bash
echo 'export ANTHROPIC_BASE_URL="https://rutoken.ai"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxxx"' >> ~/.zshrc
source ~/.zshrc
Windows (PowerShell)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://rutoken.ai", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-xxxx", "User")
# Open a new terminal window afterwards

Option B: settings.json

Claude Code also reads environment variables from its user settings file — ~/.claude/settings.json on macOS / Linux, %USERPROFILE%\.claude\settings.json on Windows. Create the file if it does not exist and merge the env block:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://rutoken.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxx"
  }
}

Optional: pin the models

By default Claude Code picks its own Claude model IDs. To use specific models available in the Model Square, add any of these variables (in the shell or in the env block):

Variable Purpose
ANTHROPIC_MODEL Main model used for the session
ANTHROPIC_DEFAULT_SONNET_MODEL Model used for the "Sonnet" tier
ANTHROPIC_DEFAULT_OPUS_MODEL Model used for the "Opus" tier
ANTHROPIC_DEFAULT_HAIKU_MODEL Fast model for background tasks

Once ANTHROPIC_BASE_URL is set, every request — including the built-in model presets — goes to RuToken and is billed to your key, not to an Anthropic subscription. Remove ANTHROPIC_API_KEY if it is also set, to avoid conflicting credentials.

Verify

Open your project and start Claude Code:

bash
cd /path/to/your/project
claude

Run /status to confirm that the base URL points to https://rutoken.ai, use /model to choose a model, then send a short prompt such as Reply with "Connection successful". The request should appear in the console under Usage Logs.

If Claude Code still shows the Anthropic login screen on first launch, add "hasCompletedOnboarding": true to ~/.claude.json (create the file with {"hasCompletedOnboarding": true} if it does not exist) and start it again.

Troubleshooting

Symptom Fix
401 / invalid API key Copy the full key again; check that it is enabled, not expired and has quota left. Make sure no old ANTHROPIC_API_KEY overrides it.
404 / not found ANTHROPIC_BASE_URL must be https://rutoken.ai without /v1 and without a trailing slash.
Model not found Set ANTHROPIC_MODEL (and the tier variables) to model IDs shown in the Model Square, and check that the key's model limits allow them.
Variables seem ignored Open a new terminal after making them permanent, and check them with echo $ANTHROPIC_BASE_URL (or $env:ANTHROPIC_BASE_URL in PowerShell).