Amazon Bedrock API
Anthropic’s Claude models are now generally available through Amazon Bedrock.
Calling Claude through Bedrock slightly differs from how you would call Claude when using Anthropic’s client SDK’s. This guide will walk you through the process of completing an API call to Claude on Bedrock in either Python or TypeScript.
Note that this guide assumes you have already signed up for an AWS account and configured programmatic access.
Install and configure the AWS CLI
- Install a version of the AWS CLI at or newer than version
2.13.23
- Configure your AWS credentials using the AWS configure command (see Configure the AWS CLI) or find your credentials by navigating to “Command line or programmatic access” within your AWS dashboard and following the directions in the popup modal.
- Verify that your credentials are working:
Install an SDK for accessing Bedrock
Anthropic’s client SDKs support Bedrock. You can also use an AWS SDK like boto3
directly.
Accessing Bedrock
Subscribe to Anthropic models
Go to the AWS Console > Bedrock > Model Access and request access to Anthropic models. Note that Anthropic model availability varies by region. See AWS documentation for latest information.
API model names
Model | Bedrock API model name |
---|---|
Claude Opus 4 | anthropic.claude-opus-4-20250514-v1:0 |
Claude Sonnet 4 | anthropic.claude-sonnet-4-20250514-v1:0 |
Claude Sonnet 3.7 | anthropic.claude-3-7-sonnet-20250219-v1:0 |
Claude Haiku 3.5 | anthropic.claude-3-5-haiku-20241022-v1:0 |
Claude Sonnet 3.5 | anthropic.claude-3-5-sonnet-20241022-v2:0 |
Claude Opus 3 | anthropic.claude-3-opus-20240229-v1:0 |
Claude Sonnet 3 | anthropic.claude-3-sonnet-20240229-v1:0 |
Claude Haiku 3 | anthropic.claude-3-haiku-20240307-v1:0 |
List available models
The following examples show how to print a list of all the Claude models available through Bedrock:
Making requests
The following examples show how to generate text from Claude on Bedrock:
See our client SDKs for more details, and the official Bedrock docs here.
Activity logging
Bedrock provides an invocation logging service that allows customers to log the prompts and completions associated with your usage.
Anthropic recommends that you log your activity on at least a 30-day rolling basis in order to understand your activity and investigate any potential misuse.
Turning on this service does not give AWS or Anthropic any access to your content.
Feature support
You can find all the features currently supported on Bedrock here.
PDF Support on Bedrock
PDF support is available on Amazon Bedrock through both the Converse API and InvokeModel API. For detailed information about PDF processing capabilities and limitations, see the PDF support documentation.
Important considerations for Converse API users:
- Visual PDF analysis (charts, images, layouts) requires citations to be enabled
- Without citations, only basic text extraction is available
- For full control without forced citations, use the InvokeModel API
For more details on the two document processing modes and their limitations, refer to the PDF support guide.