> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://doc.enterpriserouter.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://doc.enterpriserouter.com/_mcp/server.

# Anthropic (Native Mode)

## Setup

Install the Anthropic SDK:

```bash
pip install anthropic
```

Configure the client:

```python
import anthropic

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

## Basic message

```python
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

```python
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

```python
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

```python
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

```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.