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:4100Then 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-betaheaders
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_KEYenv 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 Code2export ANTHROPIC_BASE_URL=http://localhost:4100Tip: Set
routing.mode to "auto" in your config to enable complexity-based routing even when Claude Code requests a specific model.