@ai-sdk/amazon-bedrock 4.0.86 → 4.0.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -514,6 +514,37 @@ console.log(amazonResult.text); // text response
514
514
  See [AI SDK UI: Chatbot](/docs/ai-sdk-ui/chatbot#reasoning) for more details
515
515
  on how to integrate reasoning into your chatbot.
516
516
 
517
+ ## Service Tiers
518
+
519
+ Amazon Bedrock supports selecting an inference service tier per request via the `serviceTier` provider option.
520
+
521
+ ```ts
522
+ import {
523
+ bedrock,
524
+ type AmazonBedrockLanguageModelOptions,
525
+ } from '@ai-sdk/amazon-bedrock';
526
+ import { generateText } from 'ai';
527
+
528
+ const result = await generateText({
529
+ model: bedrock('us.anthropic.claude-sonnet-4-20250514-v1:0'),
530
+ prompt: 'Summarize this support ticket backlog.',
531
+ providerOptions: {
532
+ bedrock: {
533
+ serviceTier: 'priority',
534
+ } satisfies AmazonBedrockLanguageModelOptions,
535
+ },
536
+ });
537
+ ```
538
+
539
+ Supported values are:
540
+
541
+ - `reserved`
542
+ - `priority`
543
+ - `default`
544
+ - `flex`
545
+
546
+ See the [Amazon Bedrock service tiers documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html) for model availability and behavior.
547
+
517
548
  ## Extended Context Window
518
549
 
519
550
  Claude Sonnet 4 models on Amazon Bedrock support an extended context window of up to 1 million tokens when using the `context-1m-2025-08-07` beta feature.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "4.0.86",
3
+ "version": "4.0.87",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -39,8 +39,8 @@
39
39
  "@smithy/util-utf8": "^4.0.0",
40
40
  "aws4fetch": "^1.0.20",
41
41
  "@ai-sdk/anthropic": "3.0.64",
42
- "@ai-sdk/provider-utils": "4.0.21",
43
- "@ai-sdk/provider": "3.0.8"
42
+ "@ai-sdk/provider": "3.0.8",
43
+ "@ai-sdk/provider-utils": "4.0.21"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "20.17.24",
@@ -13,6 +13,9 @@ export interface BedrockConverseInput {
13
13
  };
14
14
  additionalModelRequestFields?: Record<string, unknown>;
15
15
  additionalModelResponseFieldPaths?: string[];
16
+ serviceTier?: {
17
+ type: string;
18
+ };
16
19
  guardrailConfig?:
17
20
  | BedrockGuardrailConfiguration
18
21
  | BedrockGuardrailStreamConfiguration
@@ -368,6 +368,7 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
368
368
  const {
369
369
  reasoningConfig: _,
370
370
  additionalModelRequestFields: __,
371
+ serviceTier: ___,
371
372
  ...filteredBedrockOptions
372
373
  } = providerOptions?.bedrock || {};
373
374
 
@@ -387,6 +388,11 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
387
388
  ...(Object.keys(inferenceConfig).length > 0 && {
388
389
  inferenceConfig,
389
390
  }),
391
+ ...(bedrockOptions.serviceTier != null && {
392
+ serviceTier: {
393
+ type: bedrockOptions.serviceTier,
394
+ },
395
+ }),
390
396
  ...filteredBedrockOptions,
391
397
  ...(toolConfig.tools !== undefined && toolConfig.tools.length > 0
392
398
  ? { toolConfig }
@@ -122,6 +122,16 @@ export const amazonBedrockLanguageModelOptions = z.object({
122
122
  * Anthropic beta features to enable
123
123
  */
124
124
  anthropicBeta: z.array(z.string()).optional(),
125
+ /**
126
+ * Service tier for the request.
127
+ * @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
128
+ *
129
+ * - 'reserved': Uses provisioned throughput capacity
130
+ * - 'priority': Prioritizes low-latency inference when capacity is available
131
+ * - 'default': Standard on-demand tier
132
+ * - 'flex': Lower-cost tier for flexible latency workloads
133
+ */
134
+ serviceTier: z.enum(['reserved', 'priority', 'default', 'flex']).optional(),
125
135
  });
126
136
 
127
137
  export type AmazonBedrockLanguageModelOptions = z.infer<