Claude Code

Install Claude Code and point it at Relayvia with a settings file or environment variables.

Claude Code uses the Anthropic format (/v1/messages); use official model names.

Install

Install it with npm; it needs a recent Node.js.

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

Config file

Add this to the env block in ~/.claude/settings.json, save, and restart Claude Code.

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.relayvia.dev",
    "ANTHROPIC_AUTH_TOKEN": "sk-...",
    "ANTHROPIC_MODEL": "claude-opus-5"
  }
}

Replace sk-... with an API key from the console.

These settings were verified with version 2.1.303.

Environment variables

Or set the same environment variables in a terminal before starting Claude Code; they only apply to that terminal.

Terminal
export ANTHROPIC_BASE_URL=https://api.relayvia.dev
export ANTHROPIC_AUTH_TOKEN=sk-...
export ANTHROPIC_MODEL=claude-opus-5
claude

Troubleshooting

SymptomCauseFix
401 invalid_api_keyWrong, disabled or expired API keyCheck the key's status in the console and copy the full string starting with sk-; create a new key if needed.
402 insufficient_quotaThe account's credits, the key's limit or the team member's limit is used up, or the account is frozenTop up, or ask an admin to raise the limit. Retrying will not help.
403 forbiddenThe key may not use the model, the source IP is not on the allowlist, or the account is disabledCheck the key's allowed models and IP allowlist; use official model names as listed by /v1/models.
429 rate_limitedToo many requestsWait for Retry-After and retry; contact us if you regularly need more.
Cannot connect (timeout, DNS error or 404)Wrong base URL or no network accessMake sure ANTHROPIC_BASE_URL is https://api.relayvia.dev, without /v1. Test the network with curl https://api.relayvia.dev/v1/models.
Still asked to choose a login method, or an auth conflict warningYou signed in with a Claude account before, so that login and ANTHROPIC_AUTH_TOKEN both exist; or the environment variables are not appliedRun /logout inside Claude Code and restart it; make sure env is in ~/.claude/settings.json or exported in the current terminal.
WebSearch returns 400Web search is not available through RelayviaUse a search tool that runs on your machine, such as an MCP server, or paste the information into the conversation.