Claude Code
Point Claude Code at the gateway, multi-provider routing, and Anthropic release checklist.
Last updated: 2026-07-23
Claude Code talks Anthropic Messages (POST /v1/messages, SSE, tools, betas, count_tokens). Through the gateway you can:
- Passthrough to Anthropic (API key or subscription OAuth), or
- Translate to ChatGPT / SuperGrok / other OpenAI-compatible hosts while still using the Claude Code UI.
Start here for day-to-day use
Claude Code with ChatGPT, Claude & SuperGrok — full operator guide:
- Subscription OAuth login (
llm-gateway auth login …) - Any provider combo (
gpt,grok,gpt+grok,multi, …) - Grok 4.5 + Composer 2.5 aliases
- Shell helpers, settings.json, troubleshooting
This page is the Anthropic path checklist (release sign-off + minimal wiring). Prefer hermetic Go tests in CI; run the manual block for release candidates.
Minimal wiring (API key)
export ANTHROPIC_BASE_URL=http://localhost:8787
export ANTHROPIC_API_KEY=sk-ant-… # or edge key when edge_auth is on
# optional: export ANTHROPIC_MODEL=claude-sonnet-4-20250514
claude
# or: ./examples/claude-code.shproviders:
anthropic:
kind: anthropic
base_url: "https://api.anthropic.com/v1"
api_key_env: ANTHROPIC_API_KEY
defaults:
anthropic_dialect: anthropicWith edge_auth enabled, set ANTHROPIC_API_KEY / KEY to an edge key and keep the upstream secret in api_key_env (or subscription oauth.credentials).
Automated coverage
go test ./proxy/ -count=1
go test ./ingress/anthropic/ ./egress/anthropic/ -count=1| Area | Tests (representative) |
|---|---|
| Messages passthrough | TestAnthropicStreamPassthrough, non-stream Anthropic server tests in proxy/* |
| Upstream errors | TestAnthropicUpstreamError, TestAnthropicToOpenAIUpstreamErrorTranslated |
| Translate path | TestOpenAIToAnthropic*, TestAnthropicToOpenAI* |
| count_tokens | TestCountTokens*, proxy/count_tokens_test.go |
| Edge auth open healthz | TestEdgeAuthHealthzOpen |
Manual release sign-off
Config sketch
providers:
anthropic:
kind: anthropic
base_url: "https://api.anthropic.com/v1"
api_key_env: ANTHROPIC_API_KEY
deepseek:
kind: openai_compat
base_url: "https://api.deepseek.com"
api_key_env: DEEPSEEK_API_KEY
defaults:
anthropic_dialect: anthropic
aliases:
# cheap: deepseek/deepseek-chatFunctional checks
- Non-stream short completion
- Stream completion (tokens appear incrementally; no truncated SSE)
- Tool use / function calling round-trip
- Multimodal image input (if used in your workflows)
-
count_tokensstill returns a number - Prompt-caching / beta headers: client
anthropic-betavalues reach upstream on passthrough - Model routing: bare id → anthropic default;
provider/modeland aliases - Translated path (optional):
ANTHROPIC_MODEL=deepseek/deepseek-chat— full translation; streaminput_tokensmay be 0 until final event
Negative checks
- Bad key → Anthropic-shaped error envelope
- Unknown model provider → 404 dialect error
- Gateway
/healthzstill 200 without credentials
Sign-off
-
go test ./... -racegreen - CHANGELOG entry if Anthropic surface or caveats changed
- No secrets committed
Known limitations (translated path)
| Topic | Behavior |
|---|---|
| Anthropic → openai_compat stream | message_start.input_tokens may be 0 until final usage |
| OpenAI-only fields | Dropped on translate — Deprecation policy |
| Files / Batch APIs | Not required for Claude Code chat |
| Media Contract Anthropic images | Planned; not required for text Claude Code |