new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

bedrock/options

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Amazon Bedrock provider options for model-specific settings

Amazon Bedrock models support model-specific provider options through the `providerOptions` argument. Model-specific settings can be passed using `providerOptions` with vendor-specific keys. Documentation for additional settings is found in the Amazon Bedrock Inference Parameter Documentation. Example: `await generateText({ model, providerOptions: { anthropic: { additionalModelRequestFields: { top_k: 350 } } } });`

Amazon Bedrock structured outputs modes

For Anthropic models on Amazon Bedrock, the `structuredOutputMode` provider option can be set to: 'outputFormat' (use Bedrock's native output_config.format parameter), 'jsonTool' (use a special json tool with required tool choice), or 'auto' (use native structured output when supported, otherwise fall back to JSON tool, this is the default). In 'auto' mode, Claude Sonnet 4.6 and Claude Haiku 4.5 use the JSON tool fallback. The legacy `providerOptions.bedrock` key and `providerOptions.anthropic.structuredOutputMode` are also supported for Anthropic models on Bedrock.

Amazon Bedrock Guardrails support

Amazon Bedrock Guardrails can be used via the `bedrock` provider options. Guardrail configuration includes guardrailIdentifier (string), guardrailVersion (string), trace ('enabled' as const, optional), and streamProcessingMode (string, optional). Tracing information is returned in `result.providerMetadata?.bedrock.trace` if tracing is enabled.

Amazon Bedrock guard content qualifiers

Available guardContentQualifiers for text parts marked as guard content are: 'grounding_source' (content used as a grounding source for the guardrail), 'query' (content treated as a query to evaluate), and 'guard_content' (content to be evaluated by the guardrail).

Amazon Bedrock prompt caching (preview)

Amazon Bedrock prompt caching is currently in preview release. Cache points can be set in messages using the `providerOptions` property with the `bedrock` key set to `{ cachePoint: { type: 'default' } }`. TTL (time-to-live) can be specified with supported values of '5m' (5 minutes, default) and '1h' (1 hour, only supported by Claude Opus 4.5, Claude Haiku 4.5, and Claude Sonnet 4.5). Cache points have model-specific token minimums and limits; for example, Claude 3.5 Sonnet v2 requires at least 1,024 tokens and allows up to 4 cache points.

Amazon Bedrock cache point TTL rule

When using multiple cache points with different TTLs, cache entries with longer TTL must appear before shorter TTLs (i.e., 1-hour cache entries must come before 5-minute cache entries).

Amazon Bedrock service tiers

Amazon Bedrock supports selecting an inference service tier per request via the `serviceTier` provider option. Supported values are: 'reserved', 'priority', 'default', and 'flex'.

Bedrock Anthropic provider options

The following optional provider options are available for Bedrock Anthropic models: metadata (object, optional metadata to include with the request, includes userId (string, external identifier for the end-user)).

Bedrock Anthropic cache control setup

To set cache control breakpoints in messages and message parts, use the providerOptions property with the anthropic property set to { cacheControl: { type: 'ephemeral' } }. Cache control requires a minimum of 1024 tokens before the cache checkpoint.

Example: Bedrock Anthropic cache control

import { bedrockAnthropic } from '@ai-sdk/amazon-bedrock/anthropic'; import { generateText } from 'ai'; const result = await generateText({ model: bedrockAnthropic('us.anthropic.claude-sonnet-4-5-20250929-v1:0'), messages: [ { role: 'system', content: 'You are an expert assistant.', providerOptions: { anthropic: { cacheControl: { type: 'ephemeral' } }, }, }, { role: 'user', content: 'Explain quantum computing.', }, ], });

Give your agent this brain