Anthropic::AWS::Client
Inherits Anthropic::Client < Reference < Object
Anthropic models via the AWS gateway — the full first-party API
served through aws-external-anthropic.
Unlike Anthropic::Bedrock::Client (Bedrock Runtime invoke API),
requests pass through unchanged: standard /v1/* paths, standard
model names, the complete API surface.
Credentials resolve in priority order:
api_key(orANTHROPIC_AWS_API_KEY) → API-key mode (x-api-keyheader, no SigV4),- explicit
aws_access_key/aws_secret_key/aws_session_token/aws_profile, - the default AWS chain (env → shared config → SSO/login cache → IMDS)
via
Bedrock::CredentialsResolver.
client = Anthropic::AWS::Client.new(aws_region: "us-east-1")
message = client.messages.create(
model: Anthropic::Model::CLAUDE_SONNET_5,
max_tokens: 256,
messages: [{role: "user", content: "Hello from AWS!"}],
)
Constants
SERVICE = "aws-external-anthropic"
Constructors
new(api_key : String | Nil = nil, aws_access_key : String | Nil = nil, aws_secret_key : String | Nil = nil, aws_session_token : String | Nil = nil, aws_profile : String | Nil = nil, aws_region : String | Nil = nil, workspace_id : String | Nil = nil, skip_auth : Bool = false, base_url : String | Nil = nil, timeout : Time::Span = 600.seconds, max_retries : Int32 = DEFAULT_MAX_RETRIES, initial_retry_delay : Float64 = DEFAULT_INITIAL_DELAY, max_retry_delay : Float64 = DEFAULT_MAX_DELAY, default_headers : Hash(String, String) = {} of String => String, middleware : Array = [] of Middleware)
SourceClass methods
resolve_auth(api_key : String | Nil, env_api_key : String | Nil, aws_access_key : String | Nil, aws_secret_key : String | Nil, aws_session_token : String | Nil, aws_profile : String | Nil, aws_region : String | Nil, skip_auth : Bool) : Tuple(String | Nil, Bedrock::Credentials | Nil, String | Nil)
Resolve the auth mode: API key, SigV4 credentials, or nothing when
skip_auth is set. Returns {gateway_key, credentials, region}.
An explicit api_key always wins (API-key mode); the
ANTHROPIC_AWS_API_KEY env key applies only without platform args.
Internal constructor helper; not part of the public API.
Instance methods
aws_region
Sourceskip_auth?
Sourceworkspace_id
Source