@ai-sdk/openai 2.1.0-beta.9 → 3.0.0-beta.18

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/dist/index.mjs CHANGED
@@ -19,10 +19,9 @@ import {
19
19
  parseProviderOptions,
20
20
  postJsonToApi
21
21
  } from "@ai-sdk/provider-utils";
22
- import { z as z3 } from "zod/v4";
23
22
 
24
23
  // src/openai-error.ts
25
- import { z } from "zod/v4";
24
+ import * as z from "zod/v4";
26
25
  import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
27
26
  var openaiErrorDataSchema = z.object({
28
27
  error: z.object({
@@ -49,6 +48,7 @@ function convertToOpenAIChatMessages({
49
48
  prompt,
50
49
  systemMessageMode = "system"
51
50
  }) {
51
+ var _a;
52
52
  const messages = [];
53
53
  const warnings = [];
54
54
  for (const { role, content } of prompt) {
@@ -87,7 +87,7 @@ function convertToOpenAIChatMessages({
87
87
  messages.push({
88
88
  role: "user",
89
89
  content: content.map((part, index) => {
90
- var _a, _b, _c;
90
+ var _a2, _b, _c;
91
91
  switch (part.type) {
92
92
  case "text": {
93
93
  return { type: "text", text: part.text };
@@ -100,7 +100,7 @@ function convertToOpenAIChatMessages({
100
100
  image_url: {
101
101
  url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
102
102
  // OpenAI specific extension: image detail
103
- detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
103
+ detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
104
104
  }
105
105
  };
106
106
  } else if (part.mediaType.startsWith("audio/")) {
@@ -197,6 +197,9 @@ function convertToOpenAIChatMessages({
197
197
  case "error-text":
198
198
  contentValue = output.value;
199
199
  break;
200
+ case "execution-denied":
201
+ contentValue = (_a = output.reason) != null ? _a : "Tool execution denied.";
202
+ break;
200
203
  case "content":
201
204
  case "json":
202
205
  case "error-json":
@@ -250,95 +253,244 @@ function mapOpenAIFinishReason(finishReason) {
250
253
  }
251
254
  }
252
255
 
256
+ // src/chat/openai-chat-api.ts
257
+ import {
258
+ lazyValidator,
259
+ zodSchema
260
+ } from "@ai-sdk/provider-utils";
261
+ import * as z2 from "zod/v4";
262
+ var openaiChatResponseSchema = lazyValidator(
263
+ () => zodSchema(
264
+ z2.object({
265
+ id: z2.string().nullish(),
266
+ created: z2.number().nullish(),
267
+ model: z2.string().nullish(),
268
+ choices: z2.array(
269
+ z2.object({
270
+ message: z2.object({
271
+ role: z2.literal("assistant").nullish(),
272
+ content: z2.string().nullish(),
273
+ tool_calls: z2.array(
274
+ z2.object({
275
+ id: z2.string().nullish(),
276
+ type: z2.literal("function"),
277
+ function: z2.object({
278
+ name: z2.string(),
279
+ arguments: z2.string()
280
+ })
281
+ })
282
+ ).nullish(),
283
+ annotations: z2.array(
284
+ z2.object({
285
+ type: z2.literal("url_citation"),
286
+ start_index: z2.number(),
287
+ end_index: z2.number(),
288
+ url: z2.string(),
289
+ title: z2.string()
290
+ })
291
+ ).nullish()
292
+ }),
293
+ index: z2.number(),
294
+ logprobs: z2.object({
295
+ content: z2.array(
296
+ z2.object({
297
+ token: z2.string(),
298
+ logprob: z2.number(),
299
+ top_logprobs: z2.array(
300
+ z2.object({
301
+ token: z2.string(),
302
+ logprob: z2.number()
303
+ })
304
+ )
305
+ })
306
+ ).nullish()
307
+ }).nullish(),
308
+ finish_reason: z2.string().nullish()
309
+ })
310
+ ),
311
+ usage: z2.object({
312
+ prompt_tokens: z2.number().nullish(),
313
+ completion_tokens: z2.number().nullish(),
314
+ total_tokens: z2.number().nullish(),
315
+ prompt_tokens_details: z2.object({
316
+ cached_tokens: z2.number().nullish()
317
+ }).nullish(),
318
+ completion_tokens_details: z2.object({
319
+ reasoning_tokens: z2.number().nullish(),
320
+ accepted_prediction_tokens: z2.number().nullish(),
321
+ rejected_prediction_tokens: z2.number().nullish()
322
+ }).nullish()
323
+ }).nullish()
324
+ })
325
+ )
326
+ );
327
+ var openaiChatChunkSchema = lazyValidator(
328
+ () => zodSchema(
329
+ z2.union([
330
+ z2.object({
331
+ id: z2.string().nullish(),
332
+ created: z2.number().nullish(),
333
+ model: z2.string().nullish(),
334
+ choices: z2.array(
335
+ z2.object({
336
+ delta: z2.object({
337
+ role: z2.enum(["assistant"]).nullish(),
338
+ content: z2.string().nullish(),
339
+ tool_calls: z2.array(
340
+ z2.object({
341
+ index: z2.number(),
342
+ id: z2.string().nullish(),
343
+ type: z2.literal("function").nullish(),
344
+ function: z2.object({
345
+ name: z2.string().nullish(),
346
+ arguments: z2.string().nullish()
347
+ })
348
+ })
349
+ ).nullish(),
350
+ annotations: z2.array(
351
+ z2.object({
352
+ type: z2.literal("url_citation"),
353
+ start_index: z2.number(),
354
+ end_index: z2.number(),
355
+ url: z2.string(),
356
+ title: z2.string()
357
+ })
358
+ ).nullish()
359
+ }).nullish(),
360
+ logprobs: z2.object({
361
+ content: z2.array(
362
+ z2.object({
363
+ token: z2.string(),
364
+ logprob: z2.number(),
365
+ top_logprobs: z2.array(
366
+ z2.object({
367
+ token: z2.string(),
368
+ logprob: z2.number()
369
+ })
370
+ )
371
+ })
372
+ ).nullish()
373
+ }).nullish(),
374
+ finish_reason: z2.string().nullish(),
375
+ index: z2.number()
376
+ })
377
+ ),
378
+ usage: z2.object({
379
+ prompt_tokens: z2.number().nullish(),
380
+ completion_tokens: z2.number().nullish(),
381
+ total_tokens: z2.number().nullish(),
382
+ prompt_tokens_details: z2.object({
383
+ cached_tokens: z2.number().nullish()
384
+ }).nullish(),
385
+ completion_tokens_details: z2.object({
386
+ reasoning_tokens: z2.number().nullish(),
387
+ accepted_prediction_tokens: z2.number().nullish(),
388
+ rejected_prediction_tokens: z2.number().nullish()
389
+ }).nullish()
390
+ }).nullish()
391
+ }),
392
+ openaiErrorDataSchema
393
+ ])
394
+ )
395
+ );
396
+
253
397
  // src/chat/openai-chat-options.ts
254
- import { z as z2 } from "zod/v4";
255
- var openaiChatLanguageModelOptions = z2.object({
256
- /**
257
- * Modify the likelihood of specified tokens appearing in the completion.
258
- *
259
- * Accepts a JSON object that maps tokens (specified by their token ID in
260
- * the GPT tokenizer) to an associated bias value from -100 to 100.
261
- */
262
- logitBias: z2.record(z2.coerce.number(), z2.number()).optional(),
263
- /**
264
- * Return the log probabilities of the tokens.
265
- *
266
- * Setting to true will return the log probabilities of the tokens that
267
- * were generated.
268
- *
269
- * Setting to a number will return the log probabilities of the top n
270
- * tokens that were generated.
271
- */
272
- logprobs: z2.union([z2.boolean(), z2.number()]).optional(),
273
- /**
274
- * Whether to enable parallel function calling during tool use. Default to true.
275
- */
276
- parallelToolCalls: z2.boolean().optional(),
277
- /**
278
- * A unique identifier representing your end-user, which can help OpenAI to
279
- * monitor and detect abuse.
280
- */
281
- user: z2.string().optional(),
282
- /**
283
- * Reasoning effort for reasoning models. Defaults to `medium`.
284
- */
285
- reasoningEffort: z2.enum(["minimal", "low", "medium", "high"]).optional(),
286
- /**
287
- * Maximum number of completion tokens to generate. Useful for reasoning models.
288
- */
289
- maxCompletionTokens: z2.number().optional(),
290
- /**
291
- * Whether to enable persistence in responses API.
292
- */
293
- store: z2.boolean().optional(),
294
- /**
295
- * Metadata to associate with the request.
296
- */
297
- metadata: z2.record(z2.string().max(64), z2.string().max(512)).optional(),
298
- /**
299
- * Parameters for prediction mode.
300
- */
301
- prediction: z2.record(z2.string(), z2.any()).optional(),
302
- /**
303
- * Whether to use structured outputs.
304
- *
305
- * @default true
306
- */
307
- structuredOutputs: z2.boolean().optional(),
308
- /**
309
- * Service tier for the request.
310
- * - 'auto': Default service tier
311
- * - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
312
- * - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
313
- *
314
- * @default 'auto'
315
- */
316
- serviceTier: z2.enum(["auto", "flex", "priority"]).optional(),
317
- /**
318
- * Whether to use strict JSON schema validation.
319
- *
320
- * @default false
321
- */
322
- strictJsonSchema: z2.boolean().optional(),
323
- /**
324
- * Controls the verbosity of the model's responses.
325
- * Lower values will result in more concise responses, while higher values will result in more verbose responses.
326
- */
327
- textVerbosity: z2.enum(["low", "medium", "high"]).optional(),
328
- /**
329
- * A cache key for prompt caching. Allows manual control over prompt caching behavior.
330
- * Useful for improving cache hit rates and working around automatic caching issues.
331
- */
332
- promptCacheKey: z2.string().optional(),
333
- /**
334
- * A stable identifier used to help detect users of your application
335
- * that may be violating OpenAI's usage policies. The IDs should be a
336
- * string that uniquely identifies each user. We recommend hashing their
337
- * username or email address, in order to avoid sending us any identifying
338
- * information.
339
- */
340
- safetyIdentifier: z2.string().optional()
341
- });
398
+ import {
399
+ lazyValidator as lazyValidator2,
400
+ zodSchema as zodSchema2
401
+ } from "@ai-sdk/provider-utils";
402
+ import * as z3 from "zod/v4";
403
+ var openaiChatLanguageModelOptions = lazyValidator2(
404
+ () => zodSchema2(
405
+ z3.object({
406
+ /**
407
+ * Modify the likelihood of specified tokens appearing in the completion.
408
+ *
409
+ * Accepts a JSON object that maps tokens (specified by their token ID in
410
+ * the GPT tokenizer) to an associated bias value from -100 to 100.
411
+ */
412
+ logitBias: z3.record(z3.coerce.number(), z3.number()).optional(),
413
+ /**
414
+ * Return the log probabilities of the tokens.
415
+ *
416
+ * Setting to true will return the log probabilities of the tokens that
417
+ * were generated.
418
+ *
419
+ * Setting to a number will return the log probabilities of the top n
420
+ * tokens that were generated.
421
+ */
422
+ logprobs: z3.union([z3.boolean(), z3.number()]).optional(),
423
+ /**
424
+ * Whether to enable parallel function calling during tool use. Default to true.
425
+ */
426
+ parallelToolCalls: z3.boolean().optional(),
427
+ /**
428
+ * A unique identifier representing your end-user, which can help OpenAI to
429
+ * monitor and detect abuse.
430
+ */
431
+ user: z3.string().optional(),
432
+ /**
433
+ * Reasoning effort for reasoning models. Defaults to `medium`.
434
+ */
435
+ reasoningEffort: z3.enum(["minimal", "low", "medium", "high"]).optional(),
436
+ /**
437
+ * Maximum number of completion tokens to generate. Useful for reasoning models.
438
+ */
439
+ maxCompletionTokens: z3.number().optional(),
440
+ /**
441
+ * Whether to enable persistence in responses API.
442
+ */
443
+ store: z3.boolean().optional(),
444
+ /**
445
+ * Metadata to associate with the request.
446
+ */
447
+ metadata: z3.record(z3.string().max(64), z3.string().max(512)).optional(),
448
+ /**
449
+ * Parameters for prediction mode.
450
+ */
451
+ prediction: z3.record(z3.string(), z3.any()).optional(),
452
+ /**
453
+ * Whether to use structured outputs.
454
+ *
455
+ * @default true
456
+ */
457
+ structuredOutputs: z3.boolean().optional(),
458
+ /**
459
+ * Service tier for the request.
460
+ * - 'auto': Default service tier
461
+ * - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
462
+ * - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
463
+ *
464
+ * @default 'auto'
465
+ */
466
+ serviceTier: z3.enum(["auto", "flex", "priority"]).optional(),
467
+ /**
468
+ * Whether to use strict JSON schema validation.
469
+ *
470
+ * @default false
471
+ */
472
+ strictJsonSchema: z3.boolean().optional(),
473
+ /**
474
+ * Controls the verbosity of the model's responses.
475
+ * Lower values will result in more concise responses, while higher values will result in more verbose responses.
476
+ */
477
+ textVerbosity: z3.enum(["low", "medium", "high"]).optional(),
478
+ /**
479
+ * A cache key for prompt caching. Allows manual control over prompt caching behavior.
480
+ * Useful for improving cache hit rates and working around automatic caching issues.
481
+ */
482
+ promptCacheKey: z3.string().optional(),
483
+ /**
484
+ * A stable identifier used to help detect users of your application
485
+ * that may be violating OpenAI's usage policies. The IDs should be a
486
+ * string that uniquely identifies each user. We recommend hashing their
487
+ * username or email address, in order to avoid sending us any identifying
488
+ * information.
489
+ */
490
+ safetyIdentifier: z3.string().optional()
491
+ })
492
+ )
493
+ );
342
494
 
343
495
  // src/chat/openai-chat-prepare-tools.ts
344
496
  import {
@@ -896,121 +1048,6 @@ var OpenAIChatLanguageModel = class {
896
1048
  };
897
1049
  }
898
1050
  };
899
- var openaiTokenUsageSchema = z3.object({
900
- prompt_tokens: z3.number().nullish(),
901
- completion_tokens: z3.number().nullish(),
902
- total_tokens: z3.number().nullish(),
903
- prompt_tokens_details: z3.object({
904
- cached_tokens: z3.number().nullish()
905
- }).nullish(),
906
- completion_tokens_details: z3.object({
907
- reasoning_tokens: z3.number().nullish(),
908
- accepted_prediction_tokens: z3.number().nullish(),
909
- rejected_prediction_tokens: z3.number().nullish()
910
- }).nullish()
911
- }).nullish();
912
- var openaiChatResponseSchema = z3.object({
913
- id: z3.string().nullish(),
914
- created: z3.number().nullish(),
915
- model: z3.string().nullish(),
916
- choices: z3.array(
917
- z3.object({
918
- message: z3.object({
919
- role: z3.literal("assistant").nullish(),
920
- content: z3.string().nullish(),
921
- tool_calls: z3.array(
922
- z3.object({
923
- id: z3.string().nullish(),
924
- type: z3.literal("function"),
925
- function: z3.object({
926
- name: z3.string(),
927
- arguments: z3.string()
928
- })
929
- })
930
- ).nullish(),
931
- annotations: z3.array(
932
- z3.object({
933
- type: z3.literal("url_citation"),
934
- start_index: z3.number(),
935
- end_index: z3.number(),
936
- url: z3.string(),
937
- title: z3.string()
938
- })
939
- ).nullish()
940
- }),
941
- index: z3.number(),
942
- logprobs: z3.object({
943
- content: z3.array(
944
- z3.object({
945
- token: z3.string(),
946
- logprob: z3.number(),
947
- top_logprobs: z3.array(
948
- z3.object({
949
- token: z3.string(),
950
- logprob: z3.number()
951
- })
952
- )
953
- })
954
- ).nullish()
955
- }).nullish(),
956
- finish_reason: z3.string().nullish()
957
- })
958
- ),
959
- usage: openaiTokenUsageSchema
960
- });
961
- var openaiChatChunkSchema = z3.union([
962
- z3.object({
963
- id: z3.string().nullish(),
964
- created: z3.number().nullish(),
965
- model: z3.string().nullish(),
966
- choices: z3.array(
967
- z3.object({
968
- delta: z3.object({
969
- role: z3.enum(["assistant"]).nullish(),
970
- content: z3.string().nullish(),
971
- tool_calls: z3.array(
972
- z3.object({
973
- index: z3.number(),
974
- id: z3.string().nullish(),
975
- type: z3.literal("function").nullish(),
976
- function: z3.object({
977
- name: z3.string().nullish(),
978
- arguments: z3.string().nullish()
979
- })
980
- })
981
- ).nullish(),
982
- annotations: z3.array(
983
- z3.object({
984
- type: z3.literal("url_citation"),
985
- start_index: z3.number(),
986
- end_index: z3.number(),
987
- url: z3.string(),
988
- title: z3.string()
989
- })
990
- ).nullish()
991
- }).nullish(),
992
- logprobs: z3.object({
993
- content: z3.array(
994
- z3.object({
995
- token: z3.string(),
996
- logprob: z3.number(),
997
- top_logprobs: z3.array(
998
- z3.object({
999
- token: z3.string(),
1000
- logprob: z3.number()
1001
- })
1002
- )
1003
- })
1004
- ).nullish()
1005
- }).nullish(),
1006
- finish_reason: z3.string().nullish(),
1007
- index: z3.number()
1008
- })
1009
- ),
1010
- usage: openaiTokenUsageSchema
1011
- }),
1012
- openaiErrorDataSchema
1013
- ]);
1014
1051
  function isReasoningModel(modelId) {
1015
1052
  return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
1016
1053
  }
@@ -1068,7 +1105,6 @@ import {
1068
1105
  parseProviderOptions as parseProviderOptions2,
1069
1106
  postJsonToApi as postJsonToApi2
1070
1107
  } from "@ai-sdk/provider-utils";
1071
- import { z as z5 } from "zod/v4";
1072
1108
 
1073
1109
  // src/completion/convert-to-openai-completion-prompt.ts
1074
1110
  import {
@@ -1178,48 +1214,117 @@ function mapOpenAIFinishReason2(finishReason) {
1178
1214
  }
1179
1215
  }
1180
1216
 
1217
+ // src/completion/openai-completion-api.ts
1218
+ import * as z4 from "zod/v4";
1219
+ import {
1220
+ lazyValidator as lazyValidator3,
1221
+ zodSchema as zodSchema3
1222
+ } from "@ai-sdk/provider-utils";
1223
+ var openaiCompletionResponseSchema = lazyValidator3(
1224
+ () => zodSchema3(
1225
+ z4.object({
1226
+ id: z4.string().nullish(),
1227
+ created: z4.number().nullish(),
1228
+ model: z4.string().nullish(),
1229
+ choices: z4.array(
1230
+ z4.object({
1231
+ text: z4.string(),
1232
+ finish_reason: z4.string(),
1233
+ logprobs: z4.object({
1234
+ tokens: z4.array(z4.string()),
1235
+ token_logprobs: z4.array(z4.number()),
1236
+ top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
1237
+ }).nullish()
1238
+ })
1239
+ ),
1240
+ usage: z4.object({
1241
+ prompt_tokens: z4.number(),
1242
+ completion_tokens: z4.number(),
1243
+ total_tokens: z4.number()
1244
+ }).nullish()
1245
+ })
1246
+ )
1247
+ );
1248
+ var openaiCompletionChunkSchema = lazyValidator3(
1249
+ () => zodSchema3(
1250
+ z4.union([
1251
+ z4.object({
1252
+ id: z4.string().nullish(),
1253
+ created: z4.number().nullish(),
1254
+ model: z4.string().nullish(),
1255
+ choices: z4.array(
1256
+ z4.object({
1257
+ text: z4.string(),
1258
+ finish_reason: z4.string().nullish(),
1259
+ index: z4.number(),
1260
+ logprobs: z4.object({
1261
+ tokens: z4.array(z4.string()),
1262
+ token_logprobs: z4.array(z4.number()),
1263
+ top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
1264
+ }).nullish()
1265
+ })
1266
+ ),
1267
+ usage: z4.object({
1268
+ prompt_tokens: z4.number(),
1269
+ completion_tokens: z4.number(),
1270
+ total_tokens: z4.number()
1271
+ }).nullish()
1272
+ }),
1273
+ openaiErrorDataSchema
1274
+ ])
1275
+ )
1276
+ );
1277
+
1181
1278
  // src/completion/openai-completion-options.ts
1182
- import { z as z4 } from "zod/v4";
1183
- var openaiCompletionProviderOptions = z4.object({
1184
- /**
1185
- Echo back the prompt in addition to the completion.
1186
- */
1187
- echo: z4.boolean().optional(),
1188
- /**
1189
- Modify the likelihood of specified tokens appearing in the completion.
1190
-
1191
- Accepts a JSON object that maps tokens (specified by their token ID in
1192
- the GPT tokenizer) to an associated bias value from -100 to 100. You
1193
- can use this tokenizer tool to convert text to token IDs. Mathematically,
1194
- the bias is added to the logits generated by the model prior to sampling.
1195
- The exact effect will vary per model, but values between -1 and 1 should
1196
- decrease or increase likelihood of selection; values like -100 or 100
1197
- should result in a ban or exclusive selection of the relevant token.
1198
-
1199
- As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
1200
- token from being generated.
1201
- */
1202
- logitBias: z4.record(z4.string(), z4.number()).optional(),
1203
- /**
1204
- The suffix that comes after a completion of inserted text.
1205
- */
1206
- suffix: z4.string().optional(),
1207
- /**
1208
- A unique identifier representing your end-user, which can help OpenAI to
1209
- monitor and detect abuse. Learn more.
1210
- */
1211
- user: z4.string().optional(),
1212
- /**
1213
- Return the log probabilities of the tokens. Including logprobs will increase
1214
- the response size and can slow down response times. However, it can
1215
- be useful to better understand how the model is behaving.
1216
- Setting to true will return the log probabilities of the tokens that
1217
- were generated.
1218
- Setting to a number will return the log probabilities of the top n
1219
- tokens that were generated.
1220
- */
1221
- logprobs: z4.union([z4.boolean(), z4.number()]).optional()
1222
- });
1279
+ import {
1280
+ lazyValidator as lazyValidator4,
1281
+ zodSchema as zodSchema4
1282
+ } from "@ai-sdk/provider-utils";
1283
+ import * as z5 from "zod/v4";
1284
+ var openaiCompletionProviderOptions = lazyValidator4(
1285
+ () => zodSchema4(
1286
+ z5.object({
1287
+ /**
1288
+ Echo back the prompt in addition to the completion.
1289
+ */
1290
+ echo: z5.boolean().optional(),
1291
+ /**
1292
+ Modify the likelihood of specified tokens appearing in the completion.
1293
+
1294
+ Accepts a JSON object that maps tokens (specified by their token ID in
1295
+ the GPT tokenizer) to an associated bias value from -100 to 100. You
1296
+ can use this tokenizer tool to convert text to token IDs. Mathematically,
1297
+ the bias is added to the logits generated by the model prior to sampling.
1298
+ The exact effect will vary per model, but values between -1 and 1 should
1299
+ decrease or increase likelihood of selection; values like -100 or 100
1300
+ should result in a ban or exclusive selection of the relevant token.
1301
+
1302
+ As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
1303
+ token from being generated.
1304
+ */
1305
+ logitBias: z5.record(z5.string(), z5.number()).optional(),
1306
+ /**
1307
+ The suffix that comes after a completion of inserted text.
1308
+ */
1309
+ suffix: z5.string().optional(),
1310
+ /**
1311
+ A unique identifier representing your end-user, which can help OpenAI to
1312
+ monitor and detect abuse. Learn more.
1313
+ */
1314
+ user: z5.string().optional(),
1315
+ /**
1316
+ Return the log probabilities of the tokens. Including logprobs will increase
1317
+ the response size and can slow down response times. However, it can
1318
+ be useful to better understand how the model is behaving.
1319
+ Setting to true will return the log probabilities of the tokens that
1320
+ were generated.
1321
+ Setting to a number will return the log probabilities of the top n
1322
+ tokens that were generated.
1323
+ */
1324
+ logprobs: z5.union([z5.boolean(), z5.number()]).optional()
1325
+ })
1326
+ )
1327
+ );
1223
1328
 
1224
1329
  // src/completion/openai-completion-language-model.ts
1225
1330
  var OpenAICompletionLanguageModel = class {
@@ -1450,49 +1555,6 @@ var OpenAICompletionLanguageModel = class {
1450
1555
  };
1451
1556
  }
1452
1557
  };
1453
- var usageSchema = z5.object({
1454
- prompt_tokens: z5.number(),
1455
- completion_tokens: z5.number(),
1456
- total_tokens: z5.number()
1457
- });
1458
- var openaiCompletionResponseSchema = z5.object({
1459
- id: z5.string().nullish(),
1460
- created: z5.number().nullish(),
1461
- model: z5.string().nullish(),
1462
- choices: z5.array(
1463
- z5.object({
1464
- text: z5.string(),
1465
- finish_reason: z5.string(),
1466
- logprobs: z5.object({
1467
- tokens: z5.array(z5.string()),
1468
- token_logprobs: z5.array(z5.number()),
1469
- top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
1470
- }).nullish()
1471
- })
1472
- ),
1473
- usage: usageSchema.nullish()
1474
- });
1475
- var openaiCompletionChunkSchema = z5.union([
1476
- z5.object({
1477
- id: z5.string().nullish(),
1478
- created: z5.number().nullish(),
1479
- model: z5.string().nullish(),
1480
- choices: z5.array(
1481
- z5.object({
1482
- text: z5.string(),
1483
- finish_reason: z5.string().nullish(),
1484
- index: z5.number(),
1485
- logprobs: z5.object({
1486
- tokens: z5.array(z5.string()),
1487
- token_logprobs: z5.array(z5.number()),
1488
- top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
1489
- }).nullish()
1490
- })
1491
- ),
1492
- usage: usageSchema.nullish()
1493
- }),
1494
- openaiErrorDataSchema
1495
- ]);
1496
1558
 
1497
1559
  // src/embedding/openai-embedding-model.ts
1498
1560
  import {
@@ -1504,22 +1566,41 @@ import {
1504
1566
  parseProviderOptions as parseProviderOptions3,
1505
1567
  postJsonToApi as postJsonToApi3
1506
1568
  } from "@ai-sdk/provider-utils";
1507
- import { z as z7 } from "zod/v4";
1508
1569
 
1509
1570
  // src/embedding/openai-embedding-options.ts
1510
- import { z as z6 } from "zod/v4";
1511
- var openaiEmbeddingProviderOptions = z6.object({
1512
- /**
1513
- The number of dimensions the resulting output embeddings should have.
1514
- Only supported in text-embedding-3 and later models.
1515
- */
1516
- dimensions: z6.number().optional(),
1517
- /**
1518
- A unique identifier representing your end-user, which can help OpenAI to
1519
- monitor and detect abuse. Learn more.
1520
- */
1521
- user: z6.string().optional()
1522
- });
1571
+ import {
1572
+ lazyValidator as lazyValidator5,
1573
+ zodSchema as zodSchema5
1574
+ } from "@ai-sdk/provider-utils";
1575
+ import * as z6 from "zod/v4";
1576
+ var openaiEmbeddingProviderOptions = lazyValidator5(
1577
+ () => zodSchema5(
1578
+ z6.object({
1579
+ /**
1580
+ The number of dimensions the resulting output embeddings should have.
1581
+ Only supported in text-embedding-3 and later models.
1582
+ */
1583
+ dimensions: z6.number().optional(),
1584
+ /**
1585
+ A unique identifier representing your end-user, which can help OpenAI to
1586
+ monitor and detect abuse. Learn more.
1587
+ */
1588
+ user: z6.string().optional()
1589
+ })
1590
+ )
1591
+ );
1592
+
1593
+ // src/embedding/openai-embedding-api.ts
1594
+ import { lazyValidator as lazyValidator6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
1595
+ import * as z7 from "zod/v4";
1596
+ var openaiTextEmbeddingResponseSchema = lazyValidator6(
1597
+ () => zodSchema6(
1598
+ z7.object({
1599
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1600
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1601
+ })
1602
+ )
1603
+ );
1523
1604
 
1524
1605
  // src/embedding/openai-embedding-model.ts
1525
1606
  var OpenAIEmbeddingModel = class {
@@ -1584,10 +1665,6 @@ var OpenAIEmbeddingModel = class {
1584
1665
  };
1585
1666
  }
1586
1667
  };
1587
- var openaiTextEmbeddingResponseSchema = z7.object({
1588
- data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1589
- usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1590
- });
1591
1668
 
1592
1669
  // src/image/openai-image-model.ts
1593
1670
  import {
@@ -1595,15 +1672,34 @@ import {
1595
1672
  createJsonResponseHandler as createJsonResponseHandler4,
1596
1673
  postJsonToApi as postJsonToApi4
1597
1674
  } from "@ai-sdk/provider-utils";
1598
- import { z as z8 } from "zod/v4";
1675
+
1676
+ // src/image/openai-image-api.ts
1677
+ import { lazyValidator as lazyValidator7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1678
+ import * as z8 from "zod/v4";
1679
+ var openaiImageResponseSchema = lazyValidator7(
1680
+ () => zodSchema7(
1681
+ z8.object({
1682
+ data: z8.array(
1683
+ z8.object({
1684
+ b64_json: z8.string(),
1685
+ revised_prompt: z8.string().optional()
1686
+ })
1687
+ )
1688
+ })
1689
+ )
1690
+ );
1599
1691
 
1600
1692
  // src/image/openai-image-options.ts
1601
1693
  var modelMaxImagesPerCall = {
1602
1694
  "dall-e-3": 1,
1603
1695
  "dall-e-2": 10,
1604
- "gpt-image-1": 10
1696
+ "gpt-image-1": 10,
1697
+ "gpt-image-1-mini": 10
1605
1698
  };
1606
- var hasDefaultResponseFormat = /* @__PURE__ */ new Set(["gpt-image-1"]);
1699
+ var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
1700
+ "gpt-image-1",
1701
+ "gpt-image-1-mini"
1702
+ ]);
1607
1703
 
1608
1704
  // src/image/openai-image-model.ts
1609
1705
  var OpenAIImageModel = class {
@@ -1683,35 +1779,46 @@ var OpenAIImageModel = class {
1683
1779
  };
1684
1780
  }
1685
1781
  };
1686
- var openaiImageResponseSchema = z8.object({
1687
- data: z8.array(
1688
- z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
1689
- )
1690
- });
1691
1782
 
1692
1783
  // src/tool/code-interpreter.ts
1693
- import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
1694
- import { z as z9 } from "zod/v4";
1695
- var codeInterpreterInputSchema = z9.object({
1696
- code: z9.string().nullish(),
1697
- containerId: z9.string()
1698
- });
1699
- var codeInterpreterOutputSchema = z9.object({
1700
- outputs: z9.array(
1701
- z9.discriminatedUnion("type", [
1702
- z9.object({ type: z9.literal("logs"), logs: z9.string() }),
1703
- z9.object({ type: z9.literal("image"), url: z9.string() })
1704
- ])
1705
- ).nullish()
1706
- });
1707
- var codeInterpreterArgsSchema = z9.object({
1708
- container: z9.union([
1709
- z9.string(),
1784
+ import {
1785
+ createProviderDefinedToolFactoryWithOutputSchema,
1786
+ lazySchema,
1787
+ zodSchema as zodSchema8
1788
+ } from "@ai-sdk/provider-utils";
1789
+ import * as z9 from "zod/v4";
1790
+ var codeInterpreterInputSchema = lazySchema(
1791
+ () => zodSchema8(
1710
1792
  z9.object({
1711
- fileIds: z9.array(z9.string()).optional()
1793
+ code: z9.string().nullish(),
1794
+ containerId: z9.string()
1712
1795
  })
1713
- ]).optional()
1714
- });
1796
+ )
1797
+ );
1798
+ var codeInterpreterOutputSchema = lazySchema(
1799
+ () => zodSchema8(
1800
+ z9.object({
1801
+ outputs: z9.array(
1802
+ z9.discriminatedUnion("type", [
1803
+ z9.object({ type: z9.literal("logs"), logs: z9.string() }),
1804
+ z9.object({ type: z9.literal("image"), url: z9.string() })
1805
+ ])
1806
+ ).nullish()
1807
+ })
1808
+ )
1809
+ );
1810
+ var codeInterpreterArgsSchema = lazySchema(
1811
+ () => zodSchema8(
1812
+ z9.object({
1813
+ container: z9.union([
1814
+ z9.string(),
1815
+ z9.object({
1816
+ fileIds: z9.array(z9.string()).optional()
1817
+ })
1818
+ ]).optional()
1819
+ })
1820
+ )
1821
+ );
1715
1822
  var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
1716
1823
  id: "openai.code_interpreter",
1717
1824
  name: "code_interpreter",
@@ -1723,8 +1830,12 @@ var codeInterpreter = (args = {}) => {
1723
1830
  };
1724
1831
 
1725
1832
  // src/tool/file-search.ts
1726
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
1727
- import { z as z10 } from "zod/v4";
1833
+ import {
1834
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
1835
+ lazySchema as lazySchema2,
1836
+ zodSchema as zodSchema9
1837
+ } from "@ai-sdk/provider-utils";
1838
+ import * as z10 from "zod/v4";
1728
1839
  var comparisonFilterSchema = z10.object({
1729
1840
  key: z10.string(),
1730
1841
  type: z10.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
@@ -1736,27 +1847,35 @@ var compoundFilterSchema = z10.object({
1736
1847
  z10.union([comparisonFilterSchema, z10.lazy(() => compoundFilterSchema)])
1737
1848
  )
1738
1849
  });
1739
- var fileSearchArgsSchema = z10.object({
1740
- vectorStoreIds: z10.array(z10.string()),
1741
- maxNumResults: z10.number().optional(),
1742
- ranking: z10.object({
1743
- ranker: z10.string().optional(),
1744
- scoreThreshold: z10.number().optional()
1745
- }).optional(),
1746
- filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1747
- });
1748
- var fileSearchOutputSchema = z10.object({
1749
- queries: z10.array(z10.string()),
1750
- results: z10.array(
1850
+ var fileSearchArgsSchema = lazySchema2(
1851
+ () => zodSchema9(
1751
1852
  z10.object({
1752
- attributes: z10.record(z10.string(), z10.unknown()),
1753
- fileId: z10.string(),
1754
- filename: z10.string(),
1755
- score: z10.number(),
1756
- text: z10.string()
1853
+ vectorStoreIds: z10.array(z10.string()),
1854
+ maxNumResults: z10.number().optional(),
1855
+ ranking: z10.object({
1856
+ ranker: z10.string().optional(),
1857
+ scoreThreshold: z10.number().optional()
1858
+ }).optional(),
1859
+ filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1757
1860
  })
1758
- ).nullable()
1759
- });
1861
+ )
1862
+ );
1863
+ var fileSearchOutputSchema = lazySchema2(
1864
+ () => zodSchema9(
1865
+ z10.object({
1866
+ queries: z10.array(z10.string()),
1867
+ results: z10.array(
1868
+ z10.object({
1869
+ attributes: z10.record(z10.string(), z10.unknown()),
1870
+ fileId: z10.string(),
1871
+ filename: z10.string(),
1872
+ score: z10.number(),
1873
+ text: z10.string()
1874
+ })
1875
+ ).nullable()
1876
+ })
1877
+ )
1878
+ );
1760
1879
  var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
1761
1880
  id: "openai.file_search",
1762
1881
  name: "file_search",
@@ -1765,29 +1884,39 @@ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
1765
1884
  });
1766
1885
 
1767
1886
  // src/tool/image-generation.ts
1768
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
1769
- import { z as z11 } from "zod/v4";
1770
- var imageGenerationArgsSchema = z11.object({
1771
- background: z11.enum(["auto", "opaque", "transparent"]).optional(),
1772
- inputFidelity: z11.enum(["low", "high"]).optional(),
1773
- inputImageMask: z11.object({
1774
- fileId: z11.string().optional(),
1775
- imageUrl: z11.string().optional()
1776
- }).optional(),
1777
- model: z11.string().optional(),
1778
- moderation: z11.enum(["auto"]).optional(),
1779
- outputCompression: z11.number().int().min(0).max(100).optional(),
1780
- outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
1781
- quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
1782
- size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1783
- }).strict();
1784
- var imageGenerationOutputSchema = z11.object({
1785
- result: z11.string()
1786
- });
1887
+ import {
1888
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
1889
+ lazySchema as lazySchema3,
1890
+ zodSchema as zodSchema10
1891
+ } from "@ai-sdk/provider-utils";
1892
+ import * as z11 from "zod/v4";
1893
+ var imageGenerationArgsSchema = lazySchema3(
1894
+ () => zodSchema10(
1895
+ z11.object({
1896
+ background: z11.enum(["auto", "opaque", "transparent"]).optional(),
1897
+ inputFidelity: z11.enum(["low", "high"]).optional(),
1898
+ inputImageMask: z11.object({
1899
+ fileId: z11.string().optional(),
1900
+ imageUrl: z11.string().optional()
1901
+ }).optional(),
1902
+ model: z11.string().optional(),
1903
+ moderation: z11.enum(["auto"]).optional(),
1904
+ outputCompression: z11.number().int().min(0).max(100).optional(),
1905
+ outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
1906
+ partialImages: z11.number().int().min(0).max(3).optional(),
1907
+ quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
1908
+ size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1909
+ }).strict()
1910
+ )
1911
+ );
1912
+ var imageGenerationInputSchema = lazySchema3(() => zodSchema10(z11.object({})));
1913
+ var imageGenerationOutputSchema = lazySchema3(
1914
+ () => zodSchema10(z11.object({ result: z11.string() }))
1915
+ );
1787
1916
  var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
1788
1917
  id: "openai.image_generation",
1789
1918
  name: "image_generation",
1790
- inputSchema: z11.object({}),
1919
+ inputSchema: imageGenerationInputSchema,
1791
1920
  outputSchema: imageGenerationOutputSchema
1792
1921
  });
1793
1922
  var imageGeneration = (args = {}) => {
@@ -1795,21 +1924,29 @@ var imageGeneration = (args = {}) => {
1795
1924
  };
1796
1925
 
1797
1926
  // src/tool/local-shell.ts
1798
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4 } from "@ai-sdk/provider-utils";
1799
- import { z as z12 } from "zod/v4";
1800
- var localShellInputSchema = z12.object({
1801
- action: z12.object({
1802
- type: z12.literal("exec"),
1803
- command: z12.array(z12.string()),
1804
- timeoutMs: z12.number().optional(),
1805
- user: z12.string().optional(),
1806
- workingDirectory: z12.string().optional(),
1807
- env: z12.record(z12.string(), z12.string()).optional()
1808
- })
1809
- });
1810
- var localShellOutputSchema = z12.object({
1811
- output: z12.string()
1812
- });
1927
+ import {
1928
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
1929
+ lazySchema as lazySchema4,
1930
+ zodSchema as zodSchema11
1931
+ } from "@ai-sdk/provider-utils";
1932
+ import * as z12 from "zod/v4";
1933
+ var localShellInputSchema = lazySchema4(
1934
+ () => zodSchema11(
1935
+ z12.object({
1936
+ action: z12.object({
1937
+ type: z12.literal("exec"),
1938
+ command: z12.array(z12.string()),
1939
+ timeoutMs: z12.number().optional(),
1940
+ user: z12.string().optional(),
1941
+ workingDirectory: z12.string().optional(),
1942
+ env: z12.record(z12.string(), z12.string()).optional()
1943
+ })
1944
+ })
1945
+ )
1946
+ );
1947
+ var localShellOutputSchema = lazySchema4(
1948
+ () => zodSchema11(z12.object({ output: z12.string() }))
1949
+ );
1813
1950
  var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
1814
1951
  id: "openai.local_shell",
1815
1952
  name: "local_shell",
@@ -1818,103 +1955,129 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
1818
1955
  });
1819
1956
 
1820
1957
  // src/tool/web-search.ts
1821
- import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
1822
- import { z as z13 } from "zod/v4";
1823
- var webSearchArgsSchema = z13.object({
1824
- filters: z13.object({
1825
- allowedDomains: z13.array(z13.string()).optional()
1826
- }).optional(),
1827
- searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1828
- userLocation: z13.object({
1829
- type: z13.literal("approximate"),
1830
- country: z13.string().optional(),
1831
- city: z13.string().optional(),
1832
- region: z13.string().optional(),
1833
- timezone: z13.string().optional()
1834
- }).optional()
1835
- });
1958
+ import {
1959
+ createProviderDefinedToolFactory,
1960
+ lazySchema as lazySchema5,
1961
+ zodSchema as zodSchema12
1962
+ } from "@ai-sdk/provider-utils";
1963
+ import * as z13 from "zod/v4";
1964
+ var webSearchArgsSchema = lazySchema5(
1965
+ () => zodSchema12(
1966
+ z13.object({
1967
+ filters: z13.object({
1968
+ allowedDomains: z13.array(z13.string()).optional()
1969
+ }).optional(),
1970
+ searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1971
+ userLocation: z13.object({
1972
+ type: z13.literal("approximate"),
1973
+ country: z13.string().optional(),
1974
+ city: z13.string().optional(),
1975
+ region: z13.string().optional(),
1976
+ timezone: z13.string().optional()
1977
+ }).optional()
1978
+ })
1979
+ )
1980
+ );
1981
+ var webSearchInputSchema = lazySchema5(
1982
+ () => zodSchema12(
1983
+ z13.object({
1984
+ action: z13.discriminatedUnion("type", [
1985
+ z13.object({
1986
+ type: z13.literal("search"),
1987
+ query: z13.string().nullish()
1988
+ }),
1989
+ z13.object({
1990
+ type: z13.literal("open_page"),
1991
+ url: z13.string()
1992
+ }),
1993
+ z13.object({
1994
+ type: z13.literal("find"),
1995
+ url: z13.string(),
1996
+ pattern: z13.string()
1997
+ })
1998
+ ]).nullish()
1999
+ })
2000
+ )
2001
+ );
1836
2002
  var webSearchToolFactory = createProviderDefinedToolFactory({
1837
2003
  id: "openai.web_search",
1838
2004
  name: "web_search",
1839
- inputSchema: z13.object({
1840
- action: z13.discriminatedUnion("type", [
1841
- z13.object({
1842
- type: z13.literal("search"),
1843
- query: z13.string().nullish()
1844
- }),
1845
- z13.object({
1846
- type: z13.literal("open_page"),
1847
- url: z13.string()
1848
- }),
1849
- z13.object({
1850
- type: z13.literal("find"),
1851
- url: z13.string(),
1852
- pattern: z13.string()
1853
- })
1854
- ]).nullish()
1855
- })
2005
+ inputSchema: webSearchInputSchema
1856
2006
  });
1857
2007
  var webSearch = (args = {}) => {
1858
2008
  return webSearchToolFactory(args);
1859
2009
  };
1860
2010
 
1861
2011
  // src/tool/web-search-preview.ts
1862
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
1863
- import { z as z14 } from "zod/v4";
1864
- var webSearchPreviewArgsSchema = z14.object({
1865
- /**
1866
- * Search context size to use for the web search.
1867
- * - high: Most comprehensive context, highest cost, slower response
1868
- * - medium: Balanced context, cost, and latency (default)
1869
- * - low: Least context, lowest cost, fastest response
1870
- */
1871
- searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
1872
- /**
1873
- * User location information to provide geographically relevant search results.
1874
- */
1875
- userLocation: z14.object({
1876
- /**
1877
- * Type of location (always 'approximate')
1878
- */
1879
- type: z14.literal("approximate"),
1880
- /**
1881
- * Two-letter ISO country code (e.g., 'US', 'GB')
1882
- */
1883
- country: z14.string().optional(),
1884
- /**
1885
- * City name (free text, e.g., 'Minneapolis')
1886
- */
1887
- city: z14.string().optional(),
1888
- /**
1889
- * Region name (free text, e.g., 'Minnesota')
1890
- */
1891
- region: z14.string().optional(),
1892
- /**
1893
- * IANA timezone (e.g., 'America/Chicago')
1894
- */
1895
- timezone: z14.string().optional()
1896
- }).optional()
1897
- });
2012
+ import {
2013
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
2014
+ lazySchema as lazySchema6,
2015
+ zodSchema as zodSchema13
2016
+ } from "@ai-sdk/provider-utils";
2017
+ import * as z14 from "zod/v4";
2018
+ var webSearchPreviewArgsSchema = lazySchema6(
2019
+ () => zodSchema13(
2020
+ z14.object({
2021
+ /**
2022
+ * Search context size to use for the web search.
2023
+ * - high: Most comprehensive context, highest cost, slower response
2024
+ * - medium: Balanced context, cost, and latency (default)
2025
+ * - low: Least context, lowest cost, fastest response
2026
+ */
2027
+ searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
2028
+ /**
2029
+ * User location information to provide geographically relevant search results.
2030
+ */
2031
+ userLocation: z14.object({
2032
+ /**
2033
+ * Type of location (always 'approximate')
2034
+ */
2035
+ type: z14.literal("approximate"),
2036
+ /**
2037
+ * Two-letter ISO country code (e.g., 'US', 'GB')
2038
+ */
2039
+ country: z14.string().optional(),
2040
+ /**
2041
+ * City name (free text, e.g., 'Minneapolis')
2042
+ */
2043
+ city: z14.string().optional(),
2044
+ /**
2045
+ * Region name (free text, e.g., 'Minnesota')
2046
+ */
2047
+ region: z14.string().optional(),
2048
+ /**
2049
+ * IANA timezone (e.g., 'America/Chicago')
2050
+ */
2051
+ timezone: z14.string().optional()
2052
+ }).optional()
2053
+ })
2054
+ )
2055
+ );
2056
+ var webSearchPreviewInputSchema = lazySchema6(
2057
+ () => zodSchema13(
2058
+ z14.object({
2059
+ action: z14.discriminatedUnion("type", [
2060
+ z14.object({
2061
+ type: z14.literal("search"),
2062
+ query: z14.string().nullish()
2063
+ }),
2064
+ z14.object({
2065
+ type: z14.literal("open_page"),
2066
+ url: z14.string()
2067
+ }),
2068
+ z14.object({
2069
+ type: z14.literal("find"),
2070
+ url: z14.string(),
2071
+ pattern: z14.string()
2072
+ })
2073
+ ]).nullish()
2074
+ })
2075
+ )
2076
+ );
1898
2077
  var webSearchPreview = createProviderDefinedToolFactory2({
1899
2078
  id: "openai.web_search_preview",
1900
2079
  name: "web_search_preview",
1901
- inputSchema: z14.object({
1902
- action: z14.discriminatedUnion("type", [
1903
- z14.object({
1904
- type: z14.literal("search"),
1905
- query: z14.string().nullish()
1906
- }),
1907
- z14.object({
1908
- type: z14.literal("open_page"),
1909
- url: z14.string()
1910
- }),
1911
- z14.object({
1912
- type: z14.literal("find"),
1913
- url: z14.string(),
1914
- pattern: z14.string()
1915
- })
1916
- ]).nullish()
1917
- })
2080
+ inputSchema: webSearchPreviewInputSchema
1918
2081
  });
1919
2082
 
1920
2083
  // src/openai-tools.ts
@@ -1949,11 +2112,16 @@ var openaiTools = {
1949
2112
  *
1950
2113
  * Must have name `image_generation`.
1951
2114
  *
1952
- * @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
1953
- * @param quality - Rendering quality (e.g. low, medium, high)
1954
- * @param format - File output format
1955
- * @param compression - Compression level (0-100%) for JPEG and WebP formats
1956
- * @param background - Transparent or opaque
2115
+ * @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
2116
+ * @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
2117
+ * @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
2118
+ * @param model - The image generation model to use. Default: gpt-image-1.
2119
+ * @param moderation - Moderation level for the generated image. Default: 'auto'.
2120
+ * @param outputCompression - Compression level for the output image (0-100).
2121
+ * @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
2122
+ * @param partialImages - Number of partial images to generate in streaming mode (0-3).
2123
+ * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
2124
+ * @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
1957
2125
  */
1958
2126
  imageGeneration,
1959
2127
  /**
@@ -2002,14 +2170,17 @@ import {
2002
2170
  parseProviderOptions as parseProviderOptions5,
2003
2171
  postJsonToApi as postJsonToApi5
2004
2172
  } from "@ai-sdk/provider-utils";
2005
- import { z as z16 } from "zod/v4";
2006
2173
 
2007
2174
  // src/responses/convert-to-openai-responses-input.ts
2008
2175
  import {
2009
2176
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2010
2177
  } from "@ai-sdk/provider";
2011
- import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
2012
- import { z as z15 } from "zod/v4";
2178
+ import {
2179
+ convertToBase64 as convertToBase642,
2180
+ parseProviderOptions as parseProviderOptions4,
2181
+ validateTypes
2182
+ } from "@ai-sdk/provider-utils";
2183
+ import * as z15 from "zod/v4";
2013
2184
  function isFileId(data, prefixes) {
2014
2185
  if (!prefixes) return false;
2015
2186
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2021,7 +2192,7 @@ async function convertToOpenAIResponsesInput({
2021
2192
  store,
2022
2193
  hasLocalShellTool = false
2023
2194
  }) {
2024
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2195
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2025
2196
  const input = [];
2026
2197
  const warnings = [];
2027
2198
  for (const { role, content } of prompt) {
@@ -2115,7 +2286,10 @@ async function convertToOpenAIResponsesInput({
2115
2286
  break;
2116
2287
  }
2117
2288
  if (hasLocalShellTool && part.toolName === "local_shell") {
2118
- const parsedInput = localShellInputSchema.parse(part.input);
2289
+ const parsedInput = await validateTypes({
2290
+ value: part.input,
2291
+ schema: localShellInputSchema
2292
+ });
2119
2293
  input.push({
2120
2294
  type: "local_shell_call",
2121
2295
  call_id: part.toolCallId,
@@ -2211,10 +2385,14 @@ async function convertToOpenAIResponsesInput({
2211
2385
  for (const part of content) {
2212
2386
  const output = part.output;
2213
2387
  if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2388
+ const parsedOutput = await validateTypes({
2389
+ value: output.value,
2390
+ schema: localShellOutputSchema
2391
+ });
2214
2392
  input.push({
2215
2393
  type: "local_shell_call_output",
2216
2394
  call_id: part.toolCallId,
2217
- output: localShellOutputSchema.parse(output.value).output
2395
+ output: parsedOutput.output
2218
2396
  });
2219
2397
  break;
2220
2398
  }
@@ -2224,6 +2402,9 @@ async function convertToOpenAIResponsesInput({
2224
2402
  case "error-text":
2225
2403
  contentValue = output.value;
2226
2404
  break;
2405
+ case "execution-denied":
2406
+ contentValue = (_j = output.reason) != null ? _j : "Tool execution denied.";
2407
+ break;
2227
2408
  case "content":
2228
2409
  case "json":
2229
2410
  case "error-json":
@@ -2269,11 +2450,547 @@ function mapOpenAIResponseFinishReason({
2269
2450
  }
2270
2451
  }
2271
2452
 
2453
+ // src/responses/openai-responses-api.ts
2454
+ import {
2455
+ lazyValidator as lazyValidator8,
2456
+ zodSchema as zodSchema14
2457
+ } from "@ai-sdk/provider-utils";
2458
+ import * as z16 from "zod/v4";
2459
+ var openaiResponsesChunkSchema = lazyValidator8(
2460
+ () => zodSchema14(
2461
+ z16.union([
2462
+ z16.object({
2463
+ type: z16.literal("response.output_text.delta"),
2464
+ item_id: z16.string(),
2465
+ delta: z16.string(),
2466
+ logprobs: z16.array(
2467
+ z16.object({
2468
+ token: z16.string(),
2469
+ logprob: z16.number(),
2470
+ top_logprobs: z16.array(
2471
+ z16.object({
2472
+ token: z16.string(),
2473
+ logprob: z16.number()
2474
+ })
2475
+ )
2476
+ })
2477
+ ).nullish()
2478
+ }),
2479
+ z16.object({
2480
+ type: z16.enum(["response.completed", "response.incomplete"]),
2481
+ response: z16.object({
2482
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2483
+ usage: z16.object({
2484
+ input_tokens: z16.number(),
2485
+ input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
2486
+ output_tokens: z16.number(),
2487
+ output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
2488
+ }),
2489
+ service_tier: z16.string().nullish()
2490
+ })
2491
+ }),
2492
+ z16.object({
2493
+ type: z16.literal("response.created"),
2494
+ response: z16.object({
2495
+ id: z16.string(),
2496
+ created_at: z16.number(),
2497
+ model: z16.string(),
2498
+ service_tier: z16.string().nullish()
2499
+ })
2500
+ }),
2501
+ z16.object({
2502
+ type: z16.literal("response.output_item.added"),
2503
+ output_index: z16.number(),
2504
+ item: z16.discriminatedUnion("type", [
2505
+ z16.object({
2506
+ type: z16.literal("message"),
2507
+ id: z16.string()
2508
+ }),
2509
+ z16.object({
2510
+ type: z16.literal("reasoning"),
2511
+ id: z16.string(),
2512
+ encrypted_content: z16.string().nullish()
2513
+ }),
2514
+ z16.object({
2515
+ type: z16.literal("function_call"),
2516
+ id: z16.string(),
2517
+ call_id: z16.string(),
2518
+ name: z16.string(),
2519
+ arguments: z16.string()
2520
+ }),
2521
+ z16.object({
2522
+ type: z16.literal("web_search_call"),
2523
+ id: z16.string(),
2524
+ status: z16.string(),
2525
+ action: z16.object({
2526
+ type: z16.literal("search"),
2527
+ query: z16.string().optional()
2528
+ }).nullish()
2529
+ }),
2530
+ z16.object({
2531
+ type: z16.literal("computer_call"),
2532
+ id: z16.string(),
2533
+ status: z16.string()
2534
+ }),
2535
+ z16.object({
2536
+ type: z16.literal("file_search_call"),
2537
+ id: z16.string()
2538
+ }),
2539
+ z16.object({
2540
+ type: z16.literal("image_generation_call"),
2541
+ id: z16.string()
2542
+ }),
2543
+ z16.object({
2544
+ type: z16.literal("code_interpreter_call"),
2545
+ id: z16.string(),
2546
+ container_id: z16.string(),
2547
+ code: z16.string().nullable(),
2548
+ outputs: z16.array(
2549
+ z16.discriminatedUnion("type", [
2550
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2551
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2552
+ ])
2553
+ ).nullable(),
2554
+ status: z16.string()
2555
+ })
2556
+ ])
2557
+ }),
2558
+ z16.object({
2559
+ type: z16.literal("response.output_item.done"),
2560
+ output_index: z16.number(),
2561
+ item: z16.discriminatedUnion("type", [
2562
+ z16.object({
2563
+ type: z16.literal("message"),
2564
+ id: z16.string()
2565
+ }),
2566
+ z16.object({
2567
+ type: z16.literal("reasoning"),
2568
+ id: z16.string(),
2569
+ encrypted_content: z16.string().nullish()
2570
+ }),
2571
+ z16.object({
2572
+ type: z16.literal("function_call"),
2573
+ id: z16.string(),
2574
+ call_id: z16.string(),
2575
+ name: z16.string(),
2576
+ arguments: z16.string(),
2577
+ status: z16.literal("completed")
2578
+ }),
2579
+ z16.object({
2580
+ type: z16.literal("code_interpreter_call"),
2581
+ id: z16.string(),
2582
+ code: z16.string().nullable(),
2583
+ container_id: z16.string(),
2584
+ outputs: z16.array(
2585
+ z16.discriminatedUnion("type", [
2586
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2587
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2588
+ ])
2589
+ ).nullable()
2590
+ }),
2591
+ z16.object({
2592
+ type: z16.literal("image_generation_call"),
2593
+ id: z16.string(),
2594
+ result: z16.string()
2595
+ }),
2596
+ z16.object({
2597
+ type: z16.literal("web_search_call"),
2598
+ id: z16.string(),
2599
+ status: z16.string(),
2600
+ action: z16.discriminatedUnion("type", [
2601
+ z16.object({
2602
+ type: z16.literal("search"),
2603
+ query: z16.string().nullish()
2604
+ }),
2605
+ z16.object({
2606
+ type: z16.literal("open_page"),
2607
+ url: z16.string()
2608
+ }),
2609
+ z16.object({
2610
+ type: z16.literal("find"),
2611
+ url: z16.string(),
2612
+ pattern: z16.string()
2613
+ })
2614
+ ]).nullish()
2615
+ }),
2616
+ z16.object({
2617
+ type: z16.literal("file_search_call"),
2618
+ id: z16.string(),
2619
+ queries: z16.array(z16.string()),
2620
+ results: z16.array(
2621
+ z16.object({
2622
+ attributes: z16.record(z16.string(), z16.unknown()),
2623
+ file_id: z16.string(),
2624
+ filename: z16.string(),
2625
+ score: z16.number(),
2626
+ text: z16.string()
2627
+ })
2628
+ ).nullish()
2629
+ }),
2630
+ z16.object({
2631
+ type: z16.literal("local_shell_call"),
2632
+ id: z16.string(),
2633
+ call_id: z16.string(),
2634
+ action: z16.object({
2635
+ type: z16.literal("exec"),
2636
+ command: z16.array(z16.string()),
2637
+ timeout_ms: z16.number().optional(),
2638
+ user: z16.string().optional(),
2639
+ working_directory: z16.string().optional(),
2640
+ env: z16.record(z16.string(), z16.string()).optional()
2641
+ })
2642
+ }),
2643
+ z16.object({
2644
+ type: z16.literal("computer_call"),
2645
+ id: z16.string(),
2646
+ status: z16.literal("completed")
2647
+ })
2648
+ ])
2649
+ }),
2650
+ z16.object({
2651
+ type: z16.literal("response.function_call_arguments.delta"),
2652
+ item_id: z16.string(),
2653
+ output_index: z16.number(),
2654
+ delta: z16.string()
2655
+ }),
2656
+ z16.object({
2657
+ type: z16.literal("response.image_generation_call.partial_image"),
2658
+ item_id: z16.string(),
2659
+ output_index: z16.number(),
2660
+ partial_image_b64: z16.string()
2661
+ }),
2662
+ z16.object({
2663
+ type: z16.literal("response.code_interpreter_call_code.delta"),
2664
+ item_id: z16.string(),
2665
+ output_index: z16.number(),
2666
+ delta: z16.string()
2667
+ }),
2668
+ z16.object({
2669
+ type: z16.literal("response.code_interpreter_call_code.done"),
2670
+ item_id: z16.string(),
2671
+ output_index: z16.number(),
2672
+ code: z16.string()
2673
+ }),
2674
+ z16.object({
2675
+ type: z16.literal("response.output_text.annotation.added"),
2676
+ annotation: z16.discriminatedUnion("type", [
2677
+ z16.object({
2678
+ type: z16.literal("url_citation"),
2679
+ url: z16.string(),
2680
+ title: z16.string()
2681
+ }),
2682
+ z16.object({
2683
+ type: z16.literal("file_citation"),
2684
+ file_id: z16.string(),
2685
+ filename: z16.string().nullish(),
2686
+ index: z16.number().nullish(),
2687
+ start_index: z16.number().nullish(),
2688
+ end_index: z16.number().nullish(),
2689
+ quote: z16.string().nullish()
2690
+ })
2691
+ ])
2692
+ }),
2693
+ z16.object({
2694
+ type: z16.literal("response.reasoning_summary_part.added"),
2695
+ item_id: z16.string(),
2696
+ summary_index: z16.number()
2697
+ }),
2698
+ z16.object({
2699
+ type: z16.literal("response.reasoning_summary_text.delta"),
2700
+ item_id: z16.string(),
2701
+ summary_index: z16.number(),
2702
+ delta: z16.string()
2703
+ }),
2704
+ z16.object({
2705
+ type: z16.literal("error"),
2706
+ code: z16.string(),
2707
+ message: z16.string(),
2708
+ param: z16.string().nullish(),
2709
+ sequence_number: z16.number()
2710
+ }),
2711
+ z16.object({ type: z16.string() }).loose().transform((value) => ({
2712
+ type: "unknown_chunk",
2713
+ message: value.type
2714
+ }))
2715
+ // fallback for unknown chunks
2716
+ ])
2717
+ )
2718
+ );
2719
+ var openaiResponsesResponseSchema = lazyValidator8(
2720
+ () => zodSchema14(
2721
+ z16.object({
2722
+ id: z16.string(),
2723
+ created_at: z16.number(),
2724
+ error: z16.object({
2725
+ code: z16.string(),
2726
+ message: z16.string()
2727
+ }).nullish(),
2728
+ model: z16.string(),
2729
+ output: z16.array(
2730
+ z16.discriminatedUnion("type", [
2731
+ z16.object({
2732
+ type: z16.literal("message"),
2733
+ role: z16.literal("assistant"),
2734
+ id: z16.string(),
2735
+ content: z16.array(
2736
+ z16.object({
2737
+ type: z16.literal("output_text"),
2738
+ text: z16.string(),
2739
+ logprobs: z16.array(
2740
+ z16.object({
2741
+ token: z16.string(),
2742
+ logprob: z16.number(),
2743
+ top_logprobs: z16.array(
2744
+ z16.object({
2745
+ token: z16.string(),
2746
+ logprob: z16.number()
2747
+ })
2748
+ )
2749
+ })
2750
+ ).nullish(),
2751
+ annotations: z16.array(
2752
+ z16.discriminatedUnion("type", [
2753
+ z16.object({
2754
+ type: z16.literal("url_citation"),
2755
+ start_index: z16.number(),
2756
+ end_index: z16.number(),
2757
+ url: z16.string(),
2758
+ title: z16.string()
2759
+ }),
2760
+ z16.object({
2761
+ type: z16.literal("file_citation"),
2762
+ file_id: z16.string(),
2763
+ filename: z16.string().nullish(),
2764
+ index: z16.number().nullish(),
2765
+ start_index: z16.number().nullish(),
2766
+ end_index: z16.number().nullish(),
2767
+ quote: z16.string().nullish()
2768
+ }),
2769
+ z16.object({
2770
+ type: z16.literal("container_file_citation")
2771
+ })
2772
+ ])
2773
+ )
2774
+ })
2775
+ )
2776
+ }),
2777
+ z16.object({
2778
+ type: z16.literal("web_search_call"),
2779
+ id: z16.string(),
2780
+ status: z16.string(),
2781
+ action: z16.discriminatedUnion("type", [
2782
+ z16.object({
2783
+ type: z16.literal("search"),
2784
+ query: z16.string().nullish()
2785
+ }),
2786
+ z16.object({
2787
+ type: z16.literal("open_page"),
2788
+ url: z16.string()
2789
+ }),
2790
+ z16.object({
2791
+ type: z16.literal("find"),
2792
+ url: z16.string(),
2793
+ pattern: z16.string()
2794
+ })
2795
+ ]).nullish()
2796
+ }),
2797
+ z16.object({
2798
+ type: z16.literal("file_search_call"),
2799
+ id: z16.string(),
2800
+ queries: z16.array(z16.string()),
2801
+ results: z16.array(
2802
+ z16.object({
2803
+ attributes: z16.record(z16.string(), z16.unknown()),
2804
+ file_id: z16.string(),
2805
+ filename: z16.string(),
2806
+ score: z16.number(),
2807
+ text: z16.string()
2808
+ })
2809
+ ).nullish()
2810
+ }),
2811
+ z16.object({
2812
+ type: z16.literal("code_interpreter_call"),
2813
+ id: z16.string(),
2814
+ code: z16.string().nullable(),
2815
+ container_id: z16.string(),
2816
+ outputs: z16.array(
2817
+ z16.discriminatedUnion("type", [
2818
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2819
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2820
+ ])
2821
+ ).nullable()
2822
+ }),
2823
+ z16.object({
2824
+ type: z16.literal("image_generation_call"),
2825
+ id: z16.string(),
2826
+ result: z16.string()
2827
+ }),
2828
+ z16.object({
2829
+ type: z16.literal("local_shell_call"),
2830
+ id: z16.string(),
2831
+ call_id: z16.string(),
2832
+ action: z16.object({
2833
+ type: z16.literal("exec"),
2834
+ command: z16.array(z16.string()),
2835
+ timeout_ms: z16.number().optional(),
2836
+ user: z16.string().optional(),
2837
+ working_directory: z16.string().optional(),
2838
+ env: z16.record(z16.string(), z16.string()).optional()
2839
+ })
2840
+ }),
2841
+ z16.object({
2842
+ type: z16.literal("function_call"),
2843
+ call_id: z16.string(),
2844
+ name: z16.string(),
2845
+ arguments: z16.string(),
2846
+ id: z16.string()
2847
+ }),
2848
+ z16.object({
2849
+ type: z16.literal("computer_call"),
2850
+ id: z16.string(),
2851
+ status: z16.string().optional()
2852
+ }),
2853
+ z16.object({
2854
+ type: z16.literal("reasoning"),
2855
+ id: z16.string(),
2856
+ encrypted_content: z16.string().nullish(),
2857
+ summary: z16.array(
2858
+ z16.object({
2859
+ type: z16.literal("summary_text"),
2860
+ text: z16.string()
2861
+ })
2862
+ )
2863
+ })
2864
+ ])
2865
+ ),
2866
+ service_tier: z16.string().nullish(),
2867
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2868
+ usage: z16.object({
2869
+ input_tokens: z16.number(),
2870
+ input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
2871
+ output_tokens: z16.number(),
2872
+ output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
2873
+ })
2874
+ })
2875
+ )
2876
+ );
2877
+
2878
+ // src/responses/openai-responses-options.ts
2879
+ import {
2880
+ lazyValidator as lazyValidator9,
2881
+ zodSchema as zodSchema15
2882
+ } from "@ai-sdk/provider-utils";
2883
+ import * as z17 from "zod/v4";
2884
+ var TOP_LOGPROBS_MAX = 20;
2885
+ var openaiResponsesReasoningModelIds = [
2886
+ "o1",
2887
+ "o1-2024-12-17",
2888
+ "o3-mini",
2889
+ "o3-mini-2025-01-31",
2890
+ "o3",
2891
+ "o3-2025-04-16",
2892
+ "o4-mini",
2893
+ "o4-mini-2025-04-16",
2894
+ "codex-mini-latest",
2895
+ "computer-use-preview",
2896
+ "gpt-5",
2897
+ "gpt-5-2025-08-07",
2898
+ "gpt-5-codex",
2899
+ "gpt-5-mini",
2900
+ "gpt-5-mini-2025-08-07",
2901
+ "gpt-5-nano",
2902
+ "gpt-5-nano-2025-08-07",
2903
+ "gpt-5-pro",
2904
+ "gpt-5-pro-2025-10-06"
2905
+ ];
2906
+ var openaiResponsesModelIds = [
2907
+ "gpt-4.1",
2908
+ "gpt-4.1-2025-04-14",
2909
+ "gpt-4.1-mini",
2910
+ "gpt-4.1-mini-2025-04-14",
2911
+ "gpt-4.1-nano",
2912
+ "gpt-4.1-nano-2025-04-14",
2913
+ "gpt-4o",
2914
+ "gpt-4o-2024-05-13",
2915
+ "gpt-4o-2024-08-06",
2916
+ "gpt-4o-2024-11-20",
2917
+ "gpt-4o-audio-preview",
2918
+ "gpt-4o-audio-preview-2024-10-01",
2919
+ "gpt-4o-audio-preview-2024-12-17",
2920
+ "gpt-4o-search-preview",
2921
+ "gpt-4o-search-preview-2025-03-11",
2922
+ "gpt-4o-mini-search-preview",
2923
+ "gpt-4o-mini-search-preview-2025-03-11",
2924
+ "gpt-4o-mini",
2925
+ "gpt-4o-mini-2024-07-18",
2926
+ "gpt-4-turbo",
2927
+ "gpt-4-turbo-2024-04-09",
2928
+ "gpt-4-turbo-preview",
2929
+ "gpt-4-0125-preview",
2930
+ "gpt-4-1106-preview",
2931
+ "gpt-4",
2932
+ "gpt-4-0613",
2933
+ "gpt-4.5-preview",
2934
+ "gpt-4.5-preview-2025-02-27",
2935
+ "gpt-3.5-turbo-0125",
2936
+ "gpt-3.5-turbo",
2937
+ "gpt-3.5-turbo-1106",
2938
+ "chatgpt-4o-latest",
2939
+ "gpt-5-chat-latest",
2940
+ ...openaiResponsesReasoningModelIds
2941
+ ];
2942
+ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2943
+ () => zodSchema15(
2944
+ z17.object({
2945
+ include: z17.array(
2946
+ z17.enum([
2947
+ "reasoning.encrypted_content",
2948
+ "file_search_call.results",
2949
+ "message.output_text.logprobs"
2950
+ ])
2951
+ ).nullish(),
2952
+ instructions: z17.string().nullish(),
2953
+ /**
2954
+ * Return the log probabilities of the tokens.
2955
+ *
2956
+ * Setting to true will return the log probabilities of the tokens that
2957
+ * were generated.
2958
+ *
2959
+ * Setting to a number will return the log probabilities of the top n
2960
+ * tokens that were generated.
2961
+ *
2962
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2963
+ * @see https://cookbook.openai.com/examples/using_logprobs
2964
+ */
2965
+ logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2966
+ /**
2967
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2968
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2969
+ * Any further attempts to call a tool by the model will be ignored.
2970
+ */
2971
+ maxToolCalls: z17.number().nullish(),
2972
+ metadata: z17.any().nullish(),
2973
+ parallelToolCalls: z17.boolean().nullish(),
2974
+ previousResponseId: z17.string().nullish(),
2975
+ promptCacheKey: z17.string().nullish(),
2976
+ reasoningEffort: z17.string().nullish(),
2977
+ reasoningSummary: z17.string().nullish(),
2978
+ safetyIdentifier: z17.string().nullish(),
2979
+ serviceTier: z17.enum(["auto", "flex", "priority"]).nullish(),
2980
+ store: z17.boolean().nullish(),
2981
+ strictJsonSchema: z17.boolean().nullish(),
2982
+ textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
2983
+ user: z17.string().nullish()
2984
+ })
2985
+ )
2986
+ );
2987
+
2272
2988
  // src/responses/openai-responses-prepare-tools.ts
2273
2989
  import {
2274
2990
  UnsupportedFunctionalityError as UnsupportedFunctionalityError5
2275
2991
  } from "@ai-sdk/provider";
2276
- function prepareResponsesTools({
2992
+ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
2993
+ async function prepareResponsesTools({
2277
2994
  tools,
2278
2995
  toolChoice,
2279
2996
  strictJsonSchema
@@ -2298,7 +3015,10 @@ function prepareResponsesTools({
2298
3015
  case "provider-defined": {
2299
3016
  switch (tool.id) {
2300
3017
  case "openai.file_search": {
2301
- const args = fileSearchArgsSchema.parse(tool.args);
3018
+ const args = await validateTypes2({
3019
+ value: tool.args,
3020
+ schema: fileSearchArgsSchema
3021
+ });
2302
3022
  openaiTools2.push({
2303
3023
  type: "file_search",
2304
3024
  vector_store_ids: args.vectorStoreIds,
@@ -2318,7 +3038,10 @@ function prepareResponsesTools({
2318
3038
  break;
2319
3039
  }
2320
3040
  case "openai.web_search_preview": {
2321
- const args = webSearchPreviewArgsSchema.parse(tool.args);
3041
+ const args = await validateTypes2({
3042
+ value: tool.args,
3043
+ schema: webSearchPreviewArgsSchema
3044
+ });
2322
3045
  openaiTools2.push({
2323
3046
  type: "web_search_preview",
2324
3047
  search_context_size: args.searchContextSize,
@@ -2327,7 +3050,10 @@ function prepareResponsesTools({
2327
3050
  break;
2328
3051
  }
2329
3052
  case "openai.web_search": {
2330
- const args = webSearchArgsSchema.parse(tool.args);
3053
+ const args = await validateTypes2({
3054
+ value: tool.args,
3055
+ schema: webSearchArgsSchema
3056
+ });
2331
3057
  openaiTools2.push({
2332
3058
  type: "web_search",
2333
3059
  filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
@@ -2337,7 +3063,10 @@ function prepareResponsesTools({
2337
3063
  break;
2338
3064
  }
2339
3065
  case "openai.code_interpreter": {
2340
- const args = codeInterpreterArgsSchema.parse(tool.args);
3066
+ const args = await validateTypes2({
3067
+ value: tool.args,
3068
+ schema: codeInterpreterArgsSchema
3069
+ });
2341
3070
  openaiTools2.push({
2342
3071
  type: "code_interpreter",
2343
3072
  container: args.container == null ? { type: "auto", file_ids: void 0 } : typeof args.container === "string" ? args.container : { type: "auto", file_ids: args.container.fileIds }
@@ -2345,7 +3074,10 @@ function prepareResponsesTools({
2345
3074
  break;
2346
3075
  }
2347
3076
  case "openai.image_generation": {
2348
- const args = imageGenerationArgsSchema.parse(tool.args);
3077
+ const args = await validateTypes2({
3078
+ value: tool.args,
3079
+ schema: imageGenerationArgsSchema
3080
+ });
2349
3081
  openaiTools2.push({
2350
3082
  type: "image_generation",
2351
3083
  background: args.background,
@@ -2355,11 +3087,12 @@ function prepareResponsesTools({
2355
3087
  image_url: args.inputImageMask.imageUrl
2356
3088
  } : void 0,
2357
3089
  model: args.model,
2358
- size: args.size,
2359
- quality: args.quality,
2360
3090
  moderation: args.moderation,
3091
+ partial_images: args.partialImages,
3092
+ quality: args.quality,
3093
+ output_compression: args.outputCompression,
2361
3094
  output_format: args.outputFormat,
2362
- output_compression: args.outputCompression
3095
+ size: args.size
2363
3096
  });
2364
3097
  break;
2365
3098
  }
@@ -2396,83 +3129,6 @@ function prepareResponsesTools({
2396
3129
  }
2397
3130
 
2398
3131
  // src/responses/openai-responses-language-model.ts
2399
- var webSearchCallItem = z16.object({
2400
- type: z16.literal("web_search_call"),
2401
- id: z16.string(),
2402
- status: z16.string(),
2403
- action: z16.discriminatedUnion("type", [
2404
- z16.object({
2405
- type: z16.literal("search"),
2406
- query: z16.string().nullish()
2407
- }),
2408
- z16.object({
2409
- type: z16.literal("open_page"),
2410
- url: z16.string()
2411
- }),
2412
- z16.object({
2413
- type: z16.literal("find"),
2414
- url: z16.string(),
2415
- pattern: z16.string()
2416
- })
2417
- ]).nullish()
2418
- });
2419
- var fileSearchCallItem = z16.object({
2420
- type: z16.literal("file_search_call"),
2421
- id: z16.string(),
2422
- queries: z16.array(z16.string()),
2423
- results: z16.array(
2424
- z16.object({
2425
- attributes: z16.record(z16.string(), z16.unknown()),
2426
- file_id: z16.string(),
2427
- filename: z16.string(),
2428
- score: z16.number(),
2429
- text: z16.string()
2430
- })
2431
- ).nullish()
2432
- });
2433
- var codeInterpreterCallItem = z16.object({
2434
- type: z16.literal("code_interpreter_call"),
2435
- id: z16.string(),
2436
- code: z16.string().nullable(),
2437
- container_id: z16.string(),
2438
- outputs: z16.array(
2439
- z16.discriminatedUnion("type", [
2440
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2441
- z16.object({ type: z16.literal("image"), url: z16.string() })
2442
- ])
2443
- ).nullable()
2444
- });
2445
- var localShellCallItem = z16.object({
2446
- type: z16.literal("local_shell_call"),
2447
- id: z16.string(),
2448
- call_id: z16.string(),
2449
- action: z16.object({
2450
- type: z16.literal("exec"),
2451
- command: z16.array(z16.string()),
2452
- timeout_ms: z16.number().optional(),
2453
- user: z16.string().optional(),
2454
- working_directory: z16.string().optional(),
2455
- env: z16.record(z16.string(), z16.string()).optional()
2456
- })
2457
- });
2458
- var imageGenerationCallItem = z16.object({
2459
- type: z16.literal("image_generation_call"),
2460
- id: z16.string(),
2461
- result: z16.string()
2462
- });
2463
- var TOP_LOGPROBS_MAX = 20;
2464
- var LOGPROBS_SCHEMA = z16.array(
2465
- z16.object({
2466
- token: z16.string(),
2467
- logprob: z16.number(),
2468
- top_logprobs: z16.array(
2469
- z16.object({
2470
- token: z16.string(),
2471
- logprob: z16.number()
2472
- })
2473
- )
2474
- })
2475
- );
2476
3132
  var OpenAIResponsesLanguageModel = class {
2477
3133
  constructor(modelId, config) {
2478
3134
  this.specificationVersion = "v3";
@@ -2664,7 +3320,7 @@ var OpenAIResponsesLanguageModel = class {
2664
3320
  tools: openaiTools2,
2665
3321
  toolChoice: openaiToolChoice,
2666
3322
  toolWarnings
2667
- } = prepareResponsesTools({
3323
+ } = await prepareResponsesTools({
2668
3324
  tools,
2669
3325
  toolChoice,
2670
3326
  strictJsonSchema
@@ -2700,85 +3356,7 @@ var OpenAIResponsesLanguageModel = class {
2700
3356
  body,
2701
3357
  failedResponseHandler: openaiFailedResponseHandler,
2702
3358
  successfulResponseHandler: createJsonResponseHandler5(
2703
- z16.object({
2704
- id: z16.string(),
2705
- created_at: z16.number(),
2706
- error: z16.object({
2707
- code: z16.string(),
2708
- message: z16.string()
2709
- }).nullish(),
2710
- model: z16.string(),
2711
- output: z16.array(
2712
- z16.discriminatedUnion("type", [
2713
- z16.object({
2714
- type: z16.literal("message"),
2715
- role: z16.literal("assistant"),
2716
- id: z16.string(),
2717
- content: z16.array(
2718
- z16.object({
2719
- type: z16.literal("output_text"),
2720
- text: z16.string(),
2721
- logprobs: LOGPROBS_SCHEMA.nullish(),
2722
- annotations: z16.array(
2723
- z16.discriminatedUnion("type", [
2724
- z16.object({
2725
- type: z16.literal("url_citation"),
2726
- start_index: z16.number(),
2727
- end_index: z16.number(),
2728
- url: z16.string(),
2729
- title: z16.string()
2730
- }),
2731
- z16.object({
2732
- type: z16.literal("file_citation"),
2733
- file_id: z16.string(),
2734
- filename: z16.string().nullish(),
2735
- index: z16.number().nullish(),
2736
- start_index: z16.number().nullish(),
2737
- end_index: z16.number().nullish(),
2738
- quote: z16.string().nullish()
2739
- }),
2740
- z16.object({
2741
- type: z16.literal("container_file_citation")
2742
- })
2743
- ])
2744
- )
2745
- })
2746
- )
2747
- }),
2748
- webSearchCallItem,
2749
- fileSearchCallItem,
2750
- codeInterpreterCallItem,
2751
- imageGenerationCallItem,
2752
- localShellCallItem,
2753
- z16.object({
2754
- type: z16.literal("function_call"),
2755
- call_id: z16.string(),
2756
- name: z16.string(),
2757
- arguments: z16.string(),
2758
- id: z16.string()
2759
- }),
2760
- z16.object({
2761
- type: z16.literal("computer_call"),
2762
- id: z16.string(),
2763
- status: z16.string().optional()
2764
- }),
2765
- z16.object({
2766
- type: z16.literal("reasoning"),
2767
- id: z16.string(),
2768
- encrypted_content: z16.string().nullish(),
2769
- summary: z16.array(
2770
- z16.object({
2771
- type: z16.literal("summary_text"),
2772
- text: z16.string()
2773
- })
2774
- )
2775
- })
2776
- ])
2777
- ),
2778
- service_tier: z16.string().nullish(),
2779
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2780
- usage: usageSchema2
2781
- })
3359
+ openaiResponsesResponseSchema
2782
3360
  ),
2783
3361
  abortSignal: options.abortSignal,
2784
3362
  fetch: this.config.fetch
@@ -2841,7 +3419,9 @@ var OpenAIResponsesLanguageModel = class {
2841
3419
  type: "tool-call",
2842
3420
  toolCallId: part.call_id,
2843
3421
  toolName: "local_shell",
2844
- input: JSON.stringify({ action: part.action }),
3422
+ input: JSON.stringify({
3423
+ action: part.action
3424
+ }),
2845
3425
  providerMetadata: {
2846
3426
  openai: {
2847
3427
  itemId: part.id
@@ -3095,7 +3675,8 @@ var OpenAIResponsesLanguageModel = class {
3095
3675
  controller.enqueue({
3096
3676
  type: "tool-input-start",
3097
3677
  id: value.item.id,
3098
- toolName: webSearchToolName != null ? webSearchToolName : "web_search"
3678
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3679
+ providerExecuted: true
3099
3680
  });
3100
3681
  } else if (value.item.type === "computer_call") {
3101
3682
  ongoingToolCalls[value.output_index] = {
@@ -3105,7 +3686,8 @@ var OpenAIResponsesLanguageModel = class {
3105
3686
  controller.enqueue({
3106
3687
  type: "tool-input-start",
3107
3688
  id: value.item.id,
3108
- toolName: "computer_use"
3689
+ toolName: "computer_use",
3690
+ providerExecuted: true
3109
3691
  });
3110
3692
  } else if (value.item.type === "code_interpreter_call") {
3111
3693
  ongoingToolCalls[value.output_index] = {
@@ -3118,7 +3700,8 @@ var OpenAIResponsesLanguageModel = class {
3118
3700
  controller.enqueue({
3119
3701
  type: "tool-input-start",
3120
3702
  id: value.item.id,
3121
- toolName: "code_interpreter"
3703
+ toolName: "code_interpreter",
3704
+ providerExecuted: true
3122
3705
  });
3123
3706
  controller.enqueue({
3124
3707
  type: "tool-input-delta",
@@ -3318,6 +3901,17 @@ var OpenAIResponsesLanguageModel = class {
3318
3901
  delta: value.delta
3319
3902
  });
3320
3903
  }
3904
+ } else if (isResponseImageGenerationCallPartialImageChunk(value)) {
3905
+ controller.enqueue({
3906
+ type: "tool-result",
3907
+ toolCallId: value.item_id,
3908
+ toolName: "image_generation",
3909
+ result: {
3910
+ result: value.partial_image_b64
3911
+ },
3912
+ providerExecuted: true,
3913
+ preliminary: true
3914
+ });
3321
3915
  } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3322
3916
  const toolCall = ongoingToolCalls[value.output_index];
3323
3917
  if (toolCall != null) {
@@ -3458,196 +4052,6 @@ var OpenAIResponsesLanguageModel = class {
3458
4052
  };
3459
4053
  }
3460
4054
  };
3461
- var usageSchema2 = z16.object({
3462
- input_tokens: z16.number(),
3463
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
3464
- output_tokens: z16.number(),
3465
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
3466
- });
3467
- var textDeltaChunkSchema = z16.object({
3468
- type: z16.literal("response.output_text.delta"),
3469
- item_id: z16.string(),
3470
- delta: z16.string(),
3471
- logprobs: LOGPROBS_SCHEMA.nullish()
3472
- });
3473
- var errorChunkSchema = z16.object({
3474
- type: z16.literal("error"),
3475
- code: z16.string(),
3476
- message: z16.string(),
3477
- param: z16.string().nullish(),
3478
- sequence_number: z16.number()
3479
- });
3480
- var responseFinishedChunkSchema = z16.object({
3481
- type: z16.enum(["response.completed", "response.incomplete"]),
3482
- response: z16.object({
3483
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3484
- usage: usageSchema2,
3485
- service_tier: z16.string().nullish()
3486
- })
3487
- });
3488
- var responseCreatedChunkSchema = z16.object({
3489
- type: z16.literal("response.created"),
3490
- response: z16.object({
3491
- id: z16.string(),
3492
- created_at: z16.number(),
3493
- model: z16.string(),
3494
- service_tier: z16.string().nullish()
3495
- })
3496
- });
3497
- var responseOutputItemAddedSchema = z16.object({
3498
- type: z16.literal("response.output_item.added"),
3499
- output_index: z16.number(),
3500
- item: z16.discriminatedUnion("type", [
3501
- z16.object({
3502
- type: z16.literal("message"),
3503
- id: z16.string()
3504
- }),
3505
- z16.object({
3506
- type: z16.literal("reasoning"),
3507
- id: z16.string(),
3508
- encrypted_content: z16.string().nullish()
3509
- }),
3510
- z16.object({
3511
- type: z16.literal("function_call"),
3512
- id: z16.string(),
3513
- call_id: z16.string(),
3514
- name: z16.string(),
3515
- arguments: z16.string()
3516
- }),
3517
- z16.object({
3518
- type: z16.literal("web_search_call"),
3519
- id: z16.string(),
3520
- status: z16.string(),
3521
- action: z16.object({
3522
- type: z16.literal("search"),
3523
- query: z16.string().optional()
3524
- }).nullish()
3525
- }),
3526
- z16.object({
3527
- type: z16.literal("computer_call"),
3528
- id: z16.string(),
3529
- status: z16.string()
3530
- }),
3531
- z16.object({
3532
- type: z16.literal("file_search_call"),
3533
- id: z16.string()
3534
- }),
3535
- z16.object({
3536
- type: z16.literal("image_generation_call"),
3537
- id: z16.string()
3538
- }),
3539
- z16.object({
3540
- type: z16.literal("code_interpreter_call"),
3541
- id: z16.string(),
3542
- container_id: z16.string(),
3543
- code: z16.string().nullable(),
3544
- outputs: z16.array(
3545
- z16.discriminatedUnion("type", [
3546
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3547
- z16.object({ type: z16.literal("image"), url: z16.string() })
3548
- ])
3549
- ).nullable(),
3550
- status: z16.string()
3551
- })
3552
- ])
3553
- });
3554
- var responseOutputItemDoneSchema = z16.object({
3555
- type: z16.literal("response.output_item.done"),
3556
- output_index: z16.number(),
3557
- item: z16.discriminatedUnion("type", [
3558
- z16.object({
3559
- type: z16.literal("message"),
3560
- id: z16.string()
3561
- }),
3562
- z16.object({
3563
- type: z16.literal("reasoning"),
3564
- id: z16.string(),
3565
- encrypted_content: z16.string().nullish()
3566
- }),
3567
- z16.object({
3568
- type: z16.literal("function_call"),
3569
- id: z16.string(),
3570
- call_id: z16.string(),
3571
- name: z16.string(),
3572
- arguments: z16.string(),
3573
- status: z16.literal("completed")
3574
- }),
3575
- codeInterpreterCallItem,
3576
- imageGenerationCallItem,
3577
- webSearchCallItem,
3578
- fileSearchCallItem,
3579
- localShellCallItem,
3580
- z16.object({
3581
- type: z16.literal("computer_call"),
3582
- id: z16.string(),
3583
- status: z16.literal("completed")
3584
- })
3585
- ])
3586
- });
3587
- var responseFunctionCallArgumentsDeltaSchema = z16.object({
3588
- type: z16.literal("response.function_call_arguments.delta"),
3589
- item_id: z16.string(),
3590
- output_index: z16.number(),
3591
- delta: z16.string()
3592
- });
3593
- var responseCodeInterpreterCallCodeDeltaSchema = z16.object({
3594
- type: z16.literal("response.code_interpreter_call_code.delta"),
3595
- item_id: z16.string(),
3596
- output_index: z16.number(),
3597
- delta: z16.string()
3598
- });
3599
- var responseCodeInterpreterCallCodeDoneSchema = z16.object({
3600
- type: z16.literal("response.code_interpreter_call_code.done"),
3601
- item_id: z16.string(),
3602
- output_index: z16.number(),
3603
- code: z16.string()
3604
- });
3605
- var responseAnnotationAddedSchema = z16.object({
3606
- type: z16.literal("response.output_text.annotation.added"),
3607
- annotation: z16.discriminatedUnion("type", [
3608
- z16.object({
3609
- type: z16.literal("url_citation"),
3610
- url: z16.string(),
3611
- title: z16.string()
3612
- }),
3613
- z16.object({
3614
- type: z16.literal("file_citation"),
3615
- file_id: z16.string(),
3616
- filename: z16.string().nullish(),
3617
- index: z16.number().nullish(),
3618
- start_index: z16.number().nullish(),
3619
- end_index: z16.number().nullish(),
3620
- quote: z16.string().nullish()
3621
- })
3622
- ])
3623
- });
3624
- var responseReasoningSummaryPartAddedSchema = z16.object({
3625
- type: z16.literal("response.reasoning_summary_part.added"),
3626
- item_id: z16.string(),
3627
- summary_index: z16.number()
3628
- });
3629
- var responseReasoningSummaryTextDeltaSchema = z16.object({
3630
- type: z16.literal("response.reasoning_summary_text.delta"),
3631
- item_id: z16.string(),
3632
- summary_index: z16.number(),
3633
- delta: z16.string()
3634
- });
3635
- var openaiResponsesChunkSchema = z16.union([
3636
- textDeltaChunkSchema,
3637
- responseFinishedChunkSchema,
3638
- responseCreatedChunkSchema,
3639
- responseOutputItemAddedSchema,
3640
- responseOutputItemDoneSchema,
3641
- responseFunctionCallArgumentsDeltaSchema,
3642
- responseCodeInterpreterCallCodeDeltaSchema,
3643
- responseCodeInterpreterCallCodeDoneSchema,
3644
- responseAnnotationAddedSchema,
3645
- responseReasoningSummaryPartAddedSchema,
3646
- responseReasoningSummaryTextDeltaSchema,
3647
- errorChunkSchema,
3648
- z16.object({ type: z16.string() }).loose()
3649
- // fallback for unknown chunks
3650
- ]);
3651
4055
  function isTextDeltaChunk(chunk) {
3652
4056
  return chunk.type === "response.output_text.delta";
3653
4057
  }
@@ -3666,6 +4070,9 @@ function isResponseCreatedChunk(chunk) {
3666
4070
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3667
4071
  return chunk.type === "response.function_call_arguments.delta";
3668
4072
  }
4073
+ function isResponseImageGenerationCallPartialImageChunk(chunk) {
4074
+ return chunk.type === "response.image_generation_call.partial_image";
4075
+ }
3669
4076
  function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3670
4077
  return chunk.type === "response.code_interpreter_call_code.delta";
3671
4078
  }
@@ -3724,47 +4131,6 @@ function getResponsesModelConfig(modelId) {
3724
4131
  isReasoningModel: false
3725
4132
  };
3726
4133
  }
3727
- var openaiResponsesProviderOptionsSchema = z16.object({
3728
- include: z16.array(
3729
- z16.enum([
3730
- "reasoning.encrypted_content",
3731
- "file_search_call.results",
3732
- "message.output_text.logprobs"
3733
- ])
3734
- ).nullish(),
3735
- instructions: z16.string().nullish(),
3736
- /**
3737
- * Return the log probabilities of the tokens.
3738
- *
3739
- * Setting to true will return the log probabilities of the tokens that
3740
- * were generated.
3741
- *
3742
- * Setting to a number will return the log probabilities of the top n
3743
- * tokens that were generated.
3744
- *
3745
- * @see https://platform.openai.com/docs/api-reference/responses/create
3746
- * @see https://cookbook.openai.com/examples/using_logprobs
3747
- */
3748
- logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3749
- /**
3750
- * The maximum number of total calls to built-in tools that can be processed in a response.
3751
- * This maximum number applies across all built-in tool calls, not per individual tool.
3752
- * Any further attempts to call a tool by the model will be ignored.
3753
- */
3754
- maxToolCalls: z16.number().nullish(),
3755
- metadata: z16.any().nullish(),
3756
- parallelToolCalls: z16.boolean().nullish(),
3757
- previousResponseId: z16.string().nullish(),
3758
- promptCacheKey: z16.string().nullish(),
3759
- reasoningEffort: z16.string().nullish(),
3760
- reasoningSummary: z16.string().nullish(),
3761
- safetyIdentifier: z16.string().nullish(),
3762
- serviceTier: z16.enum(["auto", "flex", "priority"]).nullish(),
3763
- store: z16.boolean().nullish(),
3764
- strictJsonSchema: z16.boolean().nullish(),
3765
- textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
3766
- user: z16.string().nullish()
3767
- });
3768
4134
 
3769
4135
  // src/speech/openai-speech-model.ts
3770
4136
  import {
@@ -3773,16 +4139,28 @@ import {
3773
4139
  parseProviderOptions as parseProviderOptions6,
3774
4140
  postJsonToApi as postJsonToApi6
3775
4141
  } from "@ai-sdk/provider-utils";
3776
- import { z as z17 } from "zod/v4";
3777
- var OpenAIProviderOptionsSchema = z17.object({
3778
- instructions: z17.string().nullish(),
3779
- speed: z17.number().min(0.25).max(4).default(1).nullish()
3780
- });
4142
+
4143
+ // src/speech/openai-speech-options.ts
4144
+ import {
4145
+ lazyValidator as lazyValidator10,
4146
+ zodSchema as zodSchema16
4147
+ } from "@ai-sdk/provider-utils";
4148
+ import * as z18 from "zod/v4";
4149
+ var openaiSpeechProviderOptionsSchema = lazyValidator10(
4150
+ () => zodSchema16(
4151
+ z18.object({
4152
+ instructions: z18.string().nullish(),
4153
+ speed: z18.number().min(0.25).max(4).default(1).nullish()
4154
+ })
4155
+ )
4156
+ );
4157
+
4158
+ // src/speech/openai-speech-model.ts
3781
4159
  var OpenAISpeechModel = class {
3782
4160
  constructor(modelId, config) {
3783
4161
  this.modelId = modelId;
3784
4162
  this.config = config;
3785
- this.specificationVersion = "v2";
4163
+ this.specificationVersion = "v3";
3786
4164
  }
3787
4165
  get provider() {
3788
4166
  return this.config.provider;
@@ -3800,7 +4178,7 @@ var OpenAISpeechModel = class {
3800
4178
  const openAIOptions = await parseProviderOptions6({
3801
4179
  provider: "openai",
3802
4180
  providerOptions,
3803
- schema: OpenAIProviderOptionsSchema
4181
+ schema: openaiSpeechProviderOptionsSchema
3804
4182
  });
3805
4183
  const requestBody = {
3806
4184
  model: this.modelId,
@@ -3887,34 +4265,75 @@ import {
3887
4265
  parseProviderOptions as parseProviderOptions7,
3888
4266
  postFormDataToApi
3889
4267
  } from "@ai-sdk/provider-utils";
3890
- import { z as z19 } from "zod/v4";
4268
+
4269
+ // src/transcription/openai-transcription-api.ts
4270
+ import { lazyValidator as lazyValidator11, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
4271
+ import * as z19 from "zod/v4";
4272
+ var openaiTranscriptionResponseSchema = lazyValidator11(
4273
+ () => zodSchema17(
4274
+ z19.object({
4275
+ text: z19.string(),
4276
+ language: z19.string().nullish(),
4277
+ duration: z19.number().nullish(),
4278
+ words: z19.array(
4279
+ z19.object({
4280
+ word: z19.string(),
4281
+ start: z19.number(),
4282
+ end: z19.number()
4283
+ })
4284
+ ).nullish(),
4285
+ segments: z19.array(
4286
+ z19.object({
4287
+ id: z19.number(),
4288
+ seek: z19.number(),
4289
+ start: z19.number(),
4290
+ end: z19.number(),
4291
+ text: z19.string(),
4292
+ tokens: z19.array(z19.number()),
4293
+ temperature: z19.number(),
4294
+ avg_logprob: z19.number(),
4295
+ compression_ratio: z19.number(),
4296
+ no_speech_prob: z19.number()
4297
+ })
4298
+ ).nullish()
4299
+ })
4300
+ )
4301
+ );
3891
4302
 
3892
4303
  // src/transcription/openai-transcription-options.ts
3893
- import { z as z18 } from "zod/v4";
3894
- var openAITranscriptionProviderOptions = z18.object({
3895
- /**
3896
- * Additional information to include in the transcription response.
3897
- */
3898
- include: z18.array(z18.string()).optional(),
3899
- /**
3900
- * The language of the input audio in ISO-639-1 format.
3901
- */
3902
- language: z18.string().optional(),
3903
- /**
3904
- * An optional text to guide the model's style or continue a previous audio segment.
3905
- */
3906
- prompt: z18.string().optional(),
3907
- /**
3908
- * The sampling temperature, between 0 and 1.
3909
- * @default 0
3910
- */
3911
- temperature: z18.number().min(0).max(1).default(0).optional(),
3912
- /**
3913
- * The timestamp granularities to populate for this transcription.
3914
- * @default ['segment']
3915
- */
3916
- timestampGranularities: z18.array(z18.enum(["word", "segment"])).default(["segment"]).optional()
3917
- });
4304
+ import {
4305
+ lazyValidator as lazyValidator12,
4306
+ zodSchema as zodSchema18
4307
+ } from "@ai-sdk/provider-utils";
4308
+ import * as z20 from "zod/v4";
4309
+ var openAITranscriptionProviderOptions = lazyValidator12(
4310
+ () => zodSchema18(
4311
+ z20.object({
4312
+ /**
4313
+ * Additional information to include in the transcription response.
4314
+ */
4315
+ include: z20.array(z20.string()).optional(),
4316
+ /**
4317
+ * The language of the input audio in ISO-639-1 format.
4318
+ */
4319
+ language: z20.string().optional(),
4320
+ /**
4321
+ * An optional text to guide the model's style or continue a previous audio segment.
4322
+ */
4323
+ prompt: z20.string().optional(),
4324
+ /**
4325
+ * The sampling temperature, between 0 and 1.
4326
+ * @default 0
4327
+ */
4328
+ temperature: z20.number().min(0).max(1).default(0).optional(),
4329
+ /**
4330
+ * The timestamp granularities to populate for this transcription.
4331
+ * @default ['segment']
4332
+ */
4333
+ timestampGranularities: z20.array(z20.enum(["word", "segment"])).default(["segment"]).optional()
4334
+ })
4335
+ )
4336
+ );
3918
4337
 
3919
4338
  // src/transcription/openai-transcription-model.ts
3920
4339
  var languageMap = {
@@ -3980,7 +4399,7 @@ var OpenAITranscriptionModel = class {
3980
4399
  constructor(modelId, config) {
3981
4400
  this.modelId = modelId;
3982
4401
  this.config = config;
3983
- this.specificationVersion = "v2";
4402
+ this.specificationVersion = "v3";
3984
4403
  }
3985
4404
  get provider() {
3986
4405
  return this.config.provider;
@@ -4082,35 +4501,9 @@ var OpenAITranscriptionModel = class {
4082
4501
  };
4083
4502
  }
4084
4503
  };
4085
- var openaiTranscriptionResponseSchema = z19.object({
4086
- text: z19.string(),
4087
- language: z19.string().nullish(),
4088
- duration: z19.number().nullish(),
4089
- words: z19.array(
4090
- z19.object({
4091
- word: z19.string(),
4092
- start: z19.number(),
4093
- end: z19.number()
4094
- })
4095
- ).nullish(),
4096
- segments: z19.array(
4097
- z19.object({
4098
- id: z19.number(),
4099
- seek: z19.number(),
4100
- start: z19.number(),
4101
- end: z19.number(),
4102
- text: z19.string(),
4103
- tokens: z19.array(z19.number()),
4104
- temperature: z19.number(),
4105
- avg_logprob: z19.number(),
4106
- compression_ratio: z19.number(),
4107
- no_speech_prob: z19.number()
4108
- })
4109
- ).nullish()
4110
- });
4111
4504
 
4112
4505
  // src/version.ts
4113
- var VERSION = true ? "2.1.0-beta.9" : "0.0.0-test";
4506
+ var VERSION = true ? "3.0.0-beta.18" : "0.0.0-test";
4114
4507
 
4115
4508
  // src/openai-provider.ts
4116
4509
  function createOpenAI(options = {}) {