Skip to navigation
Native Mode

Anthropic (Native Mode)

Use the Anthropic SDK with Enterprise Router

Setup

Install the Anthropic SDK:

pip install anthropic

Configure the client:

import anthropic
client = anthropic.Anthropic(
api_key="sk-proxy-YOUR_KEY_HERE",
base_url="https://api.enterpriserouter.com/anthropic"
)

Basic message

message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[
{"role": "user", "content": "Explain quantum computing in one paragraph."}
]
)
print(message.content[0].text)

Streaming

with client.messages.stream(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a haiku about APIs."}]
) as stream:
for text in stream.text_stream:
print(text, end="")

Tool use

message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
tools=[
{
"name": "get_weather",
"description": "Get the current weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
],
messages=[{"role": "user", "content": "What's the weather in Tokyo?"}]
)
for block in message.content:
if block.type == "tool_use":
print(f"Tool: {block.name}, Input: {block.input}")

System prompts

message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
system="You are a senior software engineer. Be concise and precise.",
messages=[{"role": "user", "content": "Review this function: def add(a, b): return a + b"}]
)

TypeScript

import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "sk-proxy-YOUR_KEY_HERE",
baseURL: "https://api.enterpriserouter.com/anthropic",
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello!" }],
});
console.log(message.content[0].text);

Notes

  • anthropic-version header: The gateway automatically sets anthropic-version: 2023-06-01 if your request doesn’t include one.
  • All Anthropic features are supported: vision, tool use, extended thinking, batches — the request is proxied unmodified.

Supported models

  • claude-opus-4-6, claude-sonnet-4-6
  • claude-opus-4-5, claude-haiku-4-5

New Anthropic models work automatically.