> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic

> Using Anthropic Claude models with Upsonic

## Overview

Anthropic provides the Claude family of models known for safety, accuracy, and extended thinking capabilities. Upsonic supports all Claude models including Claude 3.5, Claude 3.7, and Claude 4.

**Model Class:** `AnthropicModel`

## Authentication

```bash theme={null}
export ANTHROPIC_API_KEY="sk-ant-..."
```

## Examples

```python theme={null}
from upsonic import Agent, Task
from upsonic.models.anthropic import AnthropicModel

model = AnthropicModel(model_name="claude-3-5-sonnet-20241022")
agent = Agent(model=model)

task = Task("Hello, how are you?")
result = agent.do(task)
print(result)
```

## Model Settings

You can set model parameters in two ways: on the model or on the Agent.

**On the model:**

```python theme={null}
from upsonic import Agent, Task
from upsonic.models.anthropic import AnthropicModel, AnthropicModelSettings

model = AnthropicModel(
    model_name="claude-sonnet-4-5",
    settings=AnthropicModelSettings(max_tokens=2048, temperature=0.5)
)
agent = Agent(model=model)
```

**On the Agent:**

```python theme={null}
from upsonic import Agent, Task
from upsonic.models.anthropic import AnthropicModelSettings

agent = Agent(
    model="anthropic/claude-sonnet-4-5",
    settings=AnthropicModelSettings(max_tokens=2048, temperature=0.5)
)
```

## Parameters

| Parameter            | Type             | Description                     | Default | Source   |
| -------------------- | ---------------- | ------------------------------- | ------- | -------- |
| `max_tokens`         | `int`            | Maximum tokens to generate      | 4096    | Base     |
| `temperature`        | `float`          | Sampling temperature (0.0-1.0)  | 1.0     | Base     |
| `top_p`              | `float`          | Nucleus sampling threshold      | 1.0     | Base     |
| `stop_sequences`     | `list[str]`      | Sequences that stop generation  | None    | Base     |
| `timeout`            | `float`          | Request timeout in seconds      | 600     | Base     |
| `extra_headers`      | `dict[str, str]` | Additional HTTP headers         | None    | Base     |
| `anthropic_metadata` | `dict`           | Request metadata with user\_id  | None    | Specific |
| `anthropic_thinking` | `dict`           | Extended thinking configuration | None    | Specific |
