We recommend the Converse API for users who do not need to use custom models. It can be accessed using
ChatBedrockConverse.Anthropic models on BedrockFor Anthropic models specifically, you can use
ChatAnthropicBedrock which extends ChatAnthropic and provides the same API while running on AWS Bedrock. 请参阅 ChatAnthropicBedrock section below for details.概述
集成详情
模型功能
The below apply to bothChatBedrock and ChatBedrockConverse.
设置
要访问 Bedrock 模型,您需要创建一个 AWS account, set up the Bedrock API service, get an access key ID and secret key, and install thelangchain-aws 集成包。
凭证
Head to the AWS docs 注册 AWS and setup your credentials. Alternatively,ChatBedrockConverse will read from the following environment variables by default:
安装
LangChain 的 Bedrock 集成位于langchain-aws 包中:
实例化
现在我们可以实例化模型对象并生成聊天补全:调用
流式输出
Note thatChatBedrockConverse emits content blocks while streaming:
text property on the output:
Streaming tool calls and structured output
当使用 tool calling or structured output with Anthropic models, tool call arguments stream as partial JSON chunks by default. To reduce latency and get more evenly distributed chunks, you can enable Anthropic’s fine-grained tool streaming beta:Fine-grained tool streaming is supported on Claude 4.5+ models. 请参阅 Claude documentation 了解更多详情。
Extended thinking
This guide focuses on implementing Extended Thinking using AWS Bedrock with LangChain’sChatBedrockConverse integration.
Supported models
Extended Thinking is available for the following Claude models on AWS Bedrock:How extended thinking works
When extended thinking is turned on, Claude creates thinking content blocks where it outputs its internal reasoning. Claude incorporates insights from this reasoning before crafting a final response. The API response will include thinking content blocks, followed by text content blocks.Prompt caching
Bedrock supports caching of elements of your prompts, including messages and tools. This allows you to re-use large documents, instructions, few-shot documents, and other data to reduce latency and costs.Not all models support prompt caching. See Bedrock prompt caching supported models.
cachePoint key. See example below:
Citations
Citations can be generated if they are enabled on input documents. Documents can be specified in Bedrock’s native format or LangChain’s standard types:ChatAnthropicBedrock
For AWS Bedrock users specifically interested in Anthropic models,langchain-aws provides ChatAnthropicBedrock. This class extends ChatAnthropic and provides the same interface while running on AWS Bedrock infrastructure. This takes advantage of the Anthropic SDK’s Bedrock clients.
安装
Installlangchain-aws with the anthropic extra to get the required dependencies:
使用方法
ChatAnthropicBedrock supports the same features and parameters as ChatAnthropic. You can initialize it with AWS-specific parameters:
ChatAnthropic integration page.
API 参考
有关所有ChatBedrock, ChatBedrockConverse, and ChatAnthropicBedrock features and configurations head to the API reference.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

