Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.inference.net/llms.txt

Use this file to discover all available pages before exploring further.

Route your Anthropic requests through the Inference Catalyst gateway to get cost tracking, latency monitoring, and analytics. Anthropic uses its native SDK and the /v1/messages endpoint, not the OpenAI-compatible path.
Prefer automatic setup? Run inf instrument to instrument your codebase in seconds. Learn more

Setup

1

Get your API keys

You need two keys:
2

Set environment variables

export INFERENCE_API_KEY=<your-project-api-key>
export ANTHROPIC_API_KEY=<your-anthropic-api-key>
3

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.
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.inference.net",
  apiKey: process.env.ANTHROPIC_API_KEY,
  defaultHeaders: {
    "Authorization": `Bearer ${process.env.INFERENCE_API_KEY}`,
    "x-inference-provider": "anthropic",
    "x-inference-environment": process.env.NODE_ENV,
  },
});

const response = await client.messages.create({
  model: "claude-opus-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello" }],
}, {
  headers: { "x-inference-task-id": "default" },
});