# Anthropic (Claude)

## Endpoints

| Protocol | URL |
|---|---|
| Claude native | `https://www.aixapi.io/v1/messages` |
| OpenAI-compatible | `https://www.aixapi.io/v1/chat/completions` |

```python
import anthropic

client = anthropic.Anthropic(base_url="https://www.aixapi.io", api_key="sk-...")
msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
```

```python
from openai import OpenAI

client = OpenAI(base_url="https://www.aixapi.io/v1", api_key="sk-...")
resp = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
```

## Thinking

| Protocol | Parameter | Values |
|---|---|---|
| Claude native | `thinking` | `{"type": "enabled", "budget_tokens": 2000}` |
| Claude native | `output_config.effort` | `low`, `medium`, `high`, `xhigh`, `max` |
| OpenAI-compatible | `reasoning_effort` | Same |

With `thinking` enabled the reply includes `thinking` blocks; reasoning tokens count as output.

```python
msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=4000,
    thinking={"type": "enabled", "budget_tokens": 2000},
    messages=[{"role": "user", "content": "Is 9.11 greater than 9.9?"}],
)
```

## Tool calling

Supported, Claude `tools` format (`input_schema`).

## Image input

Supported, `image` content blocks with `source.type` `base64` or `url`.

## Claude Code

```bash
export ANTHROPIC_BASE_URL=https://www.aixapi.io
export ANTHROPIC_AUTH_TOKEN=sk-...
export ANTHROPIC_MODEL=claude-sonnet-4-6
claude
```
