Claude on Amazon Bedrock (Opus 4.6 and earlier)
The legacy Amazon Bedrock integration for Claude models, using InvokeModel and Converse APIs with ARN-versioned model identifiers.
Calling Claude through Bedrock slightly differs from how you would call Claude on the Claude API directly. This guide walks you through completing an API call to Claude on Bedrock using one of Anthropic's client SDKs.
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 modal window.
- Verify that your credentials are working:
aws sts get-caller-identityInstall an SDK for accessing Bedrock
Anthropic's client SDKs support Bedrock. You can also use an AWS SDK like boto3 directly.
pip install -U "anthropic[bedrock]"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 IDs
Lifecycle terms (Deprecated, Retired) are defined in Model deprecations. Lifecycle dates on partner-operated platforms are set by the partner and can differ from the Claude API schedule. For the current retirement date of any model on Amazon Bedrock, see Amazon Bedrock's model lifecycle page.
AWS offers newer Claude models through cross-region inference rather than on-demand throughput. For these models, a request that passes the base model ID fails with an HTTP 400 error like the following:
Invocation of model ID anthropic.claude-sonnet-4-5-20250929-v1:0 with on-demand throughput isn't supported. Retry your request with the ID or ARN of an inference profile that contains this model.To invoke these models, pass an inference profile instead of the base model ID. The inference profile ID is the base model ID with a prefix from a column marked "Yes" in the following table, for example . You can also pass the full inference profile ARN, in the form arn:aws:bedrock:{region}:{account-id}:inference-profile/{inference-profile-id}. For AWS's authoritative list of available inference profiles, see Supported Regions and models for inference profiles. To learn how the prefixes affect routing and pricing, see the Global versus regional endpoints section.
| Model | Base Bedrock model ID | global | us | eu | jp | apac |
|---|---|---|---|---|---|---|
| Claude Opus 4.6 | Yes | Yes | Yes | Yes | Yes | |
| Claude Sonnet 4.6 | Yes | Yes | Yes | Yes | No | |
| Claude Sonnet 4.5 | Yes | Yes | Yes | Yes | No | |
| Claude Sonnet 4 Deprecated. | Yes | Yes | Yes | No | Yes | |
| Claude Sonnet 3.7 Retired. | No | No | No | No | No | |
| Claude Opus 4.5 | Yes | Yes | Yes | No | No | |
| Claude Opus 4.1 Deprecated. | No | Yes | No | No | No | |
| Claude Opus 4 Retired. | No | No | No | No | No | |
| Claude Haiku 4.5 | Yes | Yes | Yes | No | No | |
| Claude Haiku 3.5 Deprecated. | No | Yes | No | No | No |
List available models
The following examples show how to print a list of all the Claude models available through Bedrock:
import boto3
bedrock = boto3.client(service_name="bedrock")
response = bedrock.list_foundation_models(byProvider="anthropic")
for summary in response["modelSummaries"]:
print(summary["modelId"])Making requests
The following examples show how to generate text from Claude on Bedrock:
from anthropic import AnthropicBedrock
client = AnthropicBedrock(
# Authenticate by either providing the keys below or use the default AWS credential providers, such as
# using ~/.aws/credentials or the "AWS_SECRET_ACCESS_KEY" and "AWS_ACCESS_KEY_ID" environment variables.
aws_access_key="<access key>",
aws_secret_key="<secret key>",
# Temporary credentials can be used with aws_session_token.
# Read more at https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html.
aws_session_token="<session_token>",
# aws_region changes the aws region to which the request is made. If it is not provided, the SDK reads
# AWS_REGION / AWS_DEFAULT_REGION, then the region configured for your boto3 session or AWS profile
# (including ~/.aws/config), and raises ValueError if no region can be resolved.
aws_region="us-west-2",
)
message = client.messages.create(
model="global.anthropic.claude-opus-4-6-v1",
max_tokens=256,
messages=[{"role": "user", "content": "Hello, world"}],
)
print(message.content)See the client SDKs for more details, and the official Bedrock documentation.
Bearer token authentication
You can authenticate with Bedrock using bearer tokens instead of AWS credentials. This is useful in corporate environments where teams need access to Bedrock without managing AWS credentials, IAM roles, or account-level permissions.
The simplest approach is to set the AWS_BEARER_TOKEN_BEDROCK environment variable, which each SDK detects automatically when resolving credentials from the environment.
To provide a token programmatically:
from anthropic import AnthropicBedrock
client = AnthropicBedrock(
api_key="your-bearer-token",
aws_region="us-west-2",
)
message = client.messages.create(
model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content)Activity logging
Bedrock provides an invocation logging service that allows you 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 to understand your activity and investigate any potential misuse.
Feature support
For the full feature list with Amazon Bedrock availability, see Features overview.
Supported feature highlights
- Messages API
- Prompt caching
- Thinking
- Tool use, including the Bash tool, Computer use tool, Memory tool, and Text editor tool
- Citations
- Structured outputs
Features not supported
- Input sources (URL sources for images and documents, Files API)
- Server-side tools (code execution, web search, web fetch, advisor)
- Agent infrastructure (Agent Skills, MCP connector, programmatic tool calling)
- API endpoints (Message Batches, Models, Admin, Compliance, Usage and Cost)
- Claude Managed Agents
- Server-side fallback (the
fallbacksparameter; use the client-side fallback pattern instead) - Automatic prompt caching (the top-level
cache_controlfield; use explicit cache breakpoints instead) - Computer use and browser use toolsets (
computer_toolset_20260801andbrowser_toolset_20260801are not currently available on Amazon Bedrock; the beta computer use tool versions remain available)
PDF support on Bedrock
PDF support is available on Bedrock through both the Converse API and InvokeModel API. For detailed information about PDF processing capabilities and limitations, see Amazon Bedrock PDF support.
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
Mid-conversation system messages on Bedrock
Mid-conversation system messages are available through the InvokeModel API for Claude Fable 5.1, Claude Fable 5, Claude Opus 5, and Claude Opus 4.8. As described in the note under API model IDs, these requests are served by the same infrastructure as the Claude in Amazon Bedrock endpoint. No beta header is required. This feature is not available on Claude Sonnet 5. Use the top-level system field instead. It is not available for the ARN-versioned models in the model table on this page.
For Converse API users: the Converse API accepts system instructions through its top-level system parameter. To add system instructions mid-conversation, use the InvokeModel API.
Context window
Claude Fable 5.1, Claude Fable 5, Claude Opus 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 5, and Claude Sonnet 4.6 have a 1M-token context window on Amazon Bedrock. Other Claude models, including Sonnet 4.5 and Sonnet 4 (deprecated), have a 200k-token context window.
Bedrock limits request payloads to 20 MB. When sending large documents or many images, you may reach this limit before the token limit.
Global versus regional endpoints
Starting with Claude Sonnet 4.5 and all future models, Bedrock offers two endpoint types:
- Global endpoints: Dynamic routing for maximum availability
- Regional endpoints: Guaranteed data routing through specific geographic regions
Regional endpoints include a 10% pricing premium over global endpoints.
When to use each option
Global endpoints (recommended):
- Provide maximum availability and uptime
- Dynamically route requests to regions with available capacity
- No pricing premium
- Best for applications where data residency is flexible
Regional endpoints (CRIS):
- Route traffic through specific geographic regions
- Required for data residency and compliance requirements
- Available for US, EU, Japan, and Asia-Pacific
- 10% pricing premium reflects infrastructure costs for dedicated regional capacity
Implementation
Using global endpoints (default for Opus 4.6, Sonnet 4.6, and Sonnet 4.5):
The model IDs for Claude Opus 4.6, Sonnet 4.6, and Sonnet 4.5 already include the global. prefix:
from anthropic import AnthropicBedrock
client = AnthropicBedrock(aws_region="us-west-2")
message = client.messages.create(
model="global.anthropic.claude-opus-4-6-v1",
max_tokens=256,
messages=[{"role": "user", "content": "Hello, world"}],
)Using regional endpoints (CRIS):
To use regional endpoints, replace the global. prefix with a regional prefix such as us.:
from anthropic import AnthropicBedrock
client = AnthropicBedrock(aws_region="us-west-2")
# Using US regional endpoint (CRIS)
message = client.messages.create(
model="us.anthropic.claude-opus-4-6-v1", # Regional prefix
max_tokens=256,
messages=[{"role": "user", "content": "Hello, world"}],
)Additional resources
- Bedrock pricing: Amazon Bedrock pricing page
- AWS pricing documentation: Bedrock pricing guide
- AWS blog post: Introducing Claude Sonnet 4.5 in Amazon Bedrock
- Anthropic pricing details: Cloud platform pricing
Was this page helpful?