@ai-sdk/gateway 3.0.40 → 3.0.42

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.
@@ -538,7 +538,7 @@ for await (const part of result.fullStream) {
538
538
  Track usage per end-user and categorize requests with tags:
539
539
 
540
540
  ```ts
541
- import type { GatewayProviderOptions } from '@ai-sdk/gateway';
541
+ import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
542
542
  import { generateText } from 'ai';
543
543
 
544
544
  const { text } = await generateText({
@@ -548,7 +548,7 @@ const { text } = await generateText({
548
548
  gateway: {
549
549
  user: 'user-abc-123', // Track usage for this specific end-user
550
550
  tags: ['document-summary', 'premium-feature'], // Categorize for reporting
551
- } satisfies GatewayProviderOptions,
551
+ } satisfies GatewayLanguageModelOptions,
552
552
  },
553
553
  });
554
554
  ```
@@ -568,7 +568,7 @@ The AI Gateway provider accepts provider options that control routing behavior a
568
568
  You can use the `gateway` key in `providerOptions` to control how AI Gateway routes requests:
569
569
 
570
570
  ```ts
571
- import type { GatewayProviderOptions } from '@ai-sdk/gateway';
571
+ import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
572
572
  import { generateText } from 'ai';
573
573
 
574
574
  const { text } = await generateText({
@@ -578,7 +578,7 @@ const { text } = await generateText({
578
578
  gateway: {
579
579
  order: ['vertex', 'anthropic'], // Try Vertex AI first, then Anthropic
580
580
  only: ['vertex', 'anthropic'], // Only use these providers
581
- } satisfies GatewayProviderOptions,
581
+ } satisfies GatewayLanguageModelOptions,
582
582
  },
583
583
  });
584
584
  ```
@@ -634,7 +634,7 @@ The following gateway provider options are available:
634
634
  You can combine these options to have fine-grained control over routing and tracking:
635
635
 
636
636
  ```ts
637
- import type { GatewayProviderOptions } from '@ai-sdk/gateway';
637
+ import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
638
638
  import { generateText } from 'ai';
639
639
 
640
640
  const { text } = await generateText({
@@ -644,7 +644,7 @@ const { text } = await generateText({
644
644
  gateway: {
645
645
  order: ['vertex'], // Prefer Vertex AI
646
646
  only: ['anthropic', 'vertex'], // Only allow these providers
647
- } satisfies GatewayProviderOptions,
647
+ } satisfies GatewayLanguageModelOptions,
648
648
  },
649
649
  });
650
650
  ```
@@ -654,7 +654,7 @@ const { text } = await generateText({
654
654
  The `models` option enables automatic fallback to alternative models when the primary model fails:
655
655
 
656
656
  ```ts
657
- import type { GatewayProviderOptions } from '@ai-sdk/gateway';
657
+ import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
658
658
  import { generateText } from 'ai';
659
659
 
660
660
  const { text } = await generateText({
@@ -663,7 +663,7 @@ const { text } = await generateText({
663
663
  providerOptions: {
664
664
  gateway: {
665
665
  models: ['openai/gpt-5-nano', 'gemini-2.0-flash'], // Fallback models
666
- } satisfies GatewayProviderOptions,
666
+ } satisfies GatewayLanguageModelOptions,
667
667
  },
668
668
  });
669
669
 
@@ -681,7 +681,7 @@ that have zero data retention policies. When `zeroDataRetention` is `false` or n
681
681
  specified, there is no enforcement of restricting routing.
682
682
 
683
683
  ```ts
684
- import type { GatewayProviderOptions } from '@ai-sdk/gateway';
684
+ import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
685
685
  import { generateText } from 'ai';
686
686
 
687
687
  const { text } = await generateText({
@@ -690,7 +690,7 @@ const { text } = await generateText({
690
690
  providerOptions: {
691
691
  gateway: {
692
692
  zeroDataRetention: true,
693
- } satisfies GatewayProviderOptions,
693
+ } satisfies GatewayLanguageModelOptions,
694
694
  },
695
695
  });
696
696
  ```
@@ -700,8 +700,8 @@ const { text } = await generateText({
700
700
  When using provider-specific options through AI Gateway, use the actual provider name (e.g. `anthropic`, `openai`, not `gateway`) as the key:
701
701
 
702
702
  ```ts
703
- import type { AnthropicProviderOptions } from '@ai-sdk/anthropic';
704
- import type { GatewayProviderOptions } from '@ai-sdk/gateway';
703
+ import type { AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
704
+ import type { GatewayLanguageModelOptions } from '@ai-sdk/gateway';
705
705
  import { generateText } from 'ai';
706
706
 
707
707
  const { text } = await generateText({
@@ -710,10 +710,10 @@ const { text } = await generateText({
710
710
  providerOptions: {
711
711
  gateway: {
712
712
  order: ['vertex', 'anthropic'],
713
- } satisfies GatewayProviderOptions,
713
+ } satisfies GatewayLanguageModelOptions,
714
714
  anthropic: {
715
715
  thinking: { type: 'enabled', budgetTokens: 12000 },
716
- } satisfies AnthropicProviderOptions,
716
+ } satisfies AnthropicLanguageModelOptions,
717
717
  },
718
718
  });
719
719
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "3.0.40",
4
+ "version": "3.0.42",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -2,7 +2,7 @@ import { InferSchema, lazySchema, zodSchema } from '@ai-sdk/provider-utils';
2
2
  import { z } from 'zod/v4';
3
3
 
4
4
  // https://vercel.com/docs/ai-gateway/provider-options
5
- const gatewayProviderOptions = lazySchema(() =>
5
+ const gatewayLanguageModelOptions = lazySchema(() =>
6
6
  zodSchema(
7
7
  z.object({
8
8
  /**
@@ -63,4 +63,6 @@ const gatewayProviderOptions = lazySchema(() =>
63
63
  ),
64
64
  );
65
65
 
66
- export type GatewayProviderOptions = InferSchema<typeof gatewayProviderOptions>;
66
+ export type GatewayLanguageModelOptions = InferSchema<
67
+ typeof gatewayLanguageModelOptions
68
+ >;
@@ -4,6 +4,7 @@ import type {
4
4
  Experimental_VideoModelV3File,
5
5
  Experimental_VideoModelV3VideoData,
6
6
  SharedV3ProviderMetadata,
7
+ SharedV3Warning,
7
8
  } from '@ai-sdk/provider';
8
9
  import {
9
10
  combineHeaders,
@@ -50,7 +51,7 @@ export class GatewayVideoModel implements Experimental_VideoModelV3 {
50
51
  abortSignal,
51
52
  }: Experimental_VideoModelV3CallOptions): Promise<{
52
53
  videos: Array<Experimental_VideoModelV3VideoData>;
53
- warnings: Array<{ type: 'other'; message: string }>;
54
+ warnings: Array<SharedV3Warning>;
54
55
  providerMetadata?: SharedV3ProviderMetadata;
55
56
  response: {
56
57
  timestamp: Date;
@@ -151,16 +152,26 @@ const gatewayVideoDataSchema = z.union([
151
152
  }),
152
153
  ]);
153
154
 
155
+ const gatewayVideoWarningSchema = z.discriminatedUnion('type', [
156
+ z.object({
157
+ type: z.literal('unsupported'),
158
+ feature: z.string(),
159
+ details: z.string().optional(),
160
+ }),
161
+ z.object({
162
+ type: z.literal('compatibility'),
163
+ feature: z.string(),
164
+ details: z.string().optional(),
165
+ }),
166
+ z.object({
167
+ type: z.literal('other'),
168
+ message: z.string(),
169
+ }),
170
+ ]);
171
+
154
172
  const gatewayVideoResponseSchema = z.object({
155
173
  videos: z.array(gatewayVideoDataSchema),
156
- warnings: z
157
- .array(
158
- z.object({
159
- type: z.literal('other'),
160
- message: z.string(),
161
- }),
162
- )
163
- .optional(),
174
+ warnings: z.array(gatewayVideoWarningSchema).optional(),
164
175
  providerMetadata: z
165
176
  .record(z.string(), providerMetadataEntrySchema)
166
177
  .optional(),
package/src/index.ts CHANGED
@@ -15,7 +15,11 @@ export type {
15
15
  GatewayProvider,
16
16
  GatewayProviderSettings,
17
17
  } from './gateway-provider';
18
- export type { GatewayProviderOptions } from './gateway-provider-options';
18
+ export type {
19
+ GatewayLanguageModelOptions,
20
+ /** @deprecated Use `GatewayLanguageModelOptions` instead. */
21
+ GatewayLanguageModelOptions as GatewayProviderOptions,
22
+ } from './gateway-provider-options';
19
23
  export {
20
24
  GatewayError,
21
25
  GatewayAuthenticationError,