# AnthropicLLM

> **Class** in `langchain_anthropic`

📖 [View in docs](https://reference.langchain.com/python/langchain-anthropic/llms/AnthropicLLM)

Anthropic text completion large language model (legacy LLM).

To use, you should have the environment variable `ANTHROPIC_API_KEY`
set with your API key, or pass it as a named parameter to the constructor.

## Signature

```python
AnthropicLLM()
```

## Description

**Example:**

```python
from langchain_anthropic import AnthropicLLM

model = AnthropicLLM(model="claude-sonnet-4-5")
```

## Extends

- `LLM`
- `_AnthropicCommon`

## Properties

- `model_config`
- `lc_secrets`

## Methods

- [`raise_warning()`](https://reference.langchain.com/python/langchain-anthropic/llms/AnthropicLLM/raise_warning)
- [`is_lc_serializable()`](https://reference.langchain.com/python/langchain-anthropic/llms/AnthropicLLM/is_lc_serializable)
- [`convert_prompt()`](https://reference.langchain.com/python/langchain-anthropic/llms/AnthropicLLM/convert_prompt)
- [`get_num_tokens()`](https://reference.langchain.com/python/langchain-anthropic/llms/AnthropicLLM/get_num_tokens)

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/6fb37dba71da807af60aa7b909f71f0625a666bf/libs/partners/anthropic/langchain_anthropic/llms.py#L134)