ChatAnthropic()Denotes the number of tokens to predict per generation.
If not specified, this is set dynamically using the model's max_output_tokens
from its model profile.
See docs on model profiles for more information.
Automatically reuse container from most recent response (code execution).
When using the built-in
code execution tool,
model responses will include container metadata. Set reuse_last_container=True
to automatically reuse the container from the most recent response for subsequent
invocations.
Controls where model inference runs. See Anthropic's data residency docs for more information.
Model wrapper that returns outputs formatted to match the given schema.
See the LangChain docs for more details and examples.
Count tokens in a sequence of input messages.
This uses Anthropic's official token counting API.
Anthropic (Claude) chat models.
See the LangChain docs for ChatAnthropic
for tutorials, feature walkthroughs, and examples.
See the Claude Platform docs for a list of the latest models, their capabilities, and pricing.
Example:
# pip install -U langchain-anthropic
# export ANTHROPIC_API_KEY="your-api-key"
from langchain_anthropic import ChatAnthropic
model = ChatAnthropic(
model="claude-sonnet-4-5-20250929",
# temperature=,
# max_tokens=,
# timeout=,
# max_retries=,
# base_url="...",
# Refer to API reference for full list of parameters
)
Note:
Any param which is not explicitly supported will be passed directly to
Anthropic.messages.create(...)
each time to the model is invoked.