Repository Public
1---2title: Claude on Amazon Bedrock (Opus 4.6 and earlier)3url: https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy4description: The legacy Amazon Bedrock integration for Claude models, using InvokeModel and Converse APIs with ARN-versioned model identifiers.5---67<Note>8 This page covers the legacy Amazon Bedrock integration: the `InvokeModel` and `Converse` APIs with ARN-versioned model identifiers and AWS event-stream encoding. For models available on the Messages-API Bedrock endpoint, see [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock), which uses the Messages API at `/anthropic/v1/messages` with SSE streaming. For an Anthropic-operated alternative with AWS Marketplace billing and typically same-day feature access, see [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws). Existing Bedrock users can follow the [migration guide](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#migrating-from-amazon-bedrock).9</Note>1011Calling 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](https://platform.claude.com/docs/en/cli-sdks-libraries/overview).1213Note that this guide assumes you have already signed up for an [AWS account](https://portal.aws.amazon.com/billing/signup) and configured programmatic access.1415## Install and configure the AWS CLI16171. [Install a version of the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) at or newer than version `2.13.23`.182. Configure your AWS credentials using the AWS configure command (see [Configure the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)) or find your credentials by navigating to "Command line or programmatic access" within your AWS dashboard and following the directions in the modal window.193. Verify that your credentials are working:2021```bash AWS CLI22aws sts get-caller-identity23```2425## Install an SDK for accessing Bedrock2627Anthropic's [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) support Bedrock. You can also use an AWS SDK like `boto3` directly.2829<Tabs>30 <Tab title="Python">31 ```bash32 pip install -U "anthropic[bedrock]"33 ```34 </Tab>3536 <Tab title="TypeScript">37 ```bash38 npm install @anthropic-ai/bedrock-sdk39 ```40 </Tab>4142 <Tab title="C#">43 ```bash44 dotnet add package Anthropic.Bedrock45 ```46 </Tab>4748 <Tab title="Go">49 ```bash50 go get github.com/anthropics/anthropic-sdk-go/bedrock51 ```52 </Tab>5354 <Tab title="Java">55 <CodeGroup>56 ```groovy Gradle57 implementation("com.anthropic:anthropic-java:2.63.0")58 implementation("com.anthropic:anthropic-java-bedrock:2.63.0")59 ```6061 ```xml Maven62 <dependency>63 <groupId>com.anthropic</groupId>64 <artifactId>anthropic-java</artifactId>65 <version>2.63.0</version>66 </dependency>67 <dependency>68 <groupId>com.anthropic</groupId>69 <artifactId>anthropic-java-bedrock</artifactId>70 <version>2.63.0</version>71 </dependency>72 ```7374 ```java Java75 import com.anthropic.client.AnthropicClient;76 import com.anthropic.client.okhttp.AnthropicOkHttpClient;77 import com.anthropic.bedrock.backends.BedrockBackend;78 import com.anthropic.models.messages.MessageCreateParams;79 import com.anthropic.models.messages.Message;80 import com.anthropic.models.messages.Model;8182 public class BasicMessage {83 public static void main(String[] args) {84 AnthropicClient client = AnthropicOkHttpClient.builder()85 .backend(BedrockBackend.fromEnv())86 .build();8788 MessageCreateParams params = MessageCreateParams.builder()89 .model(Model.CLAUDE_OPUS_4_6)90 .maxTokens(1024L)91 .addUserMessage("What is the capital of France?")92 .build();9394 Message response = client.messages().create(params);95 response.content().stream()96 .flatMap(block -> block.text().stream())97 .forEach(textBlock -> System.out.println(textBlock.text()));98 }99 }100 ```101 </CodeGroup>102 </Tab>103104 <Tab title="PHP">105 ```bash106 composer require anthropic-ai/sdk aws/aws-sdk-php107 ```108 </Tab>109110 <Tab title="Ruby">111 ```bash112 # Gemfile113 gem "anthropic"114 gem "aws-sdk-bedrockruntime"115 ```116 </Tab>117118 <Tab title="Boto3 (Python)">119 ```bash120 pip install "boto3>=1.28.59"121 ```122 </Tab>123</Tabs>124125## Accessing Bedrock126127### Subscribe to Anthropic models128129Go to the [AWS Console > Bedrock > Model Access](https://console.aws.amazon.com/bedrock/home?region=us-west-2#/modelaccess) and request access to Anthropic models. Note that Anthropic model availability varies by region. See [AWS documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) for latest information.130131#### API model IDs132133<Note>134 Claude Fable 5.1, Claude Fable 5, Claude Opus 5, Claude Sonnet 5, Claude Opus 4.8, and Claude Opus 4.7 are reachable through `InvokeModel` on `bedrock-runtime`. These requests are served by the same infrastructure as the [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock) endpoint. For the native Messages API request shape and full feature parity, use that page. These models are omitted from the model table on this page because they do not have ARN-versioned model IDs.135</Note>136137Lifecycle terms (Deprecated, Retired) are defined in [Model deprecations](https://platform.claude.com/docs/en/about-claude/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](https://docs.aws.amazon.com/bedrock/latest/userguide/model-lifecycle.html).138139AWS offers newer Claude models through [cross-region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html) 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:140141```text wrap142Invocation 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.143```144145To 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 us.anthropic.claude-sonnet-4-5-20250929-v1:0. 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](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html). To learn how the prefixes affect routing and pricing, see the [Global versus regional endpoints](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy#global-vs-regional-endpoints) section.146147| Model | Base Bedrock model ID | `global` | `us` | `eu` | `jp` | `apac` |148| ---------------------------- | ----------------------------------------- | -------- | ---- | ---- | ---- | ------ |149| Claude Opus 4.6 | anthropic.claude-opus-4-6-v1 | Yes | Yes | Yes | Yes | Yes |150| Claude Sonnet 4.6 | anthropic.claude-sonnet-4-6 | Yes | Yes | Yes | Yes | No |151| Claude Sonnet 4.5 | anthropic.claude-sonnet-4-5-20250929-v1:0 | Yes | Yes | Yes | Yes | No |152| Claude Sonnet 4 Deprecated. | anthropic.claude-sonnet-4-20250514-v1:0 | Yes | Yes | Yes | No | Yes |153| Claude Sonnet 3.7 Retired. | anthropic.claude-3-7-sonnet-20250219-v1:0 | No | No | No | No | No |154| Claude Opus 4.5 | anthropic.claude-opus-4-5-20251101-v1:0 | Yes | Yes | Yes | No | No |155| Claude Opus 4.1 Deprecated. | anthropic.claude-opus-4-1-20250805-v1:0 | No | Yes | No | No | No |156| Claude Opus 4 Retired. | anthropic.claude-opus-4-20250514-v1:0 | No | No | No | No | No |157| Claude Haiku 4.5 | anthropic.claude-haiku-4-5-20251001-v1:0 | Yes | Yes | Yes | No | No |158| Claude Haiku 3.5 Deprecated. | anthropic.claude-3-5-haiku-20241022-v1:0 | No | Yes | No | No | No |159160### List available models161162The following examples show how to print a list of all the Claude models available through Bedrock:163164<CodeGroup>165 ```bash AWS CLI166 aws bedrock list-foundation-models --region=us-west-2 --by-provider anthropic --query "modelSummaries[*].modelId"167 ```168169 ```python Boto3 (Python)170 import boto3171172 bedrock = boto3.client(service_name="bedrock")173 response = bedrock.list_foundation_models(byProvider="anthropic")174175 for summary in response["modelSummaries"]:176 print(summary["modelId"])177 ```178179 ```typescript TypeScript180 import { BedrockClient, ListFoundationModelsCommand } from "@aws-sdk/client-bedrock";181182 const client = new BedrockClient({ region: "us-west-2" });183184 const command = new ListFoundationModelsCommand({ byProvider: "anthropic" });185 const response = await client.send(command);186187 if (response.modelSummaries) {188 for (const summary of response.modelSummaries) {189 console.log(summary.modelId);190 }191 }192 ```193194 ```csharp C#195 using Amazon;196 using Amazon.Bedrock;197 using Amazon.Bedrock.Model;198199 var client = new AmazonBedrockClient(RegionEndpoint.USWest2);200201 var request = new ListFoundationModelsRequest202 {203 ByProvider = "anthropic"204 };205206 var response = await client.ListFoundationModelsAsync(request);207208 foreach (var summary in response.ModelSummaries)209 {210 Console.WriteLine(summary.ModelId);211 }212 ```213214 ```go Go215 import (216 "context"217 "fmt"218 "log"219220 "github.com/aws/aws-sdk-go-v2/config"221 "github.com/aws/aws-sdk-go-v2/service/bedrock"222 )223 // ...224 cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-west-2"))225 if err != nil {226 log.Fatal(err)227 }228229 client := bedrock.NewFromConfig(cfg)230231 byProvider := "anthropic"232 response, err := client.ListFoundationModels(context.TODO(), &bedrock.ListFoundationModelsInput{233 ByProvider: &byProvider,234 })235 if err != nil {236 log.Fatal(err)237 }238239 for _, summary := range response.ModelSummaries {240 fmt.Println(*summary.ModelId)241 }242 ```243244 ```java Java245 import software.amazon.awssdk.regions.Region;246 import software.amazon.awssdk.services.bedrock.BedrockClient;247 import software.amazon.awssdk.services.bedrock.model.ListFoundationModelsRequest;248 import software.amazon.awssdk.services.bedrock.model.ListFoundationModelsResponse;249 import software.amazon.awssdk.services.bedrock.model.FoundationModelSummary;250251 public class ListAnthropicModels {252 public static void main(String[] args) {253 BedrockClient client = BedrockClient.builder()254 .region(Region.US_WEST_2)255 .build();256257 ListFoundationModelsRequest request = ListFoundationModelsRequest.builder()258 .byProvider("anthropic")259 .build();260261 ListFoundationModelsResponse response = client.listFoundationModels(request);262263 for (FoundationModelSummary summary : response.modelSummaries()) {264 System.out.println(summary.modelId());265 }266267 client.close();268 }269 }270 ```271272 ```php PHP273 <?php274275 use Aws\Bedrock\BedrockClient;276277 $client = new BedrockClient([278 'region' => 'us-west-2',279 'version' => 'latest'280 ]);281282 $result = $client->listFoundationModels([283 'byProvider' => 'anthropic'284 ]);285286 foreach ($result['modelSummaries'] as $summary) {287 echo $summary['modelId'] . PHP_EOL;288 }289 ```290291 ```ruby Ruby292 require "aws-sdk-bedrock"293294 client = Aws::Bedrock::Client.new(region: "us-west-2")295296 response = client.list_foundation_models({297 by_provider: "anthropic"298 })299300 response.model_summaries.each do |summary|301 puts summary.model_id302 end303 ```304</CodeGroup>305306### Making requests307308The following examples show how to generate text from Claude on Bedrock:309310<Tabs>311 <Tab title="cURL">312 <Note>313 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDKs in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).314 </Note>315 </Tab>316317 <Tab title="CLI">318 <Note>319 The `ant` CLI does not support Amazon Bedrock. Use one of the SDK examples instead.320 </Note>321 </Tab>322323 <Tab title="Python">324 ```python325 from anthropic import AnthropicBedrock326327 client = AnthropicBedrock(328 # Authenticate by either providing the keys below or use the default AWS credential providers, such as329 # using ~/.aws/credentials or the "AWS_SECRET_ACCESS_KEY" and "AWS_ACCESS_KEY_ID" environment variables.330 aws_access_key="<access key>",331 aws_secret_key="<secret key>",332 # Temporary credentials can be used with aws_session_token.333 # Read more at https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html.334 aws_session_token="<session_token>",335 # aws_region changes the aws region to which the request is made. If it is not provided, the SDK reads336 # AWS_REGION / AWS_DEFAULT_REGION, then the region configured for your boto3 session or AWS profile337 # (including ~/.aws/config), and raises ValueError if no region can be resolved.338 aws_region="us-west-2",339 )340341 message = client.messages.create(342 model="global.anthropic.claude-opus-4-6-v1",343 max_tokens=256,344 messages=[{"role": "user", "content": "Hello, world"}],345 )346 print(message.content)347 ```348 </Tab>349350 <Tab title="TypeScript">351 ```typescript352 import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";353354 const client = new AnthropicBedrock({355 // Authenticate by either providing the keys below or use356 // the default AWS credential providers, such as357 // ~/.aws/credentials or the "AWS_SECRET_ACCESS_KEY" and358 // "AWS_ACCESS_KEY_ID" environment variables.359 awsAccessKey: "<access key>",360 awsSecretKey: "<secret key>",361362 // Temporary credentials can be used with awsSessionToken.363 // Read more at https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html.364 awsSessionToken: "<session_token>",365366 // awsRegion changes the aws region to which the request367 // is made. By default, the SDK reads AWS_REGION, and if368 // that's not present, defaults to us-east-1. Note that369 // the SDK does not read ~/.aws/config for the region.370 awsRegion: "us-west-2"371 });372373 const message = await client.messages.create({374 model: "global.anthropic.claude-opus-4-6-v1",375 max_tokens: 256,376 messages: [{ role: "user", content: "Hello, world" }]377 });378 console.log(message);379 ```380 </Tab>381382 <Tab title="C#">383 ```csharp384 using Anthropic.Bedrock;385 using Anthropic.Models.Messages;386387 AnthropicBedrockClient client = new(388 await AnthropicBedrockCredentialsHelper.FromEnv()389 ?? throw new InvalidOperationException("AWS credentials not configured.")390 );391392 var response = await client.Messages.Create(new MessageCreateParams393 {394 Model = "global.anthropic.claude-opus-4-6-v1",395 MaxTokens = 256,396 Messages = [new() { Role = Role.User, Content = "Hello, world" }],397 });398399 Console.WriteLine(400 string.Join("", response.Content401 .Select(block => block.Value)402 .OfType<TextBlock>()403 .Select(textBlock => textBlock.Text)));404 ```405 </Tab>406407 <Tab title="Go">408 ```go409 import (410 "context"411 "fmt"412413 "github.com/anthropics/anthropic-sdk-go"414 "github.com/anthropics/anthropic-sdk-go/bedrock"415 )416 // ...417 // Uses default AWS credential provider chain418 client := anthropic.NewClient(419 bedrock.WithLoadDefaultConfig(context.Background()),420 )421422 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{423 Model: "global.anthropic.claude-opus-4-6-v1",424 MaxTokens: 256,425 Messages: []anthropic.MessageParam{426 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, world")),427 },428 })429 if err != nil {430 panic(err)431 }432 fmt.Println(message.Content)433 ```434 </Tab>435436 <Tab title="Java">437 ```java438 import com.anthropic.bedrock.backends.BedrockBackend;439 import com.anthropic.client.AnthropicClient;440 import com.anthropic.client.okhttp.AnthropicOkHttpClient;441 import com.anthropic.models.messages.Message;442 import com.anthropic.models.messages.MessageCreateParams;443444 public class BedrockExample {445446 public static void main(String[] args) {447 // Uses default AWS credential provider chain448 AnthropicClient client = AnthropicOkHttpClient.builder()449 .backend(BedrockBackend.fromEnv())450 .build();451452 Message message = client453 .messages()454 .create(455 MessageCreateParams.builder()456 .model("global.anthropic.claude-opus-4-6-v1")457 .maxTokens(256)458 .addUserMessage("Hello, world")459 .build()460 );461462 System.out.println(message.content());463 }464 }465 ```466 </Tab>467468 <Tab title="PHP">469 ```php470 <?php471472 use Anthropic\Bedrock;473474 $client = Bedrock\Client::withCredentials(475 accessKeyId: getenv("AWS_ACCESS_KEY_ID"),476 secretAccessKey: getenv("AWS_SECRET_ACCESS_KEY"),477 region: 'us-west-2',478 securityToken: getenv("AWS_SESSION_TOKEN"),479 );480481 $message = $client->messages->create(482 maxTokens: 256,483 messages: [484 ['role' => 'user', 'content' => 'Hello, world']485 ],486 model: 'global.anthropic.claude-opus-4-6-v1',487 );488 echo $message->content[0]->text;489 ```490 </Tab>491492 <Tab title="Ruby">493 ```ruby494 require "anthropic"495496 client = Anthropic::BedrockClient.new497498 message = client.messages.create(499 model: "global.anthropic.claude-opus-4-6-v1",500 max_tokens: 256,501 messages: [{role: "user", content: "Hello, world"}]502 )503504 puts message.content.first.text505 ```506 </Tab>507508 <Tab title="Boto3 (Python)">509 ```python510 import boto3511 import json512513 bedrock = boto3.client(service_name="bedrock-runtime")514 body = json.dumps(515 {516 "max_tokens": 256,517 "messages": [{"role": "user", "content": "Hello, world"}],518 "anthropic_version": "bedrock-2023-05-31",519 }520 )521522 response = bedrock.invoke_model(523 body=body, modelId="global.anthropic.claude-opus-4-6-v1"524 )525526 response_body = json.loads(response.get("body").read())527 print(response_body.get("content"))528 ```529 </Tab>530</Tabs>531532See the [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) for more details, and the [official Bedrock documentation](https://docs.aws.amazon.com/bedrock/).533534### Bearer token authentication535536You 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.537538The simplest approach is to set the `AWS_BEARER_TOKEN_BEDROCK` environment variable, which each SDK detects automatically when resolving credentials from the environment.539540To provide a token programmatically:541542<Tabs>543 <Tab title="cURL">544 <Note>545 This section shows how to configure a bearer token in an SDK client. The SDKs also read the token from the `AWS_BEARER_TOKEN_BEDROCK` environment variable. To make direct HTTP requests with a bearer token, see the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/).546 </Note>547 </Tab>548549 <Tab title="CLI">550 <Note>551 The `ant` CLI does not support Amazon Bedrock. Use one of the SDK examples instead.552 </Note>553 </Tab>554555 <Tab title="Python">556 ```python557 from anthropic import AnthropicBedrock558559 client = AnthropicBedrock(560 api_key="your-bearer-token",561 aws_region="us-west-2",562 )563564 message = client.messages.create(565 model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",566 max_tokens=1024,567 messages=[{"role": "user", "content": "Hello!"}],568 )569 print(message.content)570 ```571 </Tab>572573 <Tab title="TypeScript">574 ```typescript575 import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";576577 const client = new AnthropicBedrock({578 apiKey: "your-bearer-token",579 awsRegion: "us-west-2"580 });581582 const message = await client.messages.create({583 model: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",584 max_tokens: 1024,585 messages: [{ role: "user", content: "Hello!" }]586 });587 console.log(message);588 ```589 </Tab>590591 <Tab title="C#">592 ```csharp593 using Anthropic.Bedrock;594 using Anthropic.Models.Messages;595596 var client = new AnthropicBedrockClient(597 new AnthropicBedrockApiTokenCredentials598 {599 BearerToken = "your-bearer-token",600 Region = "us-west-2",601 }602 );603604 var response = await client.Messages.Create(new MessageCreateParams605 {606 Model = "us.anthropic.claude-sonnet-4-5-20250929-v1:0",607 MaxTokens = 1024,608 Messages = [new() { Role = Role.User, Content = "Hello!" }],609 });610 ```611 </Tab>612613 <Tab title="Go">614 ```go615 import (616 "context"617 "fmt"618619 "github.com/anthropics/anthropic-sdk-go"620 "github.com/anthropics/anthropic-sdk-go/bedrock"621 "github.com/aws/aws-sdk-go-v2/aws"622 )623 // ...624 cfg := aws.Config{625 Region: "us-west-2",626 BearerAuthTokenProvider: bedrock.NewStaticBearerTokenProvider("your-bearer-token"),627 }628 client := anthropic.NewClient(629 bedrock.WithConfig(cfg),630 )631632 message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{633 Model: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",634 MaxTokens: 1024,635 Messages: []anthropic.MessageParam{636 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello!")),637 },638 })639 if err != nil {640 panic(err)641 }642 fmt.Println(message.Content[0].Text)643 ```644 </Tab>645646 <Tab title="Java">647 ```java648 import com.anthropic.bedrock.backends.BedrockBackend;649 import com.anthropic.client.AnthropicClient;650 import com.anthropic.client.okhttp.AnthropicOkHttpClient;651 import com.anthropic.models.messages.MessageCreateParams;652653 // Option 1: Set AWS_BEARER_TOKEN_BEDROCK environment variable and use fromEnv()654 AnthropicClient client = AnthropicOkHttpClient.builder()655 .backend(BedrockBackend.fromEnv())656 .build();657658 // Option 2: Provide the token programmatically659 client = AnthropicOkHttpClient.builder()660 .backend(BedrockBackend.builder()661 .apiKey("your-bearer-token")662 .build())663 .build();664665 MessageCreateParams params = MessageCreateParams.builder()666 .model("us.anthropic.claude-sonnet-4-5-20250929-v1:0")667 .maxTokens(1024)668 .addUserMessage("Hello!")669 .build();670671 client.messages().create(params).content().stream()672 .flatMap(block -> block.text().stream())673 .forEach(textBlock -> System.out.println(textBlock.text()));674 ```675 </Tab>676677 <Tab title="PHP">678 ```php679 <?php680681 use Anthropic\Bedrock;682683 $client = Bedrock\Client::withApiKey('your-bearer-token', 'us-west-2');684685 $message = $client->messages->create(686 maxTokens: 1024,687 messages: [688 ['role' => 'user', 'content' => 'Hello!']689 ],690 model: 'us.anthropic.claude-sonnet-4-5-20250929-v1:0',691 );692 echo $message->content[0]->text;693 ```694 </Tab>695696 <Tab title="Ruby">697 ```ruby698 require "anthropic"699700 client = Anthropic::BedrockClient.new(701 api_key: "your-bearer-token",702 aws_region: "us-west-2"703 )704705 message = client.messages.create(706 model: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",707 max_tokens: 1024,708 messages: [{role: "user", content: "Hello!"}]709 )710 puts message.content.first.text711 ```712 </Tab>713</Tabs>714715## Activity logging716717Bedrock provides an [invocation logging service](https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html) that allows you to log the prompts and completions associated with your usage.718719Anthropic recommends that you log your activity on at least a 30-day rolling basis to understand your activity and investigate any potential misuse.720721<Note>722 Turning on this service does not give AWS or Anthropic any access to your content.723</Note>724725## Feature support726727For the full feature list with Amazon Bedrock availability, see [Features overview](https://platform.claude.com/docs/en/build-with-claude/overview).728729### Supported feature highlights730731* [Messages API](https://platform.claude.com/docs/en/api/messages/create)732* [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)733* [Thinking](https://platform.claude.com/docs/en/build-with-claude/thinking)734* [Tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview), including the [Bash tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool), [Computer use tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool), [Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool), and [Text editor tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool)735* [Citations](https://platform.claude.com/docs/en/build-with-claude/citations)736* [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)737738### Features not supported739740* Input sources (URL sources for images and documents, Files API)741* Server-side tools (code execution, web search, web fetch, advisor)742* Agent infrastructure (Agent Skills, MCP connector, programmatic tool calling)743* API endpoints (Message Batches, Models, Admin, Compliance, Usage and Cost)744* Claude Managed Agents745* Server-side fallback (the [`fallbacks` parameter](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#server-side-fallback); use the [client-side fallback pattern](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#client-side-fallback) instead)746* Automatic prompt caching (the [top-level `cache_control` field](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#automatic-caching); use [explicit cache breakpoints](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#explicit-cache-breakpoints) instead)747* [Computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool) toolsets (`computer_toolset_20260801` and `browser_toolset_20260801` are not currently available on Amazon Bedrock; the beta computer use tool versions remain available)748749### PDF support on Bedrock750751PDF 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](https://platform.claude.com/docs/en/build-with-claude/pdf-support#amazon-bedrock-pdf-support).752753**Important considerations for Converse API users:**754755* Visual PDF analysis (charts, images, layouts) requires citations to be enabled756* Without citations, only basic text extraction is available757* For full control without forced citations, use the InvokeModel API758759### Mid-conversation system messages on Bedrock760761[Mid-conversation system messages](https://platform.claude.com/docs/en/build-with-claude/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](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy#api-model-ids), these requests are served by the same infrastructure as the [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/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.762763**For Converse API users:** the Converse API accepts system instructions through its top-level [`system` parameter](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html). To add system instructions mid-conversation, use the InvokeModel API.764765### Context window766767Claude 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](https://platform.claude.com/docs/en/build-with-claude/context-windows) on Amazon Bedrock. Other Claude models, including Sonnet 4.5 and Sonnet 4 (deprecated), have a 200k-token context window.768769Bedrock limits request payloads to 20 MB. When sending large documents or many images, you may reach this limit before the token limit.770771## Global versus regional endpoints772773Starting with **Claude Sonnet 4.5 and all future models**, Bedrock offers two endpoint types:774775* **Global endpoints:** Dynamic routing for maximum availability776* **Regional endpoints:** Guaranteed data routing through specific geographic regions777778Regional endpoints include a 10% pricing premium over global endpoints.779780<Note>781 This applies to Claude Sonnet 4.5 and future models only. Older models (Claude Sonnet 4 (deprecated) and earlier) maintain their existing pricing structures.782</Note>783784### When to use each option785786**Global endpoints (recommended):**787788* Provide maximum availability and uptime789* Dynamically route requests to regions with available capacity790* No pricing premium791* Best for applications where data residency is flexible792793**Regional endpoints (CRIS):**794795* Route traffic through specific geographic regions796* Required for data residency and compliance requirements797* Available for US, EU, Japan, and Asia-Pacific798* 10% pricing premium reflects infrastructure costs for dedicated regional capacity799800### Implementation801802**Using global endpoints (default for Opus 4.6, Sonnet 4.6, and Sonnet 4.5):**803804The model IDs for Claude Opus 4.6, Sonnet 4.6, and Sonnet 4.5 already include the `global.` prefix:805806<Tabs>807 <Tab title="cURL">808 <Note>809 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDKs in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).810 </Note>811 </Tab>812813 <Tab title="CLI">814 <Note>815 The `ant` CLI does not support Amazon Bedrock. Use one of the SDK examples instead.816 </Note>817 </Tab>818819 <Tab title="Python">820 ```python821 from anthropic import AnthropicBedrock822823 client = AnthropicBedrock(aws_region="us-west-2")824825 message = client.messages.create(826 model="global.anthropic.claude-opus-4-6-v1",827 max_tokens=256,828 messages=[{"role": "user", "content": "Hello, world"}],829 )830 ```831 </Tab>832833 <Tab title="TypeScript">834 ```typescript835 import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";836837 const client = new AnthropicBedrock({838 awsRegion: "us-west-2"839 });840841 const message = await client.messages.create({842 model: "global.anthropic.claude-opus-4-6-v1",843 max_tokens: 256,844 messages: [{ role: "user", content: "Hello, world" }]845 });846 ```847 </Tab>848849 <Tab title="C#">850 ```csharp851 using Anthropic.Bedrock;852 using Anthropic.Models.Messages;853854 // C# Bedrock client uses model IDs with region prefix for global routing855 AnthropicBedrockClient client = new(856 await AnthropicBedrockCredentialsHelper.FromEnv()857 ?? throw new InvalidOperationException("AWS credentials not configured.")858 );859860 var response = await client.Messages.Create(new MessageCreateParams861 {862 // Use "global." prefix for global cross-region inference863 Model = "global.anthropic.claude-opus-4-6-v1",864 MaxTokens = 256,865 Messages = [new() { Role = Role.User, Content = "Hello, world" }],866 });867 ```868 </Tab>869870 <Tab title="Go">871 ```go872 import (873 "context"874875 "github.com/anthropics/anthropic-sdk-go"876 "github.com/anthropics/anthropic-sdk-go/bedrock"877 )878 // ...879 // Uses default AWS credential provider chain880 client := anthropic.NewClient(881 bedrock.WithLoadDefaultConfig(context.Background()),882 )883884 message, _ := client.Messages.New(context.Background(), anthropic.MessageNewParams{885 Model: "global.anthropic.claude-opus-4-6-v1",886 MaxTokens: 256,887 Messages: []anthropic.MessageParam{888 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, world")),889 },890 })891 ```892 </Tab>893894 <Tab title="Java">895 ```java896 import com.anthropic.bedrock.backends.BedrockBackend;897 import com.anthropic.client.AnthropicClient;898 import com.anthropic.client.okhttp.AnthropicOkHttpClient;899 import com.anthropic.models.messages.MessageCreateParams;900901 // Uses default AWS credential provider chain902 AnthropicClient client = AnthropicOkHttpClient.builder()903 .backend(BedrockBackend.fromEnv())904 .build();905906 var message = client907 .messages()908 .create(909 MessageCreateParams.builder()910 .model("global.anthropic.claude-opus-4-6-v1")911 .maxTokens(256)912 .addUserMessage("Hello, world")913 .build()914 );915 ```916 </Tab>917918 <Tab title="PHP">919 ```php920 <?php921922 use Anthropic\Bedrock;923924 $client = Bedrock\Client::fromEnvironment();925926 $message = $client->messages->create(927 maxTokens: 256,928 messages: [929 ['role' => 'user', 'content' => 'Hello, world']930 ],931 model: 'global.anthropic.claude-opus-4-6-v1',932 );933 ```934 </Tab>935936 <Tab title="Ruby">937 ```ruby938 require "anthropic"939940 # Default credentials resolve region from AWS_REGION env var941 client = Anthropic::BedrockClient.new942943 message = client.messages.create(944 # Use "global." prefix for global cross-region inference945 model: "global.anthropic.claude-opus-4-6-v1",946 max_tokens: 256,947 messages: [{role: "user", content: "Hello, world"}]948 )949 ```950 </Tab>951</Tabs>952953**Using regional endpoints (CRIS):**954955To use regional endpoints, replace the `global.` prefix with a regional prefix such as `us.`:956957<Tabs>958 <Tab title="cURL">959 <Note>960 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDKs in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).961 </Note>962 </Tab>963964 <Tab title="CLI">965 <Note>966 The `ant` CLI does not support Amazon Bedrock. Use one of the SDK examples instead.967 </Note>968 </Tab>969970 <Tab title="Python">971 ```python972 from anthropic import AnthropicBedrock973974 client = AnthropicBedrock(aws_region="us-west-2")975976 # Using US regional endpoint (CRIS)977 message = client.messages.create(978 model="us.anthropic.claude-opus-4-6-v1", # Regional prefix979 max_tokens=256,980 messages=[{"role": "user", "content": "Hello, world"}],981 )982 ```983 </Tab>984985 <Tab title="TypeScript">986 ```typescript987 import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";988989 const client = new AnthropicBedrock({990 awsRegion: "us-west-2"991 });992993 // Using US regional endpoint (CRIS)994 const message = await client.messages.create({995 model: "us.anthropic.claude-opus-4-6-v1", // Regional prefix996 max_tokens: 256,997 messages: [{ role: "user", content: "Hello, world" }]998 });999 ```1000 </Tab>10011002 <Tab title="C#">1003 ```csharp1004 using Anthropic.Bedrock;1005 using Anthropic.Models.Messages;10061007 AnthropicBedrockClient client = new(1008 new AnthropicBedrockPrivateKeyCredentials { Region = "us-west-2" }1009 );10101011 // Using US regional endpoint (CRIS)1012 var response = await client.Messages.Create(new MessageCreateParams1013 {1014 Model = "us.anthropic.claude-opus-4-6-v1", // Regional prefix1015 MaxTokens = 256,1016 Messages = [new() { Role = Role.User, Content = "Hello, world" }],1017 });1018 ```1019 </Tab>10201021 <Tab title="Go">1022 ```go1023 import (1024 "context"10251026 "github.com/anthropics/anthropic-sdk-go"1027 "github.com/anthropics/anthropic-sdk-go/bedrock"1028 )1029 // ...1030 // Uses default AWS credential provider chain1031 client := anthropic.NewClient(1032 bedrock.WithLoadDefaultConfig(context.Background()),1033 )10341035 // Using US regional endpoint (CRIS)1036 message, _ := client.Messages.New(context.Background(), anthropic.MessageNewParams{1037 Model: "us.anthropic.claude-opus-4-6-v1", // Regional prefix1038 MaxTokens: 256,1039 Messages: []anthropic.MessageParam{1040 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, world")),1041 },1042 })1043 ```1044 </Tab>10451046 <Tab title="Java">1047 ```java1048 import com.anthropic.bedrock.backends.BedrockBackend;1049 import com.anthropic.client.AnthropicClient;1050 import com.anthropic.client.okhttp.AnthropicOkHttpClient;1051 import com.anthropic.models.messages.MessageCreateParams;10521053 // Uses default AWS credential provider chain1054 AnthropicClient client = AnthropicOkHttpClient.builder()1055 .backend(BedrockBackend.fromEnv())1056 .build();10571058 // Using US regional endpoint (CRIS)1059 var message = client1060 .messages()1061 .create(1062 MessageCreateParams.builder()1063 .model("us.anthropic.claude-opus-4-6-v1") // Regional prefix1064 .maxTokens(256)1065 .addUserMessage("Hello, world")1066 .build()1067 );1068 ```1069 </Tab>10701071 <Tab title="PHP">1072 ```php1073 <?php10741075 use Anthropic\Bedrock;10761077 $client = Bedrock\Client::fromEnvironment();10781079 $message = $client->messages->create(1080 maxTokens: 256,1081 messages: [1082 ['role' => 'user', 'content' => 'Hello, world']1083 ],1084 model: 'us.anthropic.claude-opus-4-6-v1',1085 );1086 ```1087 </Tab>10881089 <Tab title="Ruby">1090 ```ruby1091 require "anthropic"10921093 # Using US regional endpoint (CRIS)1094 client = Anthropic::BedrockClient.new(aws_region: "us-west-2")10951096 message = client.messages.create(1097 model: "us.anthropic.claude-opus-4-6-v1", # Regional prefix1098 max_tokens: 256,1099 messages: [{role: "user", content: "Hello, world"}]1100 )1101 ```1102 </Tab>1103</Tabs>11041105<Note>1106 **Claude Mythos Preview** is a research preview model available to invited customers on Amazon Bedrock. For more information, see [Project Glasswing](https://anthropic.com/glasswing).1107</Note>11081109## Additional resources11101111* **Bedrock pricing:** [Amazon Bedrock pricing page](https://aws.amazon.com/bedrock/pricing/)1112* **AWS pricing documentation:** [Bedrock pricing guide](https://docs.aws.amazon.com/bedrock/latest/userguide/bedrock-pricing.html)1113* **AWS blog post:** [Introducing Claude Sonnet 4.5 in Amazon Bedrock](https://aws.amazon.com/blogs/aws/introducing-claude-sonnet-4-5-in-amazon-bedrock-anthropics-most-intelligent-model-best-for-coding-and-complex-agents/)1114* **Anthropic pricing details:** [Cloud platform pricing](https://platform.claude.com/docs/en/about-claude/pricing#cloud-platform-pricing)1115