All guides

OfficialAnthropic-compatibleAnthropic

Claude Code

Anthropic's official terminal agent.

Claude Code speaks the Anthropic Messages protocol. Use an Anthropic key directly, or point it at any Anthropic-compatible endpoint with two environment variables.

Official docs

Setup steps

  1. 1

    Install the CLI

    Requires Node.js 18 or newer. Installs the global claude command.

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

    Option A: use your Anthropic key

    Set your key from the Anthropic Console. Windows keeps it across sessions; reopen the terminal after setx.

    bash / zsh
    export ANTHROPIC_API_KEY="your-api-key"
    PowerShell
    setx ANTHROPIC_API_KEY "your-api-key"
  3. 3

    Option B: use a custom endpoint

    Route every request to a cheaper Anthropic-compatible gateway. Replace the URL and key with your provider's values.

    bash / zsh
    export ANTHROPIC_BASE_URL="https://api.example.com"
    export ANTHROPIC_AUTH_TOKEN="your-api-key"
  4. 4

    Make it permanent

    Instead of exporting each time, save the endpoint and key in the settings file so every session picks them up.

    ~/.claude/settings.json
    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://api.example.com",
        "ANTHROPIC_AUTH_TOKEN": "your-api-key"
      }
    }
  5. 5

    Start coding

    Run it inside your project folder. It reads and edits files right where you are.

    bash
    claude
Tip: A base URL that is not api.anthropic.com is treated as a third-party gateway. Use ANTHROPIC_AUTH_TOKEN for gateways that expect a bearer token.
Pick a cheaper model or provider first, then plug its key and endpoint into the steps above. Compare prices · Browse providers