Expand description
Claude Platform on AWS (a.k.a. “Anthropic on AWS”) provider for llmsdk.
Rust port of
@ai-sdk/anthropic-aws.
Reuses the entire llmsdk_anthropic request pipeline (Messages, Files,
Skills, typed server tools) and swaps in a per-request authentication
hook that signs each outbound POST with AWS Signature Version 4 or,
alternatively, attaches an x-api-key header for AWS-provisioned keys.
§Authentication precedence
Matches the upstream package:
- If
apiKeyis provided (option orANTHROPIC_AWS_API_KEYenv var) —x-api-keyis sent andSigV4is not attempted. - Otherwise
SigV4signs every POST using AWS credentials resolved fromaccessKeyId/secretAccessKey/sessionTokenoptions orAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKENenv vars.
§Required configuration
region(orAWS_REGION): used both to template the default base URLhttps://aws-external-anthropic.{region}.api.aws/v1and as theSigV4signing region.workspace_id(orANTHROPIC_AWS_WORKSPACE_ID): sent on every request asanthropic-workspace-id.
§Quick start
use llmsdk_anthropic_aws::AnthropicAws;
use llmsdk_provider::language_model::{CallOptions, Message, TextPart, UserPart};
use llmsdk_provider::LanguageModel;
let provider = AnthropicAws::builder()
.region("us-west-2")
.workspace_id("wrkspc_123")
.api_key("sk-aws-platform-key")
.build()?;
let result = provider
.language_model("claude-sonnet-4-6")
.do_generate(CallOptions {
prompt: vec![Message::User {
content: vec![UserPart::Text(TextPart {
text: "Hi".into(),
provider_options: None,
})],
provider_options: None,
}],
max_output_tokens: Some(64),
..Default::default()
})
.await?;
println!("{result:?}");Modules§
- tools
- Re-export of
llmsdk_anthropic::toolsfor convenience.
Structs§
- Anthropic
Aws - Claude Platform on AWS provider handle.
- Anthropic
AwsBuilder - Builder for
AnthropicAws. - ApiKey
Auth - Authenticate every outbound request with an AWS-provisioned
x-api-key. - SigV4
Auth - Authenticate every outbound POST with AWS Signature Version 4.
Constants§
- API_
KEY_ ENV_ VAR - Environment variable consulted for the AWS-provisioned API key.
- AWS_
REGION_ ENV_ VAR - Environment variable consulted for the AWS region.
- DEFAULT_
BASE_ URL_ TEMPLATE - Base-URL template applied when no explicit
base_urlis set. - PROVIDER_
NAME_ FILES - Reported provider name for the Files handle.
- PROVIDER_
NAME_ MESSAGES - Reported provider name for Messages / Language-model handles.
- PROVIDER_
NAME_ SKILLS - Reported provider name for the Skills handle.
- SIGV4_
SERVICE - AWS service id used when generating
SigV4signatures. - WORKSPACE_
ID_ ENV_ VAR - Environment variable consulted for the Anthropic workspace id.