Claude Code

Route Claude Code requests through RelayPlane for automatic model selection and cost savings.

Setup

Claude Code uses the native Anthropic /v1/messages API. Point it at RelayPlane by setting a single environment variable:

1export ANTHROPIC_BASE_URL=http://localhost:4100

Then start Claude Code as usual. All requests will flow through RelayPlane.

How It Works

RelayPlane intercepts the native Anthropic API calls and:

  • Classifies each request by complexity (simple/moderate/complex)
  • Routes simple tasks to cheaper models (e.g., Sonnet instead of Opus)
  • Passes through authentication — your Anthropic API key or OAuth token works unchanged
  • Supports streaming, prompt caching, and extended thinking
  • Passes through anthropic-beta headers

Authentication

RelayPlane supports multiple auth modes for Anthropic:

  • Passthrough (default): Forwards your incoming Authorization header or x-api-key to Anthropic
  • Env fallback: Uses ANTHROPIC_API_KEY env var if no auth header is present
  • Hybrid auth: Can use different keys for different models (e.g., MAX subscription token for Opus, API key for Sonnet)

Shell Configuration

Add to your shell profile (~/.bashrc, ~/.zshrc, etc.) for permanent setup:

1# RelayPlane proxy for Claude Code
2export ANTHROPIC_BASE_URL=http://localhost:4100
Tip: Set routing.mode to "auto" in your config to enable complexity-based routing even when Claude Code requests a specific model.