Claude Code

Claude Code is Anthropic’s terminal coding agent. Point it at ApiGo’s Anthropic-compatible gateway so Claude requests use your ApiGo key, routing, and billing.

Prerequisites

Install Claude Code

macOS, Linux, WSL:

curl -fsSL https://claude.ai/install.sh | bash

Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

Or via npm (Node.js 18+):

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

Connect Claude Code to ApiGo

Clear any stale Anthropic overrides first:

unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_API_KEY

Add to ~/.zshrc or ~/.bashrc:

export APIGO_API_KEY="sk-apigo-..."
export ANTHROPIC_BASE_URL="https://api.apigo.ai"
export ANTHROPIC_AUTH_TOKEN="$APIGO_API_KEY"
export ANTHROPIC_API_KEY=""   # must be explicitly empty

Restart the terminal after saving.

Option B: Claude settings file

Edit ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.apigo.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-apigo-...",
    "ANTHROPIC_API_KEY": ""
  }
}

Or scope the same env block to a project with .claude/settings.local.json. Do not put these values in a project .env file — the native Claude Code installer does not read it.

Also mark onboarding complete in ~/.claude.json if Claude Code keeps prompting for Anthropic login:

{
  "hasCompletedOnboarding": true
}

Environment variables take precedence over the settings file.

Clear a cached Anthropic login

If you previously signed in with an Anthropic account, run /logout inside Claude Code once, quit, and relaunch:

> /logout

Start a session

cd /path/to/your/project
claude

Verify with /status. Confirm traffic under Workspace → Call Logs.

Troubleshooting

Symptom Fix
Auth / model-not-found on startup Run /logout, ensure ANTHROPIC_API_KEY is empty, and relaunch
Still hits Anthropic directly Check shell exports; remove conflicting ANTHROPIC_* values
401 from ApiGo Rotate or recreate the key in API Keys

Resources