Anthropic Claude via AWS Bedrock.
Uses the AnthropicBedrock clients in the anthropic SDK.
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.
ChatAnthropicBedrock()Example:
# pip install -U langchain-anthropic
# export AWS_ACCESS_KEY_ID="your-access-key"
# export AWS_SECRET_ACCESS_KEY="your-secret-key"
# export AWS_REGION="us-east-1" # or AWS_DEFAULT_REGION
from langchain_anthropic import ChatAnthropicBedrock
model = ChatAnthropicBedrock(
model="us.anthropic.claude-sonnet-4-6",
# other params...
)
Note:
Any param which is not explicitly supported will be passed directly to
AnthropicBedrock.messages.create(...)
each time the model is invoked.
The aws region, e.g., us-west-2.
Falls back to AWS_REGION or AWS_DEFAULT_REGION env variable or region specified in ~/.aws/config in case it is not provided here.
AWS access key id.
If provided, aws_secret_access_key must also be provided. If not specified, the default credential profile or, if on an EC2 instance, credentials from IMDS will be used. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If not provided, will be read from 'AWS_ACCESS_KEY_ID' environment variable.
AWS secret_access_key.
If provided, aws_access_key_id must also be provided. If not specified, the default credential profile or, if on an EC2 instance, credentials from IMDS will be used. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If not provided, will be read from 'AWS_SECRET_ACCESS_KEY' environment variable.
AWS session token.
If provided, aws_access_key_id and aws_secret_access_key must also be provided. Not required unless using temporary credentials. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If not provided, will be read from 'AWS_SESSION_TOKEN' environment variable.
Return a mapping of secret keys to environment variables.