class

Anthropic::Bedrock::MantleClient

Inherits Anthropic::Client < Reference < Object

Anthropic Messages client that targets Amazon Bedrock Mantle.

Unlike Anthropic::Bedrock::Client (Bedrock Runtime), Mantle uses native Anthropic paths (/v1/messages) and does not rewrite the request body. Auth is SigV4 with service name bedrock-mantle, or a Bedrock bearer token.

client = Anthropic::Bedrock::MantleClient.new(
  aws_profile: "anthropic-cr-bedrock",
  aws_region: "us-east-1",
)

message = client.messages.create(
  model: "claude-haiku-4-5-20251001",
  max_tokens: 256,
  messages: [{role: "user", content: "Hello from Mantle!"}],
)
puts message.text

Only messages and beta.messages are supported. Models, batches, files, and other resources raise NotImplementedError.

Constants

SERVICE_NAME = "bedrock-mantle"

Constructors

new(aws_access_key : String | Nil = nil, aws_secret_key : String | Nil = nil, aws_session_token : String | Nil = nil, aws_region : String | Nil = nil, aws_profile : String | Nil = nil, api_key : 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)

Create a Bedrock Mantle client.

Auth precedence (matches official SDKs):

  1. api_key constructor arg → Bearer mode
  2. Explicit AWS credentials / aws_profile → SigV4 (bedrock-mantle)
  3. AWS_BEARER_TOKEN_BEDROCK or ANTHROPIC_AWS_API_KEY → Bearer mode
  4. Default AWS credential chain → SigV4

Base URL: ANTHROPIC_BEDROCK_MANTLE_BASE_URL, else https://bedrock-mantle.{region}.api.aws/anthropic.

Source

Instance methods

aws_region
Source
beta

Restricted beta surface: messages only.

Source
models

Models listing is not supported on Bedrock Mantle.

Source
post_stream(path : String, body, extra_headers : Hash(String, String) | Nil = nil, &)

Mantle returns native SSE — stream via the standard Anthropic event path with Mantle auth (SigV4 or Bearer) applied.

Source
skip_auth?
Source
use_sig_v4?
Source