Claude Code + Rus-GPT

Install and configure Claude Code CLI to work via Rus-GPT API

Installation

Install Claude Code and configure it to connect to Rus-GPT API.

Prerequisites

Install Node.js (v18+) — download the installer from the website.

Install Git — download the installer from the website.

Allow script execution

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Install Claude Code

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

Verify installation

claude --version

Prerequisites

Install Node.js (v18+) via package manager or from the website.

Install Claude Code

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

Verify installation

claude --version

API Configuration & Model Selection

Set environment variables to connect to Rus-GPT API. Claude Code uses three model slots: haiku (quick tasks), sonnet (main work) and opus (complex tasks).

Run in PowerShell:

[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "rusgpt-YOUR_KEY", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://rus-gpt.com/api", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_DEFAULT_HAIKU_MODEL", "z-ai/glm-5.1", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_DEFAULT_SONNET_MODEL", "z-ai/glm-5.1", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_DEFAULT_OPUS_MODEL", "z-ai/glm-5.1", "User")
Important: After setting environment variables you must close and reopen PowerShell.

Add the following lines to your ~/.bashrc or ~/.zshrc:

export ANTHROPIC_AUTH_TOKEN="rusgpt-YOUR_KEY"
export ANTHROPIC_BASE_URL="https://rus-gpt.com/api"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="z-ai/glm-5.1"
export ANTHROPIC_DEFAULT_SONNET_MODEL="z-ai/glm-5.1"
export ANTHROPIC_DEFAULT_OPUS_MODEL="z-ai/glm-5.1"

Apply changes:

source ~/.bashrc

Replace rusgpt-YOUR_KEY with your API key. Get a key on the API Keys page. Full model list on the Models page.

Run Claude Code

claude
Important: Environment variables are set at user level and are not committed to your repository.

Recommended Configurations

Budget

GLM 5.1 for all slots

Open-source model from ZhipuAI. Excellent code quality at minimal cost.

ANTHROPIC_DEFAULT_HAIKU_MODEL=z-ai/glm-5.1
ANTHROPIC_DEFAULT_SONNET_MODEL=z-ai/glm-5.1
ANTHROPIC_DEFAULT_OPUS_MODEL=z-ai/glm-5.1
Premium

Claude for all slots

Official Anthropic models. Maximum quality for complex tasks.

ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-4.5
ANTHROPIC_DEFAULT_SONNET_MODEL=anthropic/claude-sonnet-4.6
ANTHROPIC_DEFAULT_OPUS_MODEL=anthropic/claude-opus-4.6

Estimated Session Cost

Cost estimate for a typical programming session (1-2 hours of active work, ~500K tokens):

Model Session Cost Comment
z-ai/glm-5.1 ~200 ₽ Best open-source coding model by ZhipuAI
anthropic/claude-opus-4.6 ~1500 ₽ Top coding model. Closed-source by Anthropic
Important: Start with GLM 5.1 to save costs. Switch to Claude for complex tasks if needed.

Troubleshooting

PS1 Script execution is disabled

Error cannot be loaded because running scripts is disabled on this system. Run in PowerShell: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser and restart PowerShell.

??? Command claude not found

After npm install the claude command is not found. Make sure Node.js is installed and restart PowerShell. Check: node --version and npm config get prefix — the prefix path must be in your PATH variable.

ENV Environment variables not applied

Claude Code connects to Anthropic instead of Rus-GPT. Environment variables were not applied — you must restart PowerShell after setting them. Check: echo $env:ANTHROPIC_BASE_URL — should return https://rus-gpt.com/api.

NPM npm install error

EACCES or EPERM error during install. Run PowerShell as Administrator or reinstall Node.js with the "Current user only" option. If the install hangs — clear the cache: npm cache clean --force

401 Unauthorized

Invalid API key. Verify the key starts with rusgpt- and is fully copied. Create new key

402 Payment Required

Insufficient funds. Top up balance

404 Model Not Found

Model not found or unavailable. Check the model name on the models page.

NODE Errors when running Claude Code

SyntaxError or Cannot find module 'node:fs' errors on startup. Node.js v18 or higher is required. Check your version: node --version. Download the latest LTS from nodejs.org.

Useful Links

Success! Setup complete. Run claude in the terminal from your project directory.