# Anthropic

> **Class** in `langchain_community`

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

Anthropic large language models.

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

## Signature

```python
Anthropic()
```

## Description

**Example:**

.. code-block:: python

import anthropic
from langchain_community.llms import Anthropic

model = Anthropic(model="<model_name>", anthropic_api_key="my-api-key")

# Simplest invocation, automatically wrapped with HUMAN_PROMPT
# and AI_PROMPT.
response = model.invoke("What are the biggest risks facing humanity?")

# Or if you want to use the chat mode, build a few-shot-prompt, or
# put words in the Assistant's mouth, use HUMAN_PROMPT and AI_PROMPT:
raw_prompt = "What are the biggest risks facing humanity?"
prompt = f"{anthropic.HUMAN_PROMPT} {prompt}{anthropic.AI_PROMPT}"
response = model.invoke(prompt)

## Extends

- `LLM`
- `_AnthropicCommon`

## Properties

- `model_config`

## Methods

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

## ⚠️ Deprecated

Deprecated since version 0.0.28.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/d5ea8358933260ad48dd31f7f8076555c7b4885a/libs/community/langchain_community/llms/anthropic.py#L150)