Skip to main content

AWS Bedrock best practices

Last updated 3 min read

AWS Bedrock exposes two API surfaces and Coolhand records them as separate sources: `bedrock` for the OpenAI-compatible Chat Completions format, and `bedrock_anthropic` for the native Anthropic Messages format. Which one you call changes the field shape Coolhand can capture, so pick one per workload and stay on it.

Bedrock exposes two distinct API surfaces, each captured as a separate source in Coolhand:

Source Endpoint
bedrock OpenAI-compatible Chat Completions format
bedrock_anthropic Native Anthropic Messages API format

Model IDs use Bedrock naming — not provider model names

bedrock (OpenAI-compatible):

amazon.nova-pro-v1:0
amazon.nova-lite-v1:0
meta.llama3-70b-instruct-v1:0
amazon.titan-text-premier-v1:0

bedrock_anthropic (native Anthropic):

anthropic.claude-3-5-sonnet-20241022-v2:0
anthropic.claude-3-5-haiku-20241022-v1:0
anthropic.claude-sonnet-4-5-20250929-v1:0

The same underlying Claude model has a different identifier on bedrock_anthropic vs. direct anthropic logs. Cross-provider filtering by model requires awareness of this naming difference.


System prompt (bedrock_anthropic only)

Same as Anthropic Best Practices: the system prompt is a top-level system field, not a role: "system" message.


Structured outputs

bedrock: Native structured outputs are GA on Bedrock as of February 2026 via outputConfig.textFormat / response_format. Support varies by model; check the AWS documentation for per-model availability.

bedrock_anthropic: Same as Anthropic Best Practices — native structured outputs supported on current models; tool use is the fallback for older models/SDKs.


Caching

bedrock: Cached Input Tokens are captured when the model reports a cache hit. Cache Creation Tokens are not surfaced by this endpoint and will always be blank. TTL and invalidation are model-dependent and not uniformly documented by AWS for the OpenAI-compatible interface.

bedrock_anthropic: Same mechanics as Anthropic Best Practices — explicit cache_control: { type: "ephemeral" } markers, 5-minute TTL, ~1.25× write rate / ~0.1× read rate. Coolhand captures both Cache Creation Tokens and Cached Input Tokens.


Batch processing

AWS Bedrock Batch Inference reads a JSONL input file from S3, processes the requests asynchronously, and writes results to an S3 output path. Supported on most Bedrock models, including Claude and Nova models on both API surfaces.

  • Completion target: within 24 hours (specify completion_window: "24h" in the job request)
  • Input and output stay in your AWS account (S3 buckets you control)
  • 50% of on-demand pricing on supported foundation models

Docs: https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference.html


Non-standard token fields (bedrock only)

Field When present
Cached Input Tokens When model reports a cache hit
Audio Input Tokens Multimodal requests with audio input

Extended thinking (bedrock_anthropic only)

Same as Anthropic Best Practices: must be explicitly requested; may include [redacted thinking] blocks.


Latency

bedrock: Wall-clock time from the collector, not server-side processing time. Includes network transit to AWS and Bedrock routing overhead.

bedrock_anthropic: Prefers the x-envoy-upstream-service-time response header (server-side processing time in ms) when present, and falls back to the collector's wall-clock duration. Same behavior as direct Anthropic logs. Cross-region inference adds additional routing latency when enabled.

Related articles

  • Anthropic API best practices

    Anthropic's Messages API carries the system prompt in a top-level `system` field rather than a message with a system ...

  • OpenRouter best practices

    OpenRouter model IDs are routing aliases in `provider/model` form, not provider-native names. Coolhand records the al...

  • Azure OpenAI best practices

    Azure logs record your deployment name, not the underlying model version, so `my-gpt4o-prod` appears where you might ...

  • OpenAI API best practices

    OpenAI renamed the system-instruction role to `developer` for its o-series reasoning models and silently maps `system...