Skip to main content


All functionality related to Anthropic models.

Anthropic is an AI safety and research company, and is the creator of Claude. This page covers all integrations between Anthropic models and LangChain.


To use Anthropic models, you will need to install the langchain-anthropic package. You can do this with the following command:

pip install langchain-anthropic

Environment Setup

To use Anthropic models, you will need to set the ANTHROPIC_API_KEY environment variable. You can get an Anthropic API key here


ChatAnthropic is a subclass of LangChain's ChatModel. You can import this wrapper with the following code:

from langchain_anthropic import ChatAnthropic
model = ChatAnthropic(model='claude-3-opus-20240229')

Read more in the ChatAnthropic documentation.

[Legacy] AnthropicLLM

AnthropicLLM is a subclass of LangChain's LLM. It is a wrapper around Anthropic's text-based completion endpoints.

from langchain_anthropic import AnthropicLLM

model = AnthropicLLM(model='claude-2.1')

API Reference:

Help us out by providing feedback on this documentation page: