Anthropic

Native Anthropic API support with prompt caching, streaming, and OAuth passthrough.

Configuration

Set your Anthropic API key:

1export ANTHROPIC_API_KEY=sk-ant-api03-...

Endpoints

RelayPlane supports both the native Anthropic API and OpenAI-compatible format:

  • POST /v1/messages — Native Anthropic Messages API (used by Claude Code)
  • POST /v1/chat/completions — OpenAI-compatible format (auto-converts to/from Anthropic)
  • POST /v1/messages/count_tokens — Token counting passthrough

Supported Models

AliasResolves To
opusclaude-opus-4-6
sonnetclaude-sonnet-4-6
haikuclaude-haiku-4-5
claude-3-5-sonnetclaude-3-5-sonnet-latest
claude-3-5-haikuclaude-haiku-4-5

You can also use any full model ID like claude-sonnet-4-20250514 directly.

Prompt Caching

Anthropic prompt caching is fully supported. RelayPlane:

  • Passes through anthropic-beta headers for cache control
  • Tracks cache_creation_input_tokens and cache_read_input_tokens in telemetry
  • Accounts for cache pricing in cost estimates (1.25× for creation, 0.1× for reads)

Authentication Modes

Authentication priority (highest to lowest):

  1. Incoming Authorization header (Bearer token from Claude Code OAuth)
  2. Incoming x-api-key header
  3. ANTHROPIC_API_KEY environment variable

Hybrid Auth

If you have a MAX subscription token for Opus models and a regular API key for others, configure hybrid auth:

1{
2 "auth": {
3 "anthropicMaxToken": "sk-ant-oat-...",
4 "useMaxForModels": ["opus", "claude-opus"]
5 }
6}

MAX tokens (sk-ant-oat*) use the Authorization: Bearer header, while regular API keys use x-api-key.

Tool Calling

When using the OpenAI-compatible endpoint, RelayPlane automatically converts between formats:

  • OpenAI tools → Anthropic tools (name, description, input_schema)
  • OpenAI tool_choice → Anthropic tool_choice
  • Anthropic tool_use responses → OpenAI tool_calls format
Base URL: The Anthropic API endpoint is https://api.anthropic.com/v1. This is hardcoded and not configurable.