claude-on-amazon-bedrock-legacy changedbuild-with-claude/claude-on-amazon-bedrock-legacy
Nearest release: v2.1.309, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+56added
Lines−56removed
From line
311
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits34to this page, all time
The whole hunk
from line 311, old and new numbered
/
from line 311
311311<Tabs>
312312 <Tab title="cURL">
313313 <Note>
314 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDK handles automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Making your first request with Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
314 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDK examples in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Making your first request with Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
315315 </Note>
316316 </Tab>
317317
from line 444
444444
445445 public class BedrockExample {
446446
447 public static void main(String[] args) {
448 // Uses default AWS credential provider chain
449 AnthropicClient client = AnthropicOkHttpClient.builder()
450 .backend(BedrockBackend.fromEnv())
451 .build();
447 public static void main(String[] args) {
448 // Uses default AWS credential provider chain
449 AnthropicClient client = AnthropicOkHttpClient.builder()
450 .backend(BedrockBackend.fromEnv())
451 .build();
452452
453 Message message = client
454 .messages()
455 .create(
456 MessageCreateParams.builder()
457 .model("global.anthropic.claude-opus-4-6-v1")
458 .maxTokens(256)
459 .addUserMessage("Hello, world")
460 .build()
461 );
453 Message message = client
454 .messages()
455 .create(
456 MessageCreateParams.builder()
457 .model("global.anthropic.claude-opus-4-6-v1")
458 .maxTokens(256)
459 .addUserMessage("Hello, world")
460 .build()
461 );
462462
463 System.out.println(message.content());
464 }
463 System.out.println(message.content());
464 }
465465 }
466466 ```
467467 </Tab>
from line 473
473473 use Anthropic\Bedrock;
474474
475475 $client = Bedrock\Client::withCredentials(
476 accessKeyId: getenv("AWS_ACCESS_KEY_ID"),
477 secretAccessKey: getenv("AWS_SECRET_ACCESS_KEY"),
476 accessKeyId: getenv('AWS_ACCESS_KEY_ID'),
477 secretAccessKey: getenv('AWS_SECRET_ACCESS_KEY'),
478478 region: 'us-west-2',
479 securityToken: getenv("AWS_SESSION_TOKEN"),
479 securityToken: getenv('AWS_SESSION_TOKEN'),
480480 );
481481
482482 $message = $client->messages->create(
from line 653
653653
654654 // Option 1: Set AWS_BEARER_TOKEN_BEDROCK environment variable and use fromEnv()
655655 AnthropicClient client = AnthropicOkHttpClient.builder()
656 .backend(BedrockBackend.fromEnv())
657 .build();
656 .backend(BedrockBackend.fromEnv())
657 .build();
658658
659659 // Option 2: Provide the token programmatically
660660 client = AnthropicOkHttpClient.builder()
661 .backend(BedrockBackend.builder()
662 .apiKey("your-bearer-token")
663 .build())
664 .build();
661 .backend(BedrockBackend.builder()
662 .apiKey("your-bearer-token")
663 .build())
664 .build();
665665
666666 MessageCreateParams params = MessageCreateParams.builder()
667 .model("us.anthropic.claude-sonnet-4-5-20250929-v1:0")
668 .maxTokens(1024)
669 .addUserMessage("Hello!")
670 .build();
667 .model("us.anthropic.claude-sonnet-4-5-20250929-v1:0")
668 .maxTokens(1024)
669 .addUserMessage("Hello!")
670 .build();
671671
672672 client.messages().create(params).content().stream()
673 .flatMap(block -> block.text().stream())
674 .forEach(textBlock -> System.out.println(textBlock.text()));
673 .flatMap(block -> block.text().stream())
674 .forEach(textBlock -> System.out.println(textBlock.text()));
675675 ```
676676 </Tab>
677677
from line 809
809809<Tabs>
810810 <Tab title="cURL">
811811 <Note>
812 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDK handles automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Making your first request with Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
812 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDK examples in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Making your first request with Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
813813 </Note>
814814 </Tab>
815815
from line 903
903903
904904 // Uses default AWS credential provider chain
905905 AnthropicClient client = AnthropicOkHttpClient.builder()
906 .backend(BedrockBackend.fromEnv())
907 .build();
906 .backend(BedrockBackend.fromEnv())
907 .build();
908908
909909 var message = client
910 .messages()
911 .create(
912 MessageCreateParams.builder()
913 .model("global.anthropic.claude-opus-4-6-v1")
914 .maxTokens(256)
915 .addUserMessage("Hello, world")
916 .build()
917 );
910 .messages()
911 .create(
912 MessageCreateParams.builder()
913 .model("global.anthropic.claude-opus-4-6-v1")
914 .maxTokens(256)
915 .addUserMessage("Hello, world")
916 .build()
917 );
918918 ```
919919 </Tab>
920920
from line 960
960960<Tabs>
961961 <Tab title="cURL">
962962 <Note>
963 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDK handles automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Making your first request with Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
963 Calling the `InvokeModel` API with AWS credentials requires SigV4 request signing, which the SDK examples in the other tabs handle automatically. For a Bedrock endpoint you can call with a self-contained cURL command, see [Making your first request with Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
964964 </Note>
965965 </Tab>
966966
from line 1055
10551055
10561056 // Uses default AWS credential provider chain
10571057 AnthropicClient client = AnthropicOkHttpClient.builder()
1058 .backend(BedrockBackend.fromEnv())
1059 .build();
1058 .backend(BedrockBackend.fromEnv())
1059 .build();
10601060
10611061 // Using US regional endpoint (CRIS)
10621062 var message = client
1063 .messages()
1064 .create(
1065 MessageCreateParams.builder()
1066 .model("us.anthropic.claude-opus-4-6-v1") // Regional prefix
1067 .maxTokens(256)
1068 .addUserMessage("Hello, world")
1069 .build()
1070 );
1063 .messages()
1064 .create(
1065 MessageCreateParams.builder()
1066 .model("us.anthropic.claude-opus-4-6-v1") // Regional prefix
1067 .maxTokens(256)
1068 .addUserMessage("Hello, world")
1069 .build()
1070 );
10711071 ```
10721072 </Tab>
10731073
No line in this hunk matches that.