> ## Documentation Index
> Fetch the complete documentation index at: https://thethirdpenco-feat-tool-lifecycle-events.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# anthropic()

> Create an Anthropic Claude language model

Factory function to create an Anthropic Claude model instance.

## Signature

```python theme={null}
def anthropic(model_id: str) -> LanguageModel
```

## Parameters

<ParamField path="model_id" type="str" required>
  The Anthropic model identifier.
</ParamField>

## Returns

A `LanguageModel` instance configured for Anthropic.

## Environment

Requires `ANTHROPIC_API_KEY` environment variable.

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

## Available Models

| Model ID                     | Description                                     |
| ---------------------------- | ----------------------------------------------- |
| `claude-4-5-opus-20251101`   | Claude 4.5 Opus - most capable                  |
| `claude-4-5-sonnet-20250929` | Claude 4.5 Sonnet - powerful with Thinking mode |
| `claude-4-5-haiku-20251001`  | Claude 4.5 Haiku - fast and efficient           |
| `claude-4-opus-20250514`     | Claude 4 Opus - high capability                 |
| `claude-4-sonnet-20250514`   | Claude 4 Sonnet - balanced                      |
| `claude-3-5-sonnet-latest`   | Claude 3.5 Sonnet - reliable                    |
| `claude-3-5-haiku-latest`    | Claude 3.5 Haiku - fastest                      |

## Example

```python theme={null}
from ai_query import generate_text
from ai_query.providers import anthropic

result = await generate_text(
    model=anthropic("claude-4-5-sonnet-20250929"),
    prompt="Hello, world!"
)
```

## Provider Options

```python theme={null}
result = await generate_text(
    model=anthropic("claude-4-5-sonnet-20250929"),
    prompt="Be creative.",
    provider_options={
        "anthropic": {
            "temperature": 0.7,
            "max_tokens": 2000,
            "top_p": 0.9
        }
    }
)
```
