@ai-sdk/gateway 3.0.217 → 3.0.219

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "3.0.217",
4
+ "version": "3.0.219",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@vercel/oidc": "3.2.0",
34
34
  "@ai-sdk/provider": "3.0.19",
35
- "@ai-sdk/provider-utils": "4.0.61"
35
+ "@ai-sdk/provider-utils": "4.0.62"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "18.15.11",
@@ -97,29 +97,30 @@ export class GatewayEmbeddingModel implements EmbeddingModelV3 {
97
97
  }
98
98
  }
99
99
 
100
- const gatewayEmbeddingWarningSchema = z.discriminatedUnion('type', [
101
- z.object({
102
- type: z.literal('unsupported'),
103
- feature: z.string(),
104
- details: z.string().optional(),
105
- }),
106
- z.object({
107
- type: z.literal('compatibility'),
108
- feature: z.string(),
109
- details: z.string().optional(),
110
- }),
111
- z.object({
112
- type: z.literal('other'),
113
- message: z.string(),
114
- }),
115
- ]);
100
+ const gatewayEmbeddingWarningSchema = () =>
101
+ z.discriminatedUnion('type', [
102
+ z.object({
103
+ type: z.literal('unsupported'),
104
+ feature: z.string(),
105
+ details: z.string().optional(),
106
+ }),
107
+ z.object({
108
+ type: z.literal('compatibility'),
109
+ feature: z.string(),
110
+ details: z.string().optional(),
111
+ }),
112
+ z.object({
113
+ type: z.literal('other'),
114
+ message: z.string(),
115
+ }),
116
+ ]);
116
117
 
117
118
  const gatewayEmbeddingResponseSchema = lazySchema(() =>
118
119
  zodSchema(
119
120
  z.object({
120
121
  embeddings: z.array(z.array(z.number())),
121
122
  usage: z.object({ tokens: z.number() }).nullish(),
122
- warnings: z.array(gatewayEmbeddingWarningSchema).optional(),
123
+ warnings: z.array(gatewayEmbeddingWarningSchema()).optional(),
123
124
  providerMetadata: z
124
125
  .record(z.string(), z.record(z.string(), z.unknown()))
125
126
  .optional(),
@@ -5,6 +5,7 @@ export type GatewayImageModelId =
5
5
  | 'bfl/flux-2-max'
6
6
  | 'bfl/flux-2-pro'
7
7
  | 'bfl/flux-3-image'
8
+ | 'bfl/flux-3-image-klein'
8
9
  | 'bfl/flux-kontext-max'
9
10
  | 'bfl/flux-kontext-pro'
10
11
  | 'bfl/flux-pro-1.0-fill'
@@ -4,6 +4,8 @@ import type {
4
4
  ImageModelV3ProviderMetadata,
5
5
  } from '@ai-sdk/provider';
6
6
  import {
7
+ lazySchema,
8
+ zodSchema,
7
9
  combineHeaders,
8
10
  convertUint8ArrayToBase64,
9
11
  createJsonErrorResponseHandler,
@@ -135,46 +137,53 @@ function maybeEncodeImageFile(file: ImageModelV3File) {
135
137
  return file;
136
138
  }
137
139
 
138
- const providerMetadataEntrySchema = z
139
- .object({
140
- images: z.array(z.unknown()).optional(),
141
- })
142
- .catchall(z.unknown());
140
+ const providerMetadataEntrySchema = () =>
141
+ z
142
+ .object({
143
+ images: z.array(z.unknown()).optional(),
144
+ })
145
+ .catchall(z.unknown());
143
146
 
144
- const gatewayImageWarningSchema = z.discriminatedUnion('type', [
145
- z.object({
146
- type: z.literal('unsupported'),
147
- feature: z.string(),
148
- details: z.string().optional(),
149
- }),
150
- z.object({
151
- type: z.literal('compatibility'),
152
- feature: z.string(),
153
- details: z.string().optional(),
154
- }),
155
- z.object({
156
- type: z.literal('deprecated'),
157
- setting: z.string(),
158
- message: z.string(),
159
- }),
160
- z.object({
161
- type: z.literal('other'),
162
- message: z.string(),
163
- }),
164
- ]);
147
+ const gatewayImageWarningSchema = () =>
148
+ z.discriminatedUnion('type', [
149
+ z.object({
150
+ type: z.literal('unsupported'),
151
+ feature: z.string(),
152
+ details: z.string().optional(),
153
+ }),
154
+ z.object({
155
+ type: z.literal('compatibility'),
156
+ feature: z.string(),
157
+ details: z.string().optional(),
158
+ }),
159
+ z.object({
160
+ type: z.literal('deprecated'),
161
+ setting: z.string(),
162
+ message: z.string(),
163
+ }),
164
+ z.object({
165
+ type: z.literal('other'),
166
+ message: z.string(),
167
+ }),
168
+ ]);
165
169
 
166
- const gatewayImageUsageSchema = z.object({
167
- inputTokens: z.number().nullish(),
168
- outputTokens: z.number().nullish(),
169
- totalTokens: z.number().nullish(),
170
- });
170
+ const gatewayImageUsageSchema = () =>
171
+ z.object({
172
+ inputTokens: z.number().nullish(),
173
+ outputTokens: z.number().nullish(),
174
+ totalTokens: z.number().nullish(),
175
+ });
171
176
 
172
- const gatewayImageResponseSchema = z.object({
173
- images: z.array(z.string()), // Always base64 strings over the wire
174
- isRetryable: z.boolean().optional(),
175
- warnings: z.array(gatewayImageWarningSchema).optional(),
176
- providerMetadata: z
177
- .record(z.string(), providerMetadataEntrySchema)
178
- .optional(),
179
- usage: gatewayImageUsageSchema.optional(),
180
- });
177
+ const gatewayImageResponseSchema = lazySchema(() =>
178
+ zodSchema(
179
+ z.object({
180
+ images: z.array(z.string()), // Always base64 strings over the wire
181
+ isRetryable: z.boolean().optional(),
182
+ warnings: z.array(gatewayImageWarningSchema()).optional(),
183
+ providerMetadata: z
184
+ .record(z.string(), providerMetadataEntrySchema())
185
+ .optional(),
186
+ usage: gatewayImageUsageSchema().optional(),
187
+ }),
188
+ ),
189
+ );
@@ -75,7 +75,10 @@ export type GatewayModelId =
75
75
  | 'deepseek/deepseek-v4-pro'
76
76
  | 'deepseek/deepseek-v4-pro-0813'
77
77
  | 'deepseek/deepseek-v4.1-flash'
78
+ | 'deepseek/deepseek-v4.1-flash-1017'
79
+ | 'deepseek/deepseek-v4.1-flash-1017-fast'
78
80
  | 'deepseek/deepseek-v4.1-flash-fast'
81
+ | 'elorian/glimpse'
79
82
  | 'fireworks/ember-1'
80
83
  | 'google/gemini-2.5-flash'
81
84
  | 'google/gemini-2.5-flash-batch'
@@ -110,6 +113,7 @@ export type GatewayModelId =
110
113
  | 'google/gemma-4-31b-it'
111
114
  | 'inception/mercury-2'
112
115
  | 'inception/mercury-2.5'
116
+ | 'inception/mercury-3'
113
117
  | 'inception/mercury-coder-small'
114
118
  | 'inclusionai/ling-3.0-flash'
115
119
  | 'inclusionai/ling-3.0-flash-fin'
@@ -142,6 +146,7 @@ export type GatewayModelId =
142
146
  | 'minimax/minimax-m2.7'
143
147
  | 'minimax/minimax-m2.7-highspeed'
144
148
  | 'minimax/minimax-m3'
149
+ | 'minimax/minimax-m3.1-flash'
145
150
  | 'mistral/codestral'
146
151
  | 'mistral/ministral-14b'
147
152
  | 'mistral/ministral-3b'
@@ -283,7 +288,6 @@ export type GatewayModelId =
283
288
  | 'spacexai/grok-4.6'
284
289
  | 'spacexai/grok-4.7'
285
290
  | 'spacexai/grok-build-0.1'
286
- | 'stealth/cat-jam'
287
291
  | 'stealth/glyph-cluster'
288
292
  | 'stepfun/step-3.7-flash'
289
293
  | 'stepfun/step-5-preview'
@@ -98,22 +98,23 @@ export class GatewayRerankingModel implements RerankingModelV3 {
98
98
  }
99
99
  }
100
100
 
101
- const gatewayRerankingWarningSchema = z.discriminatedUnion('type', [
102
- z.object({
103
- type: z.literal('unsupported'),
104
- feature: z.string(),
105
- details: z.string().optional(),
106
- }),
107
- z.object({
108
- type: z.literal('compatibility'),
109
- feature: z.string(),
110
- details: z.string().optional(),
111
- }),
112
- z.object({
113
- type: z.literal('other'),
114
- message: z.string(),
115
- }),
116
- ]);
101
+ const gatewayRerankingWarningSchema = () =>
102
+ z.discriminatedUnion('type', [
103
+ z.object({
104
+ type: z.literal('unsupported'),
105
+ feature: z.string(),
106
+ details: z.string().optional(),
107
+ }),
108
+ z.object({
109
+ type: z.literal('compatibility'),
110
+ feature: z.string(),
111
+ details: z.string().optional(),
112
+ }),
113
+ z.object({
114
+ type: z.literal('other'),
115
+ message: z.string(),
116
+ }),
117
+ ]);
117
118
 
118
119
  const gatewayRerankingResponseSchema = lazySchema(() =>
119
120
  zodSchema(
@@ -124,7 +125,7 @@ const gatewayRerankingResponseSchema = lazySchema(() =>
124
125
  relevanceScore: z.number(),
125
126
  }),
126
127
  ),
127
- warnings: z.array(gatewayRerankingWarningSchema).optional(),
128
+ warnings: z.array(gatewayRerankingWarningSchema()).optional(),
128
129
  providerMetadata: z
129
130
  .record(z.string(), z.record(z.string(), z.unknown()))
130
131
  .optional(),
@@ -1,5 +1,7 @@
1
1
  import type { SharedV3ProviderMetadata, SpeechModelV3 } from '@ai-sdk/provider';
2
2
  import {
3
+ lazySchema,
4
+ zodSchema,
3
5
  combineHeaders,
4
6
  createJsonErrorResponseHandler,
5
7
  createJsonResponseHandler,
@@ -108,34 +110,39 @@ export class GatewaySpeechModel implements SpeechModelV3 {
108
110
  }
109
111
  }
110
112
 
111
- const providerMetadataEntrySchema = z.object({}).catchall(z.unknown());
113
+ const providerMetadataEntrySchema = () => z.object({}).catchall(z.unknown());
112
114
 
113
- const gatewaySpeechWarningSchema = z.discriminatedUnion('type', [
114
- z.object({
115
- type: z.literal('unsupported'),
116
- feature: z.string(),
117
- details: z.string().optional(),
118
- }),
119
- z.object({
120
- type: z.literal('compatibility'),
121
- feature: z.string(),
122
- details: z.string().optional(),
123
- }),
124
- z.object({
125
- type: z.literal('deprecated'),
126
- setting: z.string(),
127
- message: z.string(),
128
- }),
129
- z.object({
130
- type: z.literal('other'),
131
- message: z.string(),
132
- }),
133
- ]);
115
+ const gatewaySpeechWarningSchema = () =>
116
+ z.discriminatedUnion('type', [
117
+ z.object({
118
+ type: z.literal('unsupported'),
119
+ feature: z.string(),
120
+ details: z.string().optional(),
121
+ }),
122
+ z.object({
123
+ type: z.literal('compatibility'),
124
+ feature: z.string(),
125
+ details: z.string().optional(),
126
+ }),
127
+ z.object({
128
+ type: z.literal('deprecated'),
129
+ setting: z.string(),
130
+ message: z.string(),
131
+ }),
132
+ z.object({
133
+ type: z.literal('other'),
134
+ message: z.string(),
135
+ }),
136
+ ]);
134
137
 
135
- const gatewaySpeechResponseSchema = z.object({
136
- audio: z.string(),
137
- warnings: z.array(gatewaySpeechWarningSchema).optional(),
138
- providerMetadata: z
139
- .record(z.string(), providerMetadataEntrySchema)
140
- .optional(),
141
- });
138
+ const gatewaySpeechResponseSchema = lazySchema(() =>
139
+ zodSchema(
140
+ z.object({
141
+ audio: z.string(),
142
+ warnings: z.array(gatewaySpeechWarningSchema()).optional(),
143
+ providerMetadata: z
144
+ .record(z.string(), providerMetadataEntrySchema())
145
+ .optional(),
146
+ }),
147
+ ),
148
+ );
@@ -3,6 +3,8 @@ import type {
3
3
  TranscriptionModelV3,
4
4
  } from '@ai-sdk/provider';
5
5
  import {
6
+ lazySchema,
7
+ zodSchema,
6
8
  combineHeaders,
7
9
  convertUint8ArrayToBase64,
8
10
  createJsonErrorResponseHandler,
@@ -110,45 +112,50 @@ export class GatewayTranscriptionModel implements TranscriptionModelV3 {
110
112
  }
111
113
  }
112
114
 
113
- const providerMetadataEntrySchema = z.object({}).catchall(z.unknown());
115
+ const providerMetadataEntrySchema = () => z.object({}).catchall(z.unknown());
114
116
 
115
- const gatewayTranscriptionWarningSchema = z.discriminatedUnion('type', [
116
- z.object({
117
- type: z.literal('unsupported'),
118
- feature: z.string(),
119
- details: z.string().optional(),
120
- }),
121
- z.object({
122
- type: z.literal('compatibility'),
123
- feature: z.string(),
124
- details: z.string().optional(),
125
- }),
126
- z.object({
127
- type: z.literal('deprecated'),
128
- setting: z.string(),
129
- message: z.string(),
130
- }),
131
- z.object({
132
- type: z.literal('other'),
133
- message: z.string(),
134
- }),
135
- ]);
117
+ const gatewayTranscriptionWarningSchema = () =>
118
+ z.discriminatedUnion('type', [
119
+ z.object({
120
+ type: z.literal('unsupported'),
121
+ feature: z.string(),
122
+ details: z.string().optional(),
123
+ }),
124
+ z.object({
125
+ type: z.literal('compatibility'),
126
+ feature: z.string(),
127
+ details: z.string().optional(),
128
+ }),
129
+ z.object({
130
+ type: z.literal('deprecated'),
131
+ setting: z.string(),
132
+ message: z.string(),
133
+ }),
134
+ z.object({
135
+ type: z.literal('other'),
136
+ message: z.string(),
137
+ }),
138
+ ]);
136
139
 
137
- const gatewayTranscriptionResponseSchema = z.object({
138
- text: z.string(),
139
- segments: z
140
- .array(
141
- z.object({
142
- text: z.string(),
143
- startSecond: z.number(),
144
- endSecond: z.number(),
145
- }),
146
- )
147
- .optional(),
148
- language: z.string().nullish(),
149
- durationInSeconds: z.number().nullish(),
150
- warnings: z.array(gatewayTranscriptionWarningSchema).optional(),
151
- providerMetadata: z
152
- .record(z.string(), providerMetadataEntrySchema)
153
- .optional(),
154
- });
140
+ const gatewayTranscriptionResponseSchema = lazySchema(() =>
141
+ zodSchema(
142
+ z.object({
143
+ text: z.string(),
144
+ segments: z
145
+ .array(
146
+ z.object({
147
+ text: z.string(),
148
+ startSecond: z.number(),
149
+ endSecond: z.number(),
150
+ }),
151
+ )
152
+ .optional(),
153
+ language: z.string().nullish(),
154
+ durationInSeconds: z.number().nullish(),
155
+ warnings: z.array(gatewayTranscriptionWarningSchema()).optional(),
156
+ providerMetadata: z
157
+ .record(z.string(), providerMetadataEntrySchema())
158
+ .optional(),
159
+ }),
160
+ ),
161
+ );
@@ -8,6 +8,8 @@ import {
8
8
  type SharedV3Warning,
9
9
  } from '@ai-sdk/provider';
10
10
  import {
11
+ lazySchema,
12
+ zodSchema,
11
13
  combineHeaders,
12
14
  convertUint8ArrayToBase64,
13
15
  createJsonErrorResponseHandler,
@@ -221,61 +223,68 @@ function maybeEncodeVideoFile(file: Experimental_VideoModelV3File) {
221
223
  return file;
222
224
  }
223
225
 
224
- const providerMetadataEntrySchema = z
225
- .object({
226
- videos: z.array(z.unknown()).optional(),
227
- })
228
- .catchall(z.unknown());
226
+ const providerMetadataEntrySchema = () =>
227
+ z
228
+ .object({
229
+ videos: z.array(z.unknown()).optional(),
230
+ })
231
+ .catchall(z.unknown());
229
232
 
230
- const gatewayVideoDataSchema = z.union([
231
- z.object({
232
- type: z.literal('url'),
233
- url: z.string(),
234
- mediaType: z.string(),
235
- }),
236
- z.object({
237
- type: z.literal('base64'),
238
- data: z.string(),
239
- mediaType: z.string(),
240
- }),
241
- ]);
233
+ const gatewayVideoDataSchema = () =>
234
+ z.union([
235
+ z.object({
236
+ type: z.literal('url'),
237
+ url: z.string(),
238
+ mediaType: z.string(),
239
+ }),
240
+ z.object({
241
+ type: z.literal('base64'),
242
+ data: z.string(),
243
+ mediaType: z.string(),
244
+ }),
245
+ ]);
242
246
 
243
- const gatewayVideoWarningSchema = z.discriminatedUnion('type', [
244
- z.object({
245
- type: z.literal('unsupported'),
246
- feature: z.string(),
247
- details: z.string().optional(),
248
- }),
249
- z.object({
250
- type: z.literal('compatibility'),
251
- feature: z.string(),
252
- details: z.string().optional(),
253
- }),
254
- z.object({
255
- type: z.literal('deprecated'),
256
- setting: z.string(),
257
- message: z.string(),
258
- }),
259
- z.object({
260
- type: z.literal('other'),
261
- message: z.string(),
262
- }),
263
- ]);
247
+ const gatewayVideoWarningSchema = () =>
248
+ z.discriminatedUnion('type', [
249
+ z.object({
250
+ type: z.literal('unsupported'),
251
+ feature: z.string(),
252
+ details: z.string().optional(),
253
+ }),
254
+ z.object({
255
+ type: z.literal('compatibility'),
256
+ feature: z.string(),
257
+ details: z.string().optional(),
258
+ }),
259
+ z.object({
260
+ type: z.literal('deprecated'),
261
+ setting: z.string(),
262
+ message: z.string(),
263
+ }),
264
+ z.object({
265
+ type: z.literal('other'),
266
+ message: z.string(),
267
+ }),
268
+ ]);
264
269
 
265
- const gatewayVideoEventSchema = z.discriminatedUnion('type', [
266
- z.object({
267
- type: z.literal('result'),
268
- videos: z.array(gatewayVideoDataSchema),
269
- warnings: z.array(gatewayVideoWarningSchema).optional(),
270
- providerMetadata: z
271
- .record(z.string(), providerMetadataEntrySchema)
272
- .optional(),
273
- }),
274
- z.object({
275
- type: z.literal('error'),
276
- message: z.string(),
277
- errorType: z.string(),
278
- statusCode: z.number(),
279
- param: z.unknown().nullable(),
280
- }),
281
- ]);
270
+ const gatewayVideoEventSchema = lazySchema(() =>
271
+ zodSchema(
272
+ z.discriminatedUnion('type', [
273
+ z.object({
274
+ type: z.literal('result'),
275
+ videos: z.array(gatewayVideoDataSchema()),
276
+ warnings: z.array(gatewayVideoWarningSchema()).optional(),
277
+ providerMetadata: z
278
+ .record(z.string(), providerMetadataEntrySchema())
279
+ .optional(),
280
+ }),
281
+ z.object({
282
+ type: z.literal('error'),
283
+ message: z.string(),
284
+ errorType: z.string(),
285
+ statusCode: z.number(),
286
+ param: z.unknown().nullable(),
287
+ }),
288
+ ]),
289
+ ),
290
+ );
@@ -76,7 +76,7 @@ export type BrowserbaseFetchOutput =
76
76
  | BrowserbaseFetchError
77
77
  | BrowserbaseFetchResponse;
78
78
 
79
- const jsonObjectSchema = z.record(z.string(), z.unknown());
79
+ const jsonObjectSchema = () => z.record(z.string(), z.unknown());
80
80
 
81
81
  const browserbaseFetchInputSchema = lazySchema(() =>
82
82
  zodSchema(
@@ -104,7 +104,7 @@ const browserbaseFetchInputSchema = lazySchema(() =>
104
104
  .describe(
105
105
  'Output format. raw returns the response body unchanged, markdown returns page content as Markdown, and json returns structured content using schema.',
106
106
  ),
107
- schema: jsonObjectSchema
107
+ schema: jsonObjectSchema()
108
108
  .optional()
109
109
  .describe(
110
110
  'JSON Schema for structured extraction. Only use with format set to json.',
@@ -118,7 +118,7 @@ const browserbaseFetchOutputSchema = lazySchema(() =>
118
118
  z.union([
119
119
  z.object({
120
120
  id: z.string(),
121
- content: z.union([z.string(), jsonObjectSchema]),
121
+ content: z.union([z.string(), jsonObjectSchema()]),
122
122
  contentType: z.string(),
123
123
  encoding: z.string(),
124
124
  headers: z.record(z.string(), z.string()),