Skip to main content
You are currently on a page documenting the use of Anthropic legacy Claude 2 models as text completion models. The latest and most popular Anthropic models are chat completion models, and the text completion models have been deprecated.You are probably looking for this page instead.
This example goes over how to use LangChain to interact with Anthropic models.

Installation

Environment Setup

We’ll need to get an Anthropic API key and set the ANTHROPIC_API_KEY environment variable:

Usage