Class BedrockCodec

java.lang.Object
org.mockserver.llm.codec.BedrockCodec
All Implemented Interfaces:
ProviderCodec

public class BedrockCodec extends Object implements ProviderCodec
Codec for AWS Bedrock (Anthropic-on-Bedrock) invokeModel API (version bedrock-2023-05-31).

This codec targets the plain Anthropic body wire format used by Bedrock's invokeModel endpoint for Anthropic Claude models. The request and response shapes are essentially identical to native Anthropic Messages API — the key difference is the model identifier format and URL path.

Streaming: Bedrock's InvokeModelWithResponseStream uses the AWS event-stream binary framing (application/vnd.amazon.eventstream). Each streaming chunk is wrapped as a binary message with headers (:event-type=chunk, :content-type=application/json, :message-type=event) and a payload of {"bytes":"<base64(chunkJson)>"}. This codec declares StreamingFormat.AWS_EVENT_STREAM and the downstream write handler (HttpSseResponseActionHandler) encodes each chunk into the binary event-stream format via BedrockEventStreamEncoder.

SigV4 signing: automatic AWS SigV4 request signing for calling real Bedrock is not yet implemented. Callers should supply auth headers via the LlmBackend.headers() escape hatch or a signing proxy. This remains a follow-up.