Skip to content

Integration guide

Claude Code

Claude Code speaks the Anthropic API. Point its base URL at Relay's Anthropic-compatible endpoint, swap in your Relay key, and every request bills per token against your balance — any published model works.

Setup

  1. 1

    Create a Relay API key in the console (it starts with sk-relay-).

  2. 2

    Merge the env block below into ~/.claude/settings.json — ANTHROPIC_AUTH_TOKEN carries your key, ANTHROPIC_BASE_URL points at Relay's Anthropic-compatible endpoint.

  3. 3

    Replace YOUR_MODEL_ID with any model from the catalog, then restart Claude Code. Requests now meter per token against your Relay balance.

Configuration

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-relay-your-key",
    "ANTHROPIC_BASE_URL": "https://proxystacks.com/anthropic",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "YOUR_MODEL_ID",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "YOUR_MODEL_ID",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "YOUR_MODEL_ID",
    "ANTHROPIC_SMALL_FAST_MODEL": "YOUR_MODEL_ID"
  }
}

Merge into the env block of ~/.claude/settings.json, then restart Claude Code. ANTHROPIC_AUTH_TOKEN is sent as a Bearer token.

All docs