Heuristic:Langchain ai Langchain Warning Deprecated AnthropicLLM
| Knowledge Sources | |
|---|---|
| Domains | Deprecation, Migration |
| Last Updated | 2026-02-11 14:00 GMT |
Overview
The `AnthropicLLM` text-completion class is deprecated. Use `ChatAnthropic` instead.
Description
The `AnthropicLLM` class in `langchain_anthropic.llms` wraps the legacy Anthropic text-completion API. A model validator emits a deprecation warning on instantiation: "This Anthropic LLM is deprecated. Please use `from langchain_anthropic import ChatAnthropic` instead." Anthropic itself has deprecated the text-completion endpoint in favor of the Messages API, which `ChatAnthropic` uses.
Usage
Apply this warning when encountering any use of `AnthropicLLM` or `from langchain_anthropic import AnthropicLLM`. Users should migrate to `ChatAnthropic`.
The Insight (Rule of Thumb)
- Action: Replace `AnthropicLLM` with `ChatAnthropic` from `langchain_anthropic`.
- Value: `ChatAnthropic` supports the Messages API, tool calling, streaming, and all modern Anthropic features.
- Trade-off: `ChatAnthropic` uses a different API interface (chat messages vs. text completion). Code must adapt input/output handling.
Reasoning
Anthropic deprecated their text-completion API in favor of the Messages API. The `AnthropicLLM` class wraps the deprecated endpoint. The `ChatAnthropic` class provides full access to modern features including vision, tool use, and extended thinking.