Model providers
Gateway
Anthropic
Route Anthropic requests through Inference for full observability.
Route your Anthropic requests through the Inference gateway to get cost tracking, latency monitoring, and analytics. Anthropic uses its native SDK and the /v1/messages endpoint, not the OpenAI-compatible path.
This page is for routing to Anthropic's own Claude models with your Anthropic API key. To call Inference-hosted models like
glm-5.2 with the Anthropic SDK, see Anthropic SDK. That only needs your Inference API key.Prefer automatic setup? Run
inf instrument to instrument your codebase in seconds. Learn moreSetup
Get your API keys
You need two keys:
- Inference project API key — from your dashboard under API Keys
- Anthropic API key — from your Anthropic console
Set environment variables
export INFERENCE_API_KEY=<your-project-api-key>
export ANTHROPIC_API_KEY=<your-anthropic-api-key>Update your code
Point the SDK at the gateway. Because the Anthropic SDK sends apiKey as the x-api-key header, you pass your Anthropic key there and add the Inference project key as an Authorization header.