@ai-sdk/openai 2.0.43 → 2.0.45

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({
@@ -250,95 +249,244 @@ function mapOpenAIFinishReason(finishReason) {
250
249
  }
251
250
  }
252
251
 
252
+ // src/chat/openai-chat-api.ts
253
+ import {
254
+ lazyValidator,
255
+ zodSchema
256
+ } from "@ai-sdk/provider-utils";
257
+ import * as z2 from "zod/v4";
258
+ var openaiChatResponseSchema = lazyValidator(
259
+ () => zodSchema(
260
+ z2.object({
261
+ id: z2.string().nullish(),
262
+ created: z2.number().nullish(),
263
+ model: z2.string().nullish(),
264
+ choices: z2.array(
265
+ z2.object({
266
+ message: z2.object({
267
+ role: z2.literal("assistant").nullish(),
268
+ content: z2.string().nullish(),
269
+ tool_calls: z2.array(
270
+ z2.object({
271
+ id: z2.string().nullish(),
272
+ type: z2.literal("function"),
273
+ function: z2.object({
274
+ name: z2.string(),
275
+ arguments: z2.string()
276
+ })
277
+ })
278
+ ).nullish(),
279
+ annotations: z2.array(
280
+ z2.object({
281
+ type: z2.literal("url_citation"),
282
+ start_index: z2.number(),
283
+ end_index: z2.number(),
284
+ url: z2.string(),
285
+ title: z2.string()
286
+ })
287
+ ).nullish()
288
+ }),
289
+ index: z2.number(),
290
+ logprobs: z2.object({
291
+ content: z2.array(
292
+ z2.object({
293
+ token: z2.string(),
294
+ logprob: z2.number(),
295
+ top_logprobs: z2.array(
296
+ z2.object({
297
+ token: z2.string(),
298
+ logprob: z2.number()
299
+ })
300
+ )
301
+ })
302
+ ).nullish()
303
+ }).nullish(),
304
+ finish_reason: z2.string().nullish()
305
+ })
306
+ ),
307
+ usage: z2.object({
308
+ prompt_tokens: z2.number().nullish(),
309
+ completion_tokens: z2.number().nullish(),
310
+ total_tokens: z2.number().nullish(),
311
+ prompt_tokens_details: z2.object({
312
+ cached_tokens: z2.number().nullish()
313
+ }).nullish(),
314
+ completion_tokens_details: z2.object({
315
+ reasoning_tokens: z2.number().nullish(),
316
+ accepted_prediction_tokens: z2.number().nullish(),
317
+ rejected_prediction_tokens: z2.number().nullish()
318
+ }).nullish()
319
+ }).nullish()
320
+ })
321
+ )
322
+ );
323
+ var openaiChatChunkSchema = lazyValidator(
324
+ () => zodSchema(
325
+ z2.union([
326
+ z2.object({
327
+ id: z2.string().nullish(),
328
+ created: z2.number().nullish(),
329
+ model: z2.string().nullish(),
330
+ choices: z2.array(
331
+ z2.object({
332
+ delta: z2.object({
333
+ role: z2.enum(["assistant"]).nullish(),
334
+ content: z2.string().nullish(),
335
+ tool_calls: z2.array(
336
+ z2.object({
337
+ index: z2.number(),
338
+ id: z2.string().nullish(),
339
+ type: z2.literal("function").nullish(),
340
+ function: z2.object({
341
+ name: z2.string().nullish(),
342
+ arguments: z2.string().nullish()
343
+ })
344
+ })
345
+ ).nullish(),
346
+ annotations: z2.array(
347
+ z2.object({
348
+ type: z2.literal("url_citation"),
349
+ start_index: z2.number(),
350
+ end_index: z2.number(),
351
+ url: z2.string(),
352
+ title: z2.string()
353
+ })
354
+ ).nullish()
355
+ }).nullish(),
356
+ logprobs: z2.object({
357
+ content: z2.array(
358
+ z2.object({
359
+ token: z2.string(),
360
+ logprob: z2.number(),
361
+ top_logprobs: z2.array(
362
+ z2.object({
363
+ token: z2.string(),
364
+ logprob: z2.number()
365
+ })
366
+ )
367
+ })
368
+ ).nullish()
369
+ }).nullish(),
370
+ finish_reason: z2.string().nullish(),
371
+ index: z2.number()
372
+ })
373
+ ),
374
+ usage: z2.object({
375
+ prompt_tokens: z2.number().nullish(),
376
+ completion_tokens: z2.number().nullish(),
377
+ total_tokens: z2.number().nullish(),
378
+ prompt_tokens_details: z2.object({
379
+ cached_tokens: z2.number().nullish()
380
+ }).nullish(),
381
+ completion_tokens_details: z2.object({
382
+ reasoning_tokens: z2.number().nullish(),
383
+ accepted_prediction_tokens: z2.number().nullish(),
384
+ rejected_prediction_tokens: z2.number().nullish()
385
+ }).nullish()
386
+ }).nullish()
387
+ }),
388
+ openaiErrorDataSchema
389
+ ])
390
+ )
391
+ );
392
+
253
393
  // 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
- });
394
+ import {
395
+ lazyValidator as lazyValidator2,
396
+ zodSchema as zodSchema2
397
+ } from "@ai-sdk/provider-utils";
398
+ import * as z3 from "zod/v4";
399
+ var openaiChatLanguageModelOptions = lazyValidator2(
400
+ () => zodSchema2(
401
+ z3.object({
402
+ /**
403
+ * Modify the likelihood of specified tokens appearing in the completion.
404
+ *
405
+ * Accepts a JSON object that maps tokens (specified by their token ID in
406
+ * the GPT tokenizer) to an associated bias value from -100 to 100.
407
+ */
408
+ logitBias: z3.record(z3.coerce.number(), z3.number()).optional(),
409
+ /**
410
+ * Return the log probabilities of the tokens.
411
+ *
412
+ * Setting to true will return the log probabilities of the tokens that
413
+ * were generated.
414
+ *
415
+ * Setting to a number will return the log probabilities of the top n
416
+ * tokens that were generated.
417
+ */
418
+ logprobs: z3.union([z3.boolean(), z3.number()]).optional(),
419
+ /**
420
+ * Whether to enable parallel function calling during tool use. Default to true.
421
+ */
422
+ parallelToolCalls: z3.boolean().optional(),
423
+ /**
424
+ * A unique identifier representing your end-user, which can help OpenAI to
425
+ * monitor and detect abuse.
426
+ */
427
+ user: z3.string().optional(),
428
+ /**
429
+ * Reasoning effort for reasoning models. Defaults to `medium`.
430
+ */
431
+ reasoningEffort: z3.enum(["minimal", "low", "medium", "high"]).optional(),
432
+ /**
433
+ * Maximum number of completion tokens to generate. Useful for reasoning models.
434
+ */
435
+ maxCompletionTokens: z3.number().optional(),
436
+ /**
437
+ * Whether to enable persistence in responses API.
438
+ */
439
+ store: z3.boolean().optional(),
440
+ /**
441
+ * Metadata to associate with the request.
442
+ */
443
+ metadata: z3.record(z3.string().max(64), z3.string().max(512)).optional(),
444
+ /**
445
+ * Parameters for prediction mode.
446
+ */
447
+ prediction: z3.record(z3.string(), z3.any()).optional(),
448
+ /**
449
+ * Whether to use structured outputs.
450
+ *
451
+ * @default true
452
+ */
453
+ structuredOutputs: z3.boolean().optional(),
454
+ /**
455
+ * Service tier for the request.
456
+ * - 'auto': Default service tier
457
+ * - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
458
+ * - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
459
+ *
460
+ * @default 'auto'
461
+ */
462
+ serviceTier: z3.enum(["auto", "flex", "priority"]).optional(),
463
+ /**
464
+ * Whether to use strict JSON schema validation.
465
+ *
466
+ * @default false
467
+ */
468
+ strictJsonSchema: z3.boolean().optional(),
469
+ /**
470
+ * Controls the verbosity of the model's responses.
471
+ * Lower values will result in more concise responses, while higher values will result in more verbose responses.
472
+ */
473
+ textVerbosity: z3.enum(["low", "medium", "high"]).optional(),
474
+ /**
475
+ * A cache key for prompt caching. Allows manual control over prompt caching behavior.
476
+ * Useful for improving cache hit rates and working around automatic caching issues.
477
+ */
478
+ promptCacheKey: z3.string().optional(),
479
+ /**
480
+ * A stable identifier used to help detect users of your application
481
+ * that may be violating OpenAI's usage policies. The IDs should be a
482
+ * string that uniquely identifies each user. We recommend hashing their
483
+ * username or email address, in order to avoid sending us any identifying
484
+ * information.
485
+ */
486
+ safetyIdentifier: z3.string().optional()
487
+ })
488
+ )
489
+ );
342
490
 
343
491
  // src/chat/openai-chat-prepare-tools.ts
344
492
  import {
@@ -896,121 +1044,6 @@ var OpenAIChatLanguageModel = class {
896
1044
  };
897
1045
  }
898
1046
  };
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
1047
  function isReasoningModel(modelId) {
1015
1048
  return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
1016
1049
  }
@@ -1068,7 +1101,6 @@ import {
1068
1101
  parseProviderOptions as parseProviderOptions2,
1069
1102
  postJsonToApi as postJsonToApi2
1070
1103
  } from "@ai-sdk/provider-utils";
1071
- import { z as z5 } from "zod/v4";
1072
1104
 
1073
1105
  // src/completion/convert-to-openai-completion-prompt.ts
1074
1106
  import {
@@ -1178,48 +1210,117 @@ function mapOpenAIFinishReason2(finishReason) {
1178
1210
  }
1179
1211
  }
1180
1212
 
1213
+ // src/completion/openai-completion-api.ts
1214
+ import * as z4 from "zod/v4";
1215
+ import {
1216
+ lazyValidator as lazyValidator3,
1217
+ zodSchema as zodSchema3
1218
+ } from "@ai-sdk/provider-utils";
1219
+ var openaiCompletionResponseSchema = lazyValidator3(
1220
+ () => zodSchema3(
1221
+ z4.object({
1222
+ id: z4.string().nullish(),
1223
+ created: z4.number().nullish(),
1224
+ model: z4.string().nullish(),
1225
+ choices: z4.array(
1226
+ z4.object({
1227
+ text: z4.string(),
1228
+ finish_reason: z4.string(),
1229
+ logprobs: z4.object({
1230
+ tokens: z4.array(z4.string()),
1231
+ token_logprobs: z4.array(z4.number()),
1232
+ top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
1233
+ }).nullish()
1234
+ })
1235
+ ),
1236
+ usage: z4.object({
1237
+ prompt_tokens: z4.number(),
1238
+ completion_tokens: z4.number(),
1239
+ total_tokens: z4.number()
1240
+ }).nullish()
1241
+ })
1242
+ )
1243
+ );
1244
+ var openaiCompletionChunkSchema = lazyValidator3(
1245
+ () => zodSchema3(
1246
+ z4.union([
1247
+ z4.object({
1248
+ id: z4.string().nullish(),
1249
+ created: z4.number().nullish(),
1250
+ model: z4.string().nullish(),
1251
+ choices: z4.array(
1252
+ z4.object({
1253
+ text: z4.string(),
1254
+ finish_reason: z4.string().nullish(),
1255
+ index: z4.number(),
1256
+ logprobs: z4.object({
1257
+ tokens: z4.array(z4.string()),
1258
+ token_logprobs: z4.array(z4.number()),
1259
+ top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
1260
+ }).nullish()
1261
+ })
1262
+ ),
1263
+ usage: z4.object({
1264
+ prompt_tokens: z4.number(),
1265
+ completion_tokens: z4.number(),
1266
+ total_tokens: z4.number()
1267
+ }).nullish()
1268
+ }),
1269
+ openaiErrorDataSchema
1270
+ ])
1271
+ )
1272
+ );
1273
+
1181
1274
  // 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
- });
1275
+ import {
1276
+ lazyValidator as lazyValidator4,
1277
+ zodSchema as zodSchema4
1278
+ } from "@ai-sdk/provider-utils";
1279
+ import * as z5 from "zod/v4";
1280
+ var openaiCompletionProviderOptions = lazyValidator4(
1281
+ () => zodSchema4(
1282
+ z5.object({
1283
+ /**
1284
+ Echo back the prompt in addition to the completion.
1285
+ */
1286
+ echo: z5.boolean().optional(),
1287
+ /**
1288
+ Modify the likelihood of specified tokens appearing in the completion.
1289
+
1290
+ Accepts a JSON object that maps tokens (specified by their token ID in
1291
+ the GPT tokenizer) to an associated bias value from -100 to 100. You
1292
+ can use this tokenizer tool to convert text to token IDs. Mathematically,
1293
+ the bias is added to the logits generated by the model prior to sampling.
1294
+ The exact effect will vary per model, but values between -1 and 1 should
1295
+ decrease or increase likelihood of selection; values like -100 or 100
1296
+ should result in a ban or exclusive selection of the relevant token.
1297
+
1298
+ As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
1299
+ token from being generated.
1300
+ */
1301
+ logitBias: z5.record(z5.string(), z5.number()).optional(),
1302
+ /**
1303
+ The suffix that comes after a completion of inserted text.
1304
+ */
1305
+ suffix: z5.string().optional(),
1306
+ /**
1307
+ A unique identifier representing your end-user, which can help OpenAI to
1308
+ monitor and detect abuse. Learn more.
1309
+ */
1310
+ user: z5.string().optional(),
1311
+ /**
1312
+ Return the log probabilities of the tokens. Including logprobs will increase
1313
+ the response size and can slow down response times. However, it can
1314
+ be useful to better understand how the model is behaving.
1315
+ Setting to true will return the log probabilities of the tokens that
1316
+ were generated.
1317
+ Setting to a number will return the log probabilities of the top n
1318
+ tokens that were generated.
1319
+ */
1320
+ logprobs: z5.union([z5.boolean(), z5.number()]).optional()
1321
+ })
1322
+ )
1323
+ );
1223
1324
 
1224
1325
  // src/completion/openai-completion-language-model.ts
1225
1326
  var OpenAICompletionLanguageModel = class {
@@ -1450,49 +1551,6 @@ var OpenAICompletionLanguageModel = class {
1450
1551
  };
1451
1552
  }
1452
1553
  };
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
1554
 
1497
1555
  // src/embedding/openai-embedding-model.ts
1498
1556
  import {
@@ -1504,22 +1562,41 @@ import {
1504
1562
  parseProviderOptions as parseProviderOptions3,
1505
1563
  postJsonToApi as postJsonToApi3
1506
1564
  } from "@ai-sdk/provider-utils";
1507
- import { z as z7 } from "zod/v4";
1508
1565
 
1509
1566
  // 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
- });
1567
+ import {
1568
+ lazyValidator as lazyValidator5,
1569
+ zodSchema as zodSchema5
1570
+ } from "@ai-sdk/provider-utils";
1571
+ import * as z6 from "zod/v4";
1572
+ var openaiEmbeddingProviderOptions = lazyValidator5(
1573
+ () => zodSchema5(
1574
+ z6.object({
1575
+ /**
1576
+ The number of dimensions the resulting output embeddings should have.
1577
+ Only supported in text-embedding-3 and later models.
1578
+ */
1579
+ dimensions: z6.number().optional(),
1580
+ /**
1581
+ A unique identifier representing your end-user, which can help OpenAI to
1582
+ monitor and detect abuse. Learn more.
1583
+ */
1584
+ user: z6.string().optional()
1585
+ })
1586
+ )
1587
+ );
1588
+
1589
+ // src/embedding/openai-embedding-api.ts
1590
+ import { lazyValidator as lazyValidator6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
1591
+ import * as z7 from "zod/v4";
1592
+ var openaiTextEmbeddingResponseSchema = lazyValidator6(
1593
+ () => zodSchema6(
1594
+ z7.object({
1595
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1596
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1597
+ })
1598
+ )
1599
+ );
1523
1600
 
1524
1601
  // src/embedding/openai-embedding-model.ts
1525
1602
  var OpenAIEmbeddingModel = class {
@@ -1584,10 +1661,6 @@ var OpenAIEmbeddingModel = class {
1584
1661
  };
1585
1662
  }
1586
1663
  };
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
1664
 
1592
1665
  // src/image/openai-image-model.ts
1593
1666
  import {
@@ -1595,7 +1668,22 @@ import {
1595
1668
  createJsonResponseHandler as createJsonResponseHandler4,
1596
1669
  postJsonToApi as postJsonToApi4
1597
1670
  } from "@ai-sdk/provider-utils";
1598
- import { z as z8 } from "zod/v4";
1671
+
1672
+ // src/image/openai-image-api.ts
1673
+ import { lazyValidator as lazyValidator7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1674
+ import * as z8 from "zod/v4";
1675
+ var openaiImageResponseSchema = lazyValidator7(
1676
+ () => zodSchema7(
1677
+ z8.object({
1678
+ data: z8.array(
1679
+ z8.object({
1680
+ b64_json: z8.string(),
1681
+ revised_prompt: z8.string().optional()
1682
+ })
1683
+ )
1684
+ })
1685
+ )
1686
+ );
1599
1687
 
1600
1688
  // src/image/openai-image-options.ts
1601
1689
  var modelMaxImagesPerCall = {
@@ -1687,35 +1775,46 @@ var OpenAIImageModel = class {
1687
1775
  };
1688
1776
  }
1689
1777
  };
1690
- var openaiImageResponseSchema = z8.object({
1691
- data: z8.array(
1692
- z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
1693
- )
1694
- });
1695
1778
 
1696
1779
  // src/tool/code-interpreter.ts
1697
- import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
1698
- import { z as z9 } from "zod/v4";
1699
- var codeInterpreterInputSchema = z9.object({
1700
- code: z9.string().nullish(),
1701
- containerId: z9.string()
1702
- });
1703
- var codeInterpreterOutputSchema = z9.object({
1704
- outputs: z9.array(
1705
- z9.discriminatedUnion("type", [
1706
- z9.object({ type: z9.literal("logs"), logs: z9.string() }),
1707
- z9.object({ type: z9.literal("image"), url: z9.string() })
1708
- ])
1709
- ).nullish()
1710
- });
1711
- var codeInterpreterArgsSchema = z9.object({
1712
- container: z9.union([
1713
- z9.string(),
1780
+ import {
1781
+ createProviderDefinedToolFactoryWithOutputSchema,
1782
+ lazySchema,
1783
+ zodSchema as zodSchema8
1784
+ } from "@ai-sdk/provider-utils";
1785
+ import * as z9 from "zod/v4";
1786
+ var codeInterpreterInputSchema = lazySchema(
1787
+ () => zodSchema8(
1714
1788
  z9.object({
1715
- fileIds: z9.array(z9.string()).optional()
1789
+ code: z9.string().nullish(),
1790
+ containerId: z9.string()
1716
1791
  })
1717
- ]).optional()
1718
- });
1792
+ )
1793
+ );
1794
+ var codeInterpreterOutputSchema = lazySchema(
1795
+ () => zodSchema8(
1796
+ z9.object({
1797
+ outputs: z9.array(
1798
+ z9.discriminatedUnion("type", [
1799
+ z9.object({ type: z9.literal("logs"), logs: z9.string() }),
1800
+ z9.object({ type: z9.literal("image"), url: z9.string() })
1801
+ ])
1802
+ ).nullish()
1803
+ })
1804
+ )
1805
+ );
1806
+ var codeInterpreterArgsSchema = lazySchema(
1807
+ () => zodSchema8(
1808
+ z9.object({
1809
+ container: z9.union([
1810
+ z9.string(),
1811
+ z9.object({
1812
+ fileIds: z9.array(z9.string()).optional()
1813
+ })
1814
+ ]).optional()
1815
+ })
1816
+ )
1817
+ );
1719
1818
  var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
1720
1819
  id: "openai.code_interpreter",
1721
1820
  name: "code_interpreter",
@@ -1727,8 +1826,12 @@ var codeInterpreter = (args = {}) => {
1727
1826
  };
1728
1827
 
1729
1828
  // src/tool/file-search.ts
1730
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
1731
- import { z as z10 } from "zod/v4";
1829
+ import {
1830
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
1831
+ lazySchema as lazySchema2,
1832
+ zodSchema as zodSchema9
1833
+ } from "@ai-sdk/provider-utils";
1834
+ import * as z10 from "zod/v4";
1732
1835
  var comparisonFilterSchema = z10.object({
1733
1836
  key: z10.string(),
1734
1837
  type: z10.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
@@ -1740,27 +1843,35 @@ var compoundFilterSchema = z10.object({
1740
1843
  z10.union([comparisonFilterSchema, z10.lazy(() => compoundFilterSchema)])
1741
1844
  )
1742
1845
  });
1743
- var fileSearchArgsSchema = z10.object({
1744
- vectorStoreIds: z10.array(z10.string()),
1745
- maxNumResults: z10.number().optional(),
1746
- ranking: z10.object({
1747
- ranker: z10.string().optional(),
1748
- scoreThreshold: z10.number().optional()
1749
- }).optional(),
1750
- filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1751
- });
1752
- var fileSearchOutputSchema = z10.object({
1753
- queries: z10.array(z10.string()),
1754
- results: z10.array(
1846
+ var fileSearchArgsSchema = lazySchema2(
1847
+ () => zodSchema9(
1755
1848
  z10.object({
1756
- attributes: z10.record(z10.string(), z10.unknown()),
1757
- fileId: z10.string(),
1758
- filename: z10.string(),
1759
- score: z10.number(),
1760
- text: z10.string()
1849
+ vectorStoreIds: z10.array(z10.string()),
1850
+ maxNumResults: z10.number().optional(),
1851
+ ranking: z10.object({
1852
+ ranker: z10.string().optional(),
1853
+ scoreThreshold: z10.number().optional()
1854
+ }).optional(),
1855
+ filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
1761
1856
  })
1762
- ).nullable()
1763
- });
1857
+ )
1858
+ );
1859
+ var fileSearchOutputSchema = lazySchema2(
1860
+ () => zodSchema9(
1861
+ z10.object({
1862
+ queries: z10.array(z10.string()),
1863
+ results: z10.array(
1864
+ z10.object({
1865
+ attributes: z10.record(z10.string(), z10.unknown()),
1866
+ fileId: z10.string(),
1867
+ filename: z10.string(),
1868
+ score: z10.number(),
1869
+ text: z10.string()
1870
+ })
1871
+ ).nullable()
1872
+ })
1873
+ )
1874
+ );
1764
1875
  var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
1765
1876
  id: "openai.file_search",
1766
1877
  name: "file_search",
@@ -1769,29 +1880,39 @@ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
1769
1880
  });
1770
1881
 
1771
1882
  // src/tool/image-generation.ts
1772
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
1773
- import { z as z11 } from "zod/v4";
1774
- var imageGenerationArgsSchema = z11.object({
1775
- background: z11.enum(["auto", "opaque", "transparent"]).optional(),
1776
- inputFidelity: z11.enum(["low", "high"]).optional(),
1777
- inputImageMask: z11.object({
1778
- fileId: z11.string().optional(),
1779
- imageUrl: z11.string().optional()
1780
- }).optional(),
1781
- model: z11.string().optional(),
1782
- moderation: z11.enum(["auto"]).optional(),
1783
- outputCompression: z11.number().int().min(0).max(100).optional(),
1784
- outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
1785
- quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
1786
- size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1787
- }).strict();
1788
- var imageGenerationOutputSchema = z11.object({
1789
- result: z11.string()
1790
- });
1883
+ import {
1884
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
1885
+ lazySchema as lazySchema3,
1886
+ zodSchema as zodSchema10
1887
+ } from "@ai-sdk/provider-utils";
1888
+ import * as z11 from "zod/v4";
1889
+ var imageGenerationArgsSchema = lazySchema3(
1890
+ () => zodSchema10(
1891
+ z11.object({
1892
+ background: z11.enum(["auto", "opaque", "transparent"]).optional(),
1893
+ inputFidelity: z11.enum(["low", "high"]).optional(),
1894
+ inputImageMask: z11.object({
1895
+ fileId: z11.string().optional(),
1896
+ imageUrl: z11.string().optional()
1897
+ }).optional(),
1898
+ model: z11.string().optional(),
1899
+ moderation: z11.enum(["auto"]).optional(),
1900
+ outputCompression: z11.number().int().min(0).max(100).optional(),
1901
+ outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
1902
+ partialImages: z11.number().int().min(0).max(3).optional(),
1903
+ quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
1904
+ size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1905
+ }).strict()
1906
+ )
1907
+ );
1908
+ var imageGenerationInputSchema = lazySchema3(() => zodSchema10(z11.object({})));
1909
+ var imageGenerationOutputSchema = lazySchema3(
1910
+ () => zodSchema10(z11.object({ result: z11.string() }))
1911
+ );
1791
1912
  var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
1792
1913
  id: "openai.image_generation",
1793
1914
  name: "image_generation",
1794
- inputSchema: z11.object({}),
1915
+ inputSchema: imageGenerationInputSchema,
1795
1916
  outputSchema: imageGenerationOutputSchema
1796
1917
  });
1797
1918
  var imageGeneration = (args = {}) => {
@@ -1799,21 +1920,29 @@ var imageGeneration = (args = {}) => {
1799
1920
  };
1800
1921
 
1801
1922
  // src/tool/local-shell.ts
1802
- import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4 } from "@ai-sdk/provider-utils";
1803
- import { z as z12 } from "zod/v4";
1804
- var localShellInputSchema = z12.object({
1805
- action: z12.object({
1806
- type: z12.literal("exec"),
1807
- command: z12.array(z12.string()),
1808
- timeoutMs: z12.number().optional(),
1809
- user: z12.string().optional(),
1810
- workingDirectory: z12.string().optional(),
1811
- env: z12.record(z12.string(), z12.string()).optional()
1812
- })
1813
- });
1814
- var localShellOutputSchema = z12.object({
1815
- output: z12.string()
1816
- });
1923
+ import {
1924
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
1925
+ lazySchema as lazySchema4,
1926
+ zodSchema as zodSchema11
1927
+ } from "@ai-sdk/provider-utils";
1928
+ import * as z12 from "zod/v4";
1929
+ var localShellInputSchema = lazySchema4(
1930
+ () => zodSchema11(
1931
+ z12.object({
1932
+ action: z12.object({
1933
+ type: z12.literal("exec"),
1934
+ command: z12.array(z12.string()),
1935
+ timeoutMs: z12.number().optional(),
1936
+ user: z12.string().optional(),
1937
+ workingDirectory: z12.string().optional(),
1938
+ env: z12.record(z12.string(), z12.string()).optional()
1939
+ })
1940
+ })
1941
+ )
1942
+ );
1943
+ var localShellOutputSchema = lazySchema4(
1944
+ () => zodSchema11(z12.object({ output: z12.string() }))
1945
+ );
1817
1946
  var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
1818
1947
  id: "openai.local_shell",
1819
1948
  name: "local_shell",
@@ -1822,103 +1951,129 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
1822
1951
  });
1823
1952
 
1824
1953
  // src/tool/web-search.ts
1825
- import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
1826
- import { z as z13 } from "zod/v4";
1827
- var webSearchArgsSchema = z13.object({
1828
- filters: z13.object({
1829
- allowedDomains: z13.array(z13.string()).optional()
1830
- }).optional(),
1831
- searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1832
- userLocation: z13.object({
1833
- type: z13.literal("approximate"),
1834
- country: z13.string().optional(),
1835
- city: z13.string().optional(),
1836
- region: z13.string().optional(),
1837
- timezone: z13.string().optional()
1838
- }).optional()
1839
- });
1954
+ import {
1955
+ createProviderDefinedToolFactory,
1956
+ lazySchema as lazySchema5,
1957
+ zodSchema as zodSchema12
1958
+ } from "@ai-sdk/provider-utils";
1959
+ import * as z13 from "zod/v4";
1960
+ var webSearchArgsSchema = lazySchema5(
1961
+ () => zodSchema12(
1962
+ z13.object({
1963
+ filters: z13.object({
1964
+ allowedDomains: z13.array(z13.string()).optional()
1965
+ }).optional(),
1966
+ searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1967
+ userLocation: z13.object({
1968
+ type: z13.literal("approximate"),
1969
+ country: z13.string().optional(),
1970
+ city: z13.string().optional(),
1971
+ region: z13.string().optional(),
1972
+ timezone: z13.string().optional()
1973
+ }).optional()
1974
+ })
1975
+ )
1976
+ );
1977
+ var webSearchInputSchema = lazySchema5(
1978
+ () => zodSchema12(
1979
+ z13.object({
1980
+ action: z13.discriminatedUnion("type", [
1981
+ z13.object({
1982
+ type: z13.literal("search"),
1983
+ query: z13.string().nullish()
1984
+ }),
1985
+ z13.object({
1986
+ type: z13.literal("open_page"),
1987
+ url: z13.string()
1988
+ }),
1989
+ z13.object({
1990
+ type: z13.literal("find"),
1991
+ url: z13.string(),
1992
+ pattern: z13.string()
1993
+ })
1994
+ ]).nullish()
1995
+ })
1996
+ )
1997
+ );
1840
1998
  var webSearchToolFactory = createProviderDefinedToolFactory({
1841
1999
  id: "openai.web_search",
1842
2000
  name: "web_search",
1843
- inputSchema: z13.object({
1844
- action: z13.discriminatedUnion("type", [
1845
- z13.object({
1846
- type: z13.literal("search"),
1847
- query: z13.string().nullish()
1848
- }),
1849
- z13.object({
1850
- type: z13.literal("open_page"),
1851
- url: z13.string()
1852
- }),
1853
- z13.object({
1854
- type: z13.literal("find"),
1855
- url: z13.string(),
1856
- pattern: z13.string()
1857
- })
1858
- ]).nullish()
1859
- })
2001
+ inputSchema: webSearchInputSchema
1860
2002
  });
1861
2003
  var webSearch = (args = {}) => {
1862
2004
  return webSearchToolFactory(args);
1863
2005
  };
1864
2006
 
1865
2007
  // src/tool/web-search-preview.ts
1866
- import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
1867
- import { z as z14 } from "zod/v4";
1868
- var webSearchPreviewArgsSchema = z14.object({
1869
- /**
1870
- * Search context size to use for the web search.
1871
- * - high: Most comprehensive context, highest cost, slower response
1872
- * - medium: Balanced context, cost, and latency (default)
1873
- * - low: Least context, lowest cost, fastest response
1874
- */
1875
- searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
1876
- /**
1877
- * User location information to provide geographically relevant search results.
1878
- */
1879
- userLocation: z14.object({
1880
- /**
1881
- * Type of location (always 'approximate')
1882
- */
1883
- type: z14.literal("approximate"),
1884
- /**
1885
- * Two-letter ISO country code (e.g., 'US', 'GB')
1886
- */
1887
- country: z14.string().optional(),
1888
- /**
1889
- * City name (free text, e.g., 'Minneapolis')
1890
- */
1891
- city: z14.string().optional(),
1892
- /**
1893
- * Region name (free text, e.g., 'Minnesota')
1894
- */
1895
- region: z14.string().optional(),
1896
- /**
1897
- * IANA timezone (e.g., 'America/Chicago')
1898
- */
1899
- timezone: z14.string().optional()
1900
- }).optional()
1901
- });
2008
+ import {
2009
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
2010
+ lazySchema as lazySchema6,
2011
+ zodSchema as zodSchema13
2012
+ } from "@ai-sdk/provider-utils";
2013
+ import * as z14 from "zod/v4";
2014
+ var webSearchPreviewArgsSchema = lazySchema6(
2015
+ () => zodSchema13(
2016
+ z14.object({
2017
+ /**
2018
+ * Search context size to use for the web search.
2019
+ * - high: Most comprehensive context, highest cost, slower response
2020
+ * - medium: Balanced context, cost, and latency (default)
2021
+ * - low: Least context, lowest cost, fastest response
2022
+ */
2023
+ searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
2024
+ /**
2025
+ * User location information to provide geographically relevant search results.
2026
+ */
2027
+ userLocation: z14.object({
2028
+ /**
2029
+ * Type of location (always 'approximate')
2030
+ */
2031
+ type: z14.literal("approximate"),
2032
+ /**
2033
+ * Two-letter ISO country code (e.g., 'US', 'GB')
2034
+ */
2035
+ country: z14.string().optional(),
2036
+ /**
2037
+ * City name (free text, e.g., 'Minneapolis')
2038
+ */
2039
+ city: z14.string().optional(),
2040
+ /**
2041
+ * Region name (free text, e.g., 'Minnesota')
2042
+ */
2043
+ region: z14.string().optional(),
2044
+ /**
2045
+ * IANA timezone (e.g., 'America/Chicago')
2046
+ */
2047
+ timezone: z14.string().optional()
2048
+ }).optional()
2049
+ })
2050
+ )
2051
+ );
2052
+ var webSearchPreviewInputSchema = lazySchema6(
2053
+ () => zodSchema13(
2054
+ z14.object({
2055
+ action: z14.discriminatedUnion("type", [
2056
+ z14.object({
2057
+ type: z14.literal("search"),
2058
+ query: z14.string().nullish()
2059
+ }),
2060
+ z14.object({
2061
+ type: z14.literal("open_page"),
2062
+ url: z14.string()
2063
+ }),
2064
+ z14.object({
2065
+ type: z14.literal("find"),
2066
+ url: z14.string(),
2067
+ pattern: z14.string()
2068
+ })
2069
+ ]).nullish()
2070
+ })
2071
+ )
2072
+ );
1902
2073
  var webSearchPreview = createProviderDefinedToolFactory2({
1903
2074
  id: "openai.web_search_preview",
1904
2075
  name: "web_search_preview",
1905
- inputSchema: z14.object({
1906
- action: z14.discriminatedUnion("type", [
1907
- z14.object({
1908
- type: z14.literal("search"),
1909
- query: z14.string().nullish()
1910
- }),
1911
- z14.object({
1912
- type: z14.literal("open_page"),
1913
- url: z14.string()
1914
- }),
1915
- z14.object({
1916
- type: z14.literal("find"),
1917
- url: z14.string(),
1918
- pattern: z14.string()
1919
- })
1920
- ]).nullish()
1921
- })
2076
+ inputSchema: webSearchPreviewInputSchema
1922
2077
  });
1923
2078
 
1924
2079
  // src/openai-tools.ts
@@ -2006,14 +2161,17 @@ import {
2006
2161
  parseProviderOptions as parseProviderOptions5,
2007
2162
  postJsonToApi as postJsonToApi5
2008
2163
  } from "@ai-sdk/provider-utils";
2009
- import { z as z16 } from "zod/v4";
2010
2164
 
2011
2165
  // src/responses/convert-to-openai-responses-input.ts
2012
2166
  import {
2013
2167
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2014
2168
  } from "@ai-sdk/provider";
2015
- import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
2016
- import { z as z15 } from "zod/v4";
2169
+ import {
2170
+ convertToBase64 as convertToBase642,
2171
+ parseProviderOptions as parseProviderOptions4,
2172
+ validateTypes
2173
+ } from "@ai-sdk/provider-utils";
2174
+ import * as z15 from "zod/v4";
2017
2175
  function isFileId(data, prefixes) {
2018
2176
  if (!prefixes) return false;
2019
2177
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2119,7 +2277,10 @@ async function convertToOpenAIResponsesInput({
2119
2277
  break;
2120
2278
  }
2121
2279
  if (hasLocalShellTool && part.toolName === "local_shell") {
2122
- const parsedInput = localShellInputSchema.parse(part.input);
2280
+ const parsedInput = await validateTypes({
2281
+ value: part.input,
2282
+ schema: localShellInputSchema
2283
+ });
2123
2284
  input.push({
2124
2285
  type: "local_shell_call",
2125
2286
  call_id: part.toolCallId,
@@ -2215,10 +2376,14 @@ async function convertToOpenAIResponsesInput({
2215
2376
  for (const part of content) {
2216
2377
  const output = part.output;
2217
2378
  if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2379
+ const parsedOutput = await validateTypes({
2380
+ value: output.value,
2381
+ schema: localShellOutputSchema
2382
+ });
2218
2383
  input.push({
2219
2384
  type: "local_shell_call_output",
2220
2385
  call_id: part.toolCallId,
2221
- output: localShellOutputSchema.parse(output.value).output
2386
+ output: parsedOutput.output
2222
2387
  });
2223
2388
  break;
2224
2389
  }
@@ -2273,11 +2438,547 @@ function mapOpenAIResponseFinishReason({
2273
2438
  }
2274
2439
  }
2275
2440
 
2441
+ // src/responses/openai-responses-api.ts
2442
+ import {
2443
+ lazyValidator as lazyValidator8,
2444
+ zodSchema as zodSchema14
2445
+ } from "@ai-sdk/provider-utils";
2446
+ import * as z16 from "zod/v4";
2447
+ var openaiResponsesChunkSchema = lazyValidator8(
2448
+ () => zodSchema14(
2449
+ z16.union([
2450
+ z16.object({
2451
+ type: z16.literal("response.output_text.delta"),
2452
+ item_id: z16.string(),
2453
+ delta: z16.string(),
2454
+ logprobs: z16.array(
2455
+ z16.object({
2456
+ token: z16.string(),
2457
+ logprob: z16.number(),
2458
+ top_logprobs: z16.array(
2459
+ z16.object({
2460
+ token: z16.string(),
2461
+ logprob: z16.number()
2462
+ })
2463
+ )
2464
+ })
2465
+ ).nullish()
2466
+ }),
2467
+ z16.object({
2468
+ type: z16.enum(["response.completed", "response.incomplete"]),
2469
+ response: z16.object({
2470
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2471
+ usage: z16.object({
2472
+ input_tokens: z16.number(),
2473
+ input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
2474
+ output_tokens: z16.number(),
2475
+ output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
2476
+ }),
2477
+ service_tier: z16.string().nullish()
2478
+ })
2479
+ }),
2480
+ z16.object({
2481
+ type: z16.literal("response.created"),
2482
+ response: z16.object({
2483
+ id: z16.string(),
2484
+ created_at: z16.number(),
2485
+ model: z16.string(),
2486
+ service_tier: z16.string().nullish()
2487
+ })
2488
+ }),
2489
+ z16.object({
2490
+ type: z16.literal("response.output_item.added"),
2491
+ output_index: z16.number(),
2492
+ item: z16.discriminatedUnion("type", [
2493
+ z16.object({
2494
+ type: z16.literal("message"),
2495
+ id: z16.string()
2496
+ }),
2497
+ z16.object({
2498
+ type: z16.literal("reasoning"),
2499
+ id: z16.string(),
2500
+ encrypted_content: z16.string().nullish()
2501
+ }),
2502
+ z16.object({
2503
+ type: z16.literal("function_call"),
2504
+ id: z16.string(),
2505
+ call_id: z16.string(),
2506
+ name: z16.string(),
2507
+ arguments: z16.string()
2508
+ }),
2509
+ z16.object({
2510
+ type: z16.literal("web_search_call"),
2511
+ id: z16.string(),
2512
+ status: z16.string(),
2513
+ action: z16.object({
2514
+ type: z16.literal("search"),
2515
+ query: z16.string().optional()
2516
+ }).nullish()
2517
+ }),
2518
+ z16.object({
2519
+ type: z16.literal("computer_call"),
2520
+ id: z16.string(),
2521
+ status: z16.string()
2522
+ }),
2523
+ z16.object({
2524
+ type: z16.literal("file_search_call"),
2525
+ id: z16.string()
2526
+ }),
2527
+ z16.object({
2528
+ type: z16.literal("image_generation_call"),
2529
+ id: z16.string()
2530
+ }),
2531
+ z16.object({
2532
+ type: z16.literal("code_interpreter_call"),
2533
+ id: z16.string(),
2534
+ container_id: z16.string(),
2535
+ code: z16.string().nullable(),
2536
+ outputs: z16.array(
2537
+ z16.discriminatedUnion("type", [
2538
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2539
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2540
+ ])
2541
+ ).nullable(),
2542
+ status: z16.string()
2543
+ })
2544
+ ])
2545
+ }),
2546
+ z16.object({
2547
+ type: z16.literal("response.output_item.done"),
2548
+ output_index: z16.number(),
2549
+ item: z16.discriminatedUnion("type", [
2550
+ z16.object({
2551
+ type: z16.literal("message"),
2552
+ id: z16.string()
2553
+ }),
2554
+ z16.object({
2555
+ type: z16.literal("reasoning"),
2556
+ id: z16.string(),
2557
+ encrypted_content: z16.string().nullish()
2558
+ }),
2559
+ z16.object({
2560
+ type: z16.literal("function_call"),
2561
+ id: z16.string(),
2562
+ call_id: z16.string(),
2563
+ name: z16.string(),
2564
+ arguments: z16.string(),
2565
+ status: z16.literal("completed")
2566
+ }),
2567
+ z16.object({
2568
+ type: z16.literal("code_interpreter_call"),
2569
+ id: z16.string(),
2570
+ code: z16.string().nullable(),
2571
+ container_id: z16.string(),
2572
+ outputs: z16.array(
2573
+ z16.discriminatedUnion("type", [
2574
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2575
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2576
+ ])
2577
+ ).nullable()
2578
+ }),
2579
+ z16.object({
2580
+ type: z16.literal("image_generation_call"),
2581
+ id: z16.string(),
2582
+ result: z16.string()
2583
+ }),
2584
+ z16.object({
2585
+ type: z16.literal("web_search_call"),
2586
+ id: z16.string(),
2587
+ status: z16.string(),
2588
+ action: z16.discriminatedUnion("type", [
2589
+ z16.object({
2590
+ type: z16.literal("search"),
2591
+ query: z16.string().nullish()
2592
+ }),
2593
+ z16.object({
2594
+ type: z16.literal("open_page"),
2595
+ url: z16.string()
2596
+ }),
2597
+ z16.object({
2598
+ type: z16.literal("find"),
2599
+ url: z16.string(),
2600
+ pattern: z16.string()
2601
+ })
2602
+ ]).nullish()
2603
+ }),
2604
+ z16.object({
2605
+ type: z16.literal("file_search_call"),
2606
+ id: z16.string(),
2607
+ queries: z16.array(z16.string()),
2608
+ results: z16.array(
2609
+ z16.object({
2610
+ attributes: z16.record(z16.string(), z16.unknown()),
2611
+ file_id: z16.string(),
2612
+ filename: z16.string(),
2613
+ score: z16.number(),
2614
+ text: z16.string()
2615
+ })
2616
+ ).nullish()
2617
+ }),
2618
+ z16.object({
2619
+ type: z16.literal("local_shell_call"),
2620
+ id: z16.string(),
2621
+ call_id: z16.string(),
2622
+ action: z16.object({
2623
+ type: z16.literal("exec"),
2624
+ command: z16.array(z16.string()),
2625
+ timeout_ms: z16.number().optional(),
2626
+ user: z16.string().optional(),
2627
+ working_directory: z16.string().optional(),
2628
+ env: z16.record(z16.string(), z16.string()).optional()
2629
+ })
2630
+ }),
2631
+ z16.object({
2632
+ type: z16.literal("computer_call"),
2633
+ id: z16.string(),
2634
+ status: z16.literal("completed")
2635
+ })
2636
+ ])
2637
+ }),
2638
+ z16.object({
2639
+ type: z16.literal("response.function_call_arguments.delta"),
2640
+ item_id: z16.string(),
2641
+ output_index: z16.number(),
2642
+ delta: z16.string()
2643
+ }),
2644
+ z16.object({
2645
+ type: z16.literal("response.image_generation_call.partial_image"),
2646
+ item_id: z16.string(),
2647
+ output_index: z16.number(),
2648
+ partial_image_b64: z16.string()
2649
+ }),
2650
+ z16.object({
2651
+ type: z16.literal("response.code_interpreter_call_code.delta"),
2652
+ item_id: z16.string(),
2653
+ output_index: z16.number(),
2654
+ delta: z16.string()
2655
+ }),
2656
+ z16.object({
2657
+ type: z16.literal("response.code_interpreter_call_code.done"),
2658
+ item_id: z16.string(),
2659
+ output_index: z16.number(),
2660
+ code: z16.string()
2661
+ }),
2662
+ z16.object({
2663
+ type: z16.literal("response.output_text.annotation.added"),
2664
+ annotation: z16.discriminatedUnion("type", [
2665
+ z16.object({
2666
+ type: z16.literal("url_citation"),
2667
+ url: z16.string(),
2668
+ title: z16.string()
2669
+ }),
2670
+ z16.object({
2671
+ type: z16.literal("file_citation"),
2672
+ file_id: z16.string(),
2673
+ filename: z16.string().nullish(),
2674
+ index: z16.number().nullish(),
2675
+ start_index: z16.number().nullish(),
2676
+ end_index: z16.number().nullish(),
2677
+ quote: z16.string().nullish()
2678
+ })
2679
+ ])
2680
+ }),
2681
+ z16.object({
2682
+ type: z16.literal("response.reasoning_summary_part.added"),
2683
+ item_id: z16.string(),
2684
+ summary_index: z16.number()
2685
+ }),
2686
+ z16.object({
2687
+ type: z16.literal("response.reasoning_summary_text.delta"),
2688
+ item_id: z16.string(),
2689
+ summary_index: z16.number(),
2690
+ delta: z16.string()
2691
+ }),
2692
+ z16.object({
2693
+ type: z16.literal("error"),
2694
+ code: z16.string(),
2695
+ message: z16.string(),
2696
+ param: z16.string().nullish(),
2697
+ sequence_number: z16.number()
2698
+ }),
2699
+ z16.object({ type: z16.string() }).loose().transform((value) => ({
2700
+ type: "unknown_chunk",
2701
+ message: value.type
2702
+ }))
2703
+ // fallback for unknown chunks
2704
+ ])
2705
+ )
2706
+ );
2707
+ var openaiResponsesResponseSchema = lazyValidator8(
2708
+ () => zodSchema14(
2709
+ z16.object({
2710
+ id: z16.string(),
2711
+ created_at: z16.number(),
2712
+ error: z16.object({
2713
+ code: z16.string(),
2714
+ message: z16.string()
2715
+ }).nullish(),
2716
+ model: z16.string(),
2717
+ output: z16.array(
2718
+ z16.discriminatedUnion("type", [
2719
+ z16.object({
2720
+ type: z16.literal("message"),
2721
+ role: z16.literal("assistant"),
2722
+ id: z16.string(),
2723
+ content: z16.array(
2724
+ z16.object({
2725
+ type: z16.literal("output_text"),
2726
+ text: z16.string(),
2727
+ logprobs: z16.array(
2728
+ z16.object({
2729
+ token: z16.string(),
2730
+ logprob: z16.number(),
2731
+ top_logprobs: z16.array(
2732
+ z16.object({
2733
+ token: z16.string(),
2734
+ logprob: z16.number()
2735
+ })
2736
+ )
2737
+ })
2738
+ ).nullish(),
2739
+ annotations: z16.array(
2740
+ z16.discriminatedUnion("type", [
2741
+ z16.object({
2742
+ type: z16.literal("url_citation"),
2743
+ start_index: z16.number(),
2744
+ end_index: z16.number(),
2745
+ url: z16.string(),
2746
+ title: z16.string()
2747
+ }),
2748
+ z16.object({
2749
+ type: z16.literal("file_citation"),
2750
+ file_id: z16.string(),
2751
+ filename: z16.string().nullish(),
2752
+ index: z16.number().nullish(),
2753
+ start_index: z16.number().nullish(),
2754
+ end_index: z16.number().nullish(),
2755
+ quote: z16.string().nullish()
2756
+ }),
2757
+ z16.object({
2758
+ type: z16.literal("container_file_citation")
2759
+ })
2760
+ ])
2761
+ )
2762
+ })
2763
+ )
2764
+ }),
2765
+ z16.object({
2766
+ type: z16.literal("web_search_call"),
2767
+ id: z16.string(),
2768
+ status: z16.string(),
2769
+ action: z16.discriminatedUnion("type", [
2770
+ z16.object({
2771
+ type: z16.literal("search"),
2772
+ query: z16.string().nullish()
2773
+ }),
2774
+ z16.object({
2775
+ type: z16.literal("open_page"),
2776
+ url: z16.string()
2777
+ }),
2778
+ z16.object({
2779
+ type: z16.literal("find"),
2780
+ url: z16.string(),
2781
+ pattern: z16.string()
2782
+ })
2783
+ ]).nullish()
2784
+ }),
2785
+ z16.object({
2786
+ type: z16.literal("file_search_call"),
2787
+ id: z16.string(),
2788
+ queries: z16.array(z16.string()),
2789
+ results: z16.array(
2790
+ z16.object({
2791
+ attributes: z16.record(z16.string(), z16.unknown()),
2792
+ file_id: z16.string(),
2793
+ filename: z16.string(),
2794
+ score: z16.number(),
2795
+ text: z16.string()
2796
+ })
2797
+ ).nullish()
2798
+ }),
2799
+ z16.object({
2800
+ type: z16.literal("code_interpreter_call"),
2801
+ id: z16.string(),
2802
+ code: z16.string().nullable(),
2803
+ container_id: z16.string(),
2804
+ outputs: z16.array(
2805
+ z16.discriminatedUnion("type", [
2806
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2807
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2808
+ ])
2809
+ ).nullable()
2810
+ }),
2811
+ z16.object({
2812
+ type: z16.literal("image_generation_call"),
2813
+ id: z16.string(),
2814
+ result: z16.string()
2815
+ }),
2816
+ z16.object({
2817
+ type: z16.literal("local_shell_call"),
2818
+ id: z16.string(),
2819
+ call_id: z16.string(),
2820
+ action: z16.object({
2821
+ type: z16.literal("exec"),
2822
+ command: z16.array(z16.string()),
2823
+ timeout_ms: z16.number().optional(),
2824
+ user: z16.string().optional(),
2825
+ working_directory: z16.string().optional(),
2826
+ env: z16.record(z16.string(), z16.string()).optional()
2827
+ })
2828
+ }),
2829
+ z16.object({
2830
+ type: z16.literal("function_call"),
2831
+ call_id: z16.string(),
2832
+ name: z16.string(),
2833
+ arguments: z16.string(),
2834
+ id: z16.string()
2835
+ }),
2836
+ z16.object({
2837
+ type: z16.literal("computer_call"),
2838
+ id: z16.string(),
2839
+ status: z16.string().optional()
2840
+ }),
2841
+ z16.object({
2842
+ type: z16.literal("reasoning"),
2843
+ id: z16.string(),
2844
+ encrypted_content: z16.string().nullish(),
2845
+ summary: z16.array(
2846
+ z16.object({
2847
+ type: z16.literal("summary_text"),
2848
+ text: z16.string()
2849
+ })
2850
+ )
2851
+ })
2852
+ ])
2853
+ ),
2854
+ service_tier: z16.string().nullish(),
2855
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2856
+ usage: z16.object({
2857
+ input_tokens: z16.number(),
2858
+ input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
2859
+ output_tokens: z16.number(),
2860
+ output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
2861
+ })
2862
+ })
2863
+ )
2864
+ );
2865
+
2866
+ // src/responses/openai-responses-options.ts
2867
+ import {
2868
+ lazyValidator as lazyValidator9,
2869
+ zodSchema as zodSchema15
2870
+ } from "@ai-sdk/provider-utils";
2871
+ import * as z17 from "zod/v4";
2872
+ var TOP_LOGPROBS_MAX = 20;
2873
+ var openaiResponsesReasoningModelIds = [
2874
+ "o1",
2875
+ "o1-2024-12-17",
2876
+ "o3-mini",
2877
+ "o3-mini-2025-01-31",
2878
+ "o3",
2879
+ "o3-2025-04-16",
2880
+ "o4-mini",
2881
+ "o4-mini-2025-04-16",
2882
+ "codex-mini-latest",
2883
+ "computer-use-preview",
2884
+ "gpt-5",
2885
+ "gpt-5-2025-08-07",
2886
+ "gpt-5-codex",
2887
+ "gpt-5-mini",
2888
+ "gpt-5-mini-2025-08-07",
2889
+ "gpt-5-nano",
2890
+ "gpt-5-nano-2025-08-07",
2891
+ "gpt-5-pro",
2892
+ "gpt-5-pro-2025-10-06"
2893
+ ];
2894
+ var openaiResponsesModelIds = [
2895
+ "gpt-4.1",
2896
+ "gpt-4.1-2025-04-14",
2897
+ "gpt-4.1-mini",
2898
+ "gpt-4.1-mini-2025-04-14",
2899
+ "gpt-4.1-nano",
2900
+ "gpt-4.1-nano-2025-04-14",
2901
+ "gpt-4o",
2902
+ "gpt-4o-2024-05-13",
2903
+ "gpt-4o-2024-08-06",
2904
+ "gpt-4o-2024-11-20",
2905
+ "gpt-4o-audio-preview",
2906
+ "gpt-4o-audio-preview-2024-10-01",
2907
+ "gpt-4o-audio-preview-2024-12-17",
2908
+ "gpt-4o-search-preview",
2909
+ "gpt-4o-search-preview-2025-03-11",
2910
+ "gpt-4o-mini-search-preview",
2911
+ "gpt-4o-mini-search-preview-2025-03-11",
2912
+ "gpt-4o-mini",
2913
+ "gpt-4o-mini-2024-07-18",
2914
+ "gpt-4-turbo",
2915
+ "gpt-4-turbo-2024-04-09",
2916
+ "gpt-4-turbo-preview",
2917
+ "gpt-4-0125-preview",
2918
+ "gpt-4-1106-preview",
2919
+ "gpt-4",
2920
+ "gpt-4-0613",
2921
+ "gpt-4.5-preview",
2922
+ "gpt-4.5-preview-2025-02-27",
2923
+ "gpt-3.5-turbo-0125",
2924
+ "gpt-3.5-turbo",
2925
+ "gpt-3.5-turbo-1106",
2926
+ "chatgpt-4o-latest",
2927
+ "gpt-5-chat-latest",
2928
+ ...openaiResponsesReasoningModelIds
2929
+ ];
2930
+ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2931
+ () => zodSchema15(
2932
+ z17.object({
2933
+ include: z17.array(
2934
+ z17.enum([
2935
+ "reasoning.encrypted_content",
2936
+ "file_search_call.results",
2937
+ "message.output_text.logprobs"
2938
+ ])
2939
+ ).nullish(),
2940
+ instructions: z17.string().nullish(),
2941
+ /**
2942
+ * Return the log probabilities of the tokens.
2943
+ *
2944
+ * Setting to true will return the log probabilities of the tokens that
2945
+ * were generated.
2946
+ *
2947
+ * Setting to a number will return the log probabilities of the top n
2948
+ * tokens that were generated.
2949
+ *
2950
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2951
+ * @see https://cookbook.openai.com/examples/using_logprobs
2952
+ */
2953
+ logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2954
+ /**
2955
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2956
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2957
+ * Any further attempts to call a tool by the model will be ignored.
2958
+ */
2959
+ maxToolCalls: z17.number().nullish(),
2960
+ metadata: z17.any().nullish(),
2961
+ parallelToolCalls: z17.boolean().nullish(),
2962
+ previousResponseId: z17.string().nullish(),
2963
+ promptCacheKey: z17.string().nullish(),
2964
+ reasoningEffort: z17.string().nullish(),
2965
+ reasoningSummary: z17.string().nullish(),
2966
+ safetyIdentifier: z17.string().nullish(),
2967
+ serviceTier: z17.enum(["auto", "flex", "priority"]).nullish(),
2968
+ store: z17.boolean().nullish(),
2969
+ strictJsonSchema: z17.boolean().nullish(),
2970
+ textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
2971
+ user: z17.string().nullish()
2972
+ })
2973
+ )
2974
+ );
2975
+
2276
2976
  // src/responses/openai-responses-prepare-tools.ts
2277
2977
  import {
2278
2978
  UnsupportedFunctionalityError as UnsupportedFunctionalityError5
2279
2979
  } from "@ai-sdk/provider";
2280
- function prepareResponsesTools({
2980
+ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
2981
+ async function prepareResponsesTools({
2281
2982
  tools,
2282
2983
  toolChoice,
2283
2984
  strictJsonSchema
@@ -2302,7 +3003,10 @@ function prepareResponsesTools({
2302
3003
  case "provider-defined": {
2303
3004
  switch (tool.id) {
2304
3005
  case "openai.file_search": {
2305
- const args = fileSearchArgsSchema.parse(tool.args);
3006
+ const args = await validateTypes2({
3007
+ value: tool.args,
3008
+ schema: fileSearchArgsSchema
3009
+ });
2306
3010
  openaiTools2.push({
2307
3011
  type: "file_search",
2308
3012
  vector_store_ids: args.vectorStoreIds,
@@ -2322,7 +3026,10 @@ function prepareResponsesTools({
2322
3026
  break;
2323
3027
  }
2324
3028
  case "openai.web_search_preview": {
2325
- const args = webSearchPreviewArgsSchema.parse(tool.args);
3029
+ const args = await validateTypes2({
3030
+ value: tool.args,
3031
+ schema: webSearchPreviewArgsSchema
3032
+ });
2326
3033
  openaiTools2.push({
2327
3034
  type: "web_search_preview",
2328
3035
  search_context_size: args.searchContextSize,
@@ -2331,7 +3038,10 @@ function prepareResponsesTools({
2331
3038
  break;
2332
3039
  }
2333
3040
  case "openai.web_search": {
2334
- const args = webSearchArgsSchema.parse(tool.args);
3041
+ const args = await validateTypes2({
3042
+ value: tool.args,
3043
+ schema: webSearchArgsSchema
3044
+ });
2335
3045
  openaiTools2.push({
2336
3046
  type: "web_search",
2337
3047
  filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
@@ -2341,7 +3051,10 @@ function prepareResponsesTools({
2341
3051
  break;
2342
3052
  }
2343
3053
  case "openai.code_interpreter": {
2344
- const args = codeInterpreterArgsSchema.parse(tool.args);
3054
+ const args = await validateTypes2({
3055
+ value: tool.args,
3056
+ schema: codeInterpreterArgsSchema
3057
+ });
2345
3058
  openaiTools2.push({
2346
3059
  type: "code_interpreter",
2347
3060
  container: args.container == null ? { type: "auto", file_ids: void 0 } : typeof args.container === "string" ? args.container : { type: "auto", file_ids: args.container.fileIds }
@@ -2349,7 +3062,10 @@ function prepareResponsesTools({
2349
3062
  break;
2350
3063
  }
2351
3064
  case "openai.image_generation": {
2352
- const args = imageGenerationArgsSchema.parse(tool.args);
3065
+ const args = await validateTypes2({
3066
+ value: tool.args,
3067
+ schema: imageGenerationArgsSchema
3068
+ });
2353
3069
  openaiTools2.push({
2354
3070
  type: "image_generation",
2355
3071
  background: args.background,
@@ -2400,83 +3116,6 @@ function prepareResponsesTools({
2400
3116
  }
2401
3117
 
2402
3118
  // src/responses/openai-responses-language-model.ts
2403
- var webSearchCallItem = z16.object({
2404
- type: z16.literal("web_search_call"),
2405
- id: z16.string(),
2406
- status: z16.string(),
2407
- action: z16.discriminatedUnion("type", [
2408
- z16.object({
2409
- type: z16.literal("search"),
2410
- query: z16.string().nullish()
2411
- }),
2412
- z16.object({
2413
- type: z16.literal("open_page"),
2414
- url: z16.string()
2415
- }),
2416
- z16.object({
2417
- type: z16.literal("find"),
2418
- url: z16.string(),
2419
- pattern: z16.string()
2420
- })
2421
- ]).nullish()
2422
- });
2423
- var fileSearchCallItem = z16.object({
2424
- type: z16.literal("file_search_call"),
2425
- id: z16.string(),
2426
- queries: z16.array(z16.string()),
2427
- results: z16.array(
2428
- z16.object({
2429
- attributes: z16.record(z16.string(), z16.unknown()),
2430
- file_id: z16.string(),
2431
- filename: z16.string(),
2432
- score: z16.number(),
2433
- text: z16.string()
2434
- })
2435
- ).nullish()
2436
- });
2437
- var codeInterpreterCallItem = z16.object({
2438
- type: z16.literal("code_interpreter_call"),
2439
- id: z16.string(),
2440
- code: z16.string().nullable(),
2441
- container_id: z16.string(),
2442
- outputs: z16.array(
2443
- z16.discriminatedUnion("type", [
2444
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
2445
- z16.object({ type: z16.literal("image"), url: z16.string() })
2446
- ])
2447
- ).nullable()
2448
- });
2449
- var localShellCallItem = z16.object({
2450
- type: z16.literal("local_shell_call"),
2451
- id: z16.string(),
2452
- call_id: z16.string(),
2453
- action: z16.object({
2454
- type: z16.literal("exec"),
2455
- command: z16.array(z16.string()),
2456
- timeout_ms: z16.number().optional(),
2457
- user: z16.string().optional(),
2458
- working_directory: z16.string().optional(),
2459
- env: z16.record(z16.string(), z16.string()).optional()
2460
- })
2461
- });
2462
- var imageGenerationCallItem = z16.object({
2463
- type: z16.literal("image_generation_call"),
2464
- id: z16.string(),
2465
- result: z16.string()
2466
- });
2467
- var TOP_LOGPROBS_MAX = 20;
2468
- var LOGPROBS_SCHEMA = z16.array(
2469
- z16.object({
2470
- token: z16.string(),
2471
- logprob: z16.number(),
2472
- top_logprobs: z16.array(
2473
- z16.object({
2474
- token: z16.string(),
2475
- logprob: z16.number()
2476
- })
2477
- )
2478
- })
2479
- );
2480
3119
  var OpenAIResponsesLanguageModel = class {
2481
3120
  constructor(modelId, config) {
2482
3121
  this.specificationVersion = "v2";
@@ -2668,7 +3307,7 @@ var OpenAIResponsesLanguageModel = class {
2668
3307
  tools: openaiTools2,
2669
3308
  toolChoice: openaiToolChoice,
2670
3309
  toolWarnings
2671
- } = prepareResponsesTools({
3310
+ } = await prepareResponsesTools({
2672
3311
  tools,
2673
3312
  toolChoice,
2674
3313
  strictJsonSchema
@@ -2704,85 +3343,7 @@ var OpenAIResponsesLanguageModel = class {
2704
3343
  body,
2705
3344
  failedResponseHandler: openaiFailedResponseHandler,
2706
3345
  successfulResponseHandler: createJsonResponseHandler5(
2707
- z16.object({
2708
- id: z16.string(),
2709
- created_at: z16.number(),
2710
- error: z16.object({
2711
- code: z16.string(),
2712
- message: z16.string()
2713
- }).nullish(),
2714
- model: z16.string(),
2715
- output: z16.array(
2716
- z16.discriminatedUnion("type", [
2717
- z16.object({
2718
- type: z16.literal("message"),
2719
- role: z16.literal("assistant"),
2720
- id: z16.string(),
2721
- content: z16.array(
2722
- z16.object({
2723
- type: z16.literal("output_text"),
2724
- text: z16.string(),
2725
- logprobs: LOGPROBS_SCHEMA.nullish(),
2726
- annotations: z16.array(
2727
- z16.discriminatedUnion("type", [
2728
- z16.object({
2729
- type: z16.literal("url_citation"),
2730
- start_index: z16.number(),
2731
- end_index: z16.number(),
2732
- url: z16.string(),
2733
- title: z16.string()
2734
- }),
2735
- z16.object({
2736
- type: z16.literal("file_citation"),
2737
- file_id: z16.string(),
2738
- filename: z16.string().nullish(),
2739
- index: z16.number().nullish(),
2740
- start_index: z16.number().nullish(),
2741
- end_index: z16.number().nullish(),
2742
- quote: z16.string().nullish()
2743
- }),
2744
- z16.object({
2745
- type: z16.literal("container_file_citation")
2746
- })
2747
- ])
2748
- )
2749
- })
2750
- )
2751
- }),
2752
- webSearchCallItem,
2753
- fileSearchCallItem,
2754
- codeInterpreterCallItem,
2755
- imageGenerationCallItem,
2756
- localShellCallItem,
2757
- z16.object({
2758
- type: z16.literal("function_call"),
2759
- call_id: z16.string(),
2760
- name: z16.string(),
2761
- arguments: z16.string(),
2762
- id: z16.string()
2763
- }),
2764
- z16.object({
2765
- type: z16.literal("computer_call"),
2766
- id: z16.string(),
2767
- status: z16.string().optional()
2768
- }),
2769
- z16.object({
2770
- type: z16.literal("reasoning"),
2771
- id: z16.string(),
2772
- encrypted_content: z16.string().nullish(),
2773
- summary: z16.array(
2774
- z16.object({
2775
- type: z16.literal("summary_text"),
2776
- text: z16.string()
2777
- })
2778
- )
2779
- })
2780
- ])
2781
- ),
2782
- service_tier: z16.string().nullish(),
2783
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
2784
- usage: usageSchema2
2785
- })
3346
+ openaiResponsesResponseSchema
2786
3347
  ),
2787
3348
  abortSignal: options.abortSignal,
2788
3349
  fetch: this.config.fetch
@@ -2845,7 +3406,9 @@ var OpenAIResponsesLanguageModel = class {
2845
3406
  type: "tool-call",
2846
3407
  toolCallId: part.call_id,
2847
3408
  toolName: "local_shell",
2848
- input: JSON.stringify({ action: part.action }),
3409
+ input: JSON.stringify({
3410
+ action: part.action
3411
+ }),
2849
3412
  providerMetadata: {
2850
3413
  openai: {
2851
3414
  itemId: part.id
@@ -3099,7 +3662,8 @@ var OpenAIResponsesLanguageModel = class {
3099
3662
  controller.enqueue({
3100
3663
  type: "tool-input-start",
3101
3664
  id: value.item.id,
3102
- toolName: webSearchToolName != null ? webSearchToolName : "web_search"
3665
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3666
+ providerExecuted: true
3103
3667
  });
3104
3668
  } else if (value.item.type === "computer_call") {
3105
3669
  ongoingToolCalls[value.output_index] = {
@@ -3109,7 +3673,8 @@ var OpenAIResponsesLanguageModel = class {
3109
3673
  controller.enqueue({
3110
3674
  type: "tool-input-start",
3111
3675
  id: value.item.id,
3112
- toolName: "computer_use"
3676
+ toolName: "computer_use",
3677
+ providerExecuted: true
3113
3678
  });
3114
3679
  } else if (value.item.type === "code_interpreter_call") {
3115
3680
  ongoingToolCalls[value.output_index] = {
@@ -3122,7 +3687,8 @@ var OpenAIResponsesLanguageModel = class {
3122
3687
  controller.enqueue({
3123
3688
  type: "tool-input-start",
3124
3689
  id: value.item.id,
3125
- toolName: "code_interpreter"
3690
+ toolName: "code_interpreter",
3691
+ providerExecuted: true
3126
3692
  });
3127
3693
  controller.enqueue({
3128
3694
  type: "tool-input-delta",
@@ -3462,196 +4028,6 @@ var OpenAIResponsesLanguageModel = class {
3462
4028
  };
3463
4029
  }
3464
4030
  };
3465
- var usageSchema2 = z16.object({
3466
- input_tokens: z16.number(),
3467
- input_tokens_details: z16.object({ cached_tokens: z16.number().nullish() }).nullish(),
3468
- output_tokens: z16.number(),
3469
- output_tokens_details: z16.object({ reasoning_tokens: z16.number().nullish() }).nullish()
3470
- });
3471
- var textDeltaChunkSchema = z16.object({
3472
- type: z16.literal("response.output_text.delta"),
3473
- item_id: z16.string(),
3474
- delta: z16.string(),
3475
- logprobs: LOGPROBS_SCHEMA.nullish()
3476
- });
3477
- var errorChunkSchema = z16.object({
3478
- type: z16.literal("error"),
3479
- code: z16.string(),
3480
- message: z16.string(),
3481
- param: z16.string().nullish(),
3482
- sequence_number: z16.number()
3483
- });
3484
- var responseFinishedChunkSchema = z16.object({
3485
- type: z16.enum(["response.completed", "response.incomplete"]),
3486
- response: z16.object({
3487
- incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3488
- usage: usageSchema2,
3489
- service_tier: z16.string().nullish()
3490
- })
3491
- });
3492
- var responseCreatedChunkSchema = z16.object({
3493
- type: z16.literal("response.created"),
3494
- response: z16.object({
3495
- id: z16.string(),
3496
- created_at: z16.number(),
3497
- model: z16.string(),
3498
- service_tier: z16.string().nullish()
3499
- })
3500
- });
3501
- var responseOutputItemAddedSchema = z16.object({
3502
- type: z16.literal("response.output_item.added"),
3503
- output_index: z16.number(),
3504
- item: z16.discriminatedUnion("type", [
3505
- z16.object({
3506
- type: z16.literal("message"),
3507
- id: z16.string()
3508
- }),
3509
- z16.object({
3510
- type: z16.literal("reasoning"),
3511
- id: z16.string(),
3512
- encrypted_content: z16.string().nullish()
3513
- }),
3514
- z16.object({
3515
- type: z16.literal("function_call"),
3516
- id: z16.string(),
3517
- call_id: z16.string(),
3518
- name: z16.string(),
3519
- arguments: z16.string()
3520
- }),
3521
- z16.object({
3522
- type: z16.literal("web_search_call"),
3523
- id: z16.string(),
3524
- status: z16.string(),
3525
- action: z16.object({
3526
- type: z16.literal("search"),
3527
- query: z16.string().optional()
3528
- }).nullish()
3529
- }),
3530
- z16.object({
3531
- type: z16.literal("computer_call"),
3532
- id: z16.string(),
3533
- status: z16.string()
3534
- }),
3535
- z16.object({
3536
- type: z16.literal("file_search_call"),
3537
- id: z16.string()
3538
- }),
3539
- z16.object({
3540
- type: z16.literal("image_generation_call"),
3541
- id: z16.string()
3542
- }),
3543
- z16.object({
3544
- type: z16.literal("code_interpreter_call"),
3545
- id: z16.string(),
3546
- container_id: z16.string(),
3547
- code: z16.string().nullable(),
3548
- outputs: z16.array(
3549
- z16.discriminatedUnion("type", [
3550
- z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3551
- z16.object({ type: z16.literal("image"), url: z16.string() })
3552
- ])
3553
- ).nullable(),
3554
- status: z16.string()
3555
- })
3556
- ])
3557
- });
3558
- var responseOutputItemDoneSchema = z16.object({
3559
- type: z16.literal("response.output_item.done"),
3560
- output_index: z16.number(),
3561
- item: z16.discriminatedUnion("type", [
3562
- z16.object({
3563
- type: z16.literal("message"),
3564
- id: z16.string()
3565
- }),
3566
- z16.object({
3567
- type: z16.literal("reasoning"),
3568
- id: z16.string(),
3569
- encrypted_content: z16.string().nullish()
3570
- }),
3571
- z16.object({
3572
- type: z16.literal("function_call"),
3573
- id: z16.string(),
3574
- call_id: z16.string(),
3575
- name: z16.string(),
3576
- arguments: z16.string(),
3577
- status: z16.literal("completed")
3578
- }),
3579
- codeInterpreterCallItem,
3580
- imageGenerationCallItem,
3581
- webSearchCallItem,
3582
- fileSearchCallItem,
3583
- localShellCallItem,
3584
- z16.object({
3585
- type: z16.literal("computer_call"),
3586
- id: z16.string(),
3587
- status: z16.literal("completed")
3588
- })
3589
- ])
3590
- });
3591
- var responseFunctionCallArgumentsDeltaSchema = z16.object({
3592
- type: z16.literal("response.function_call_arguments.delta"),
3593
- item_id: z16.string(),
3594
- output_index: z16.number(),
3595
- delta: z16.string()
3596
- });
3597
- var responseCodeInterpreterCallCodeDeltaSchema = z16.object({
3598
- type: z16.literal("response.code_interpreter_call_code.delta"),
3599
- item_id: z16.string(),
3600
- output_index: z16.number(),
3601
- delta: z16.string()
3602
- });
3603
- var responseCodeInterpreterCallCodeDoneSchema = z16.object({
3604
- type: z16.literal("response.code_interpreter_call_code.done"),
3605
- item_id: z16.string(),
3606
- output_index: z16.number(),
3607
- code: z16.string()
3608
- });
3609
- var responseAnnotationAddedSchema = z16.object({
3610
- type: z16.literal("response.output_text.annotation.added"),
3611
- annotation: z16.discriminatedUnion("type", [
3612
- z16.object({
3613
- type: z16.literal("url_citation"),
3614
- url: z16.string(),
3615
- title: z16.string()
3616
- }),
3617
- z16.object({
3618
- type: z16.literal("file_citation"),
3619
- file_id: z16.string(),
3620
- filename: z16.string().nullish(),
3621
- index: z16.number().nullish(),
3622
- start_index: z16.number().nullish(),
3623
- end_index: z16.number().nullish(),
3624
- quote: z16.string().nullish()
3625
- })
3626
- ])
3627
- });
3628
- var responseReasoningSummaryPartAddedSchema = z16.object({
3629
- type: z16.literal("response.reasoning_summary_part.added"),
3630
- item_id: z16.string(),
3631
- summary_index: z16.number()
3632
- });
3633
- var responseReasoningSummaryTextDeltaSchema = z16.object({
3634
- type: z16.literal("response.reasoning_summary_text.delta"),
3635
- item_id: z16.string(),
3636
- summary_index: z16.number(),
3637
- delta: z16.string()
3638
- });
3639
- var openaiResponsesChunkSchema = z16.union([
3640
- textDeltaChunkSchema,
3641
- responseFinishedChunkSchema,
3642
- responseCreatedChunkSchema,
3643
- responseOutputItemAddedSchema,
3644
- responseOutputItemDoneSchema,
3645
- responseFunctionCallArgumentsDeltaSchema,
3646
- responseCodeInterpreterCallCodeDeltaSchema,
3647
- responseCodeInterpreterCallCodeDoneSchema,
3648
- responseAnnotationAddedSchema,
3649
- responseReasoningSummaryPartAddedSchema,
3650
- responseReasoningSummaryTextDeltaSchema,
3651
- errorChunkSchema,
3652
- z16.object({ type: z16.string() }).loose()
3653
- // fallback for unknown chunks
3654
- ]);
3655
4031
  function isTextDeltaChunk(chunk) {
3656
4032
  return chunk.type === "response.output_text.delta";
3657
4033
  }
@@ -3728,47 +4104,6 @@ function getResponsesModelConfig(modelId) {
3728
4104
  isReasoningModel: false
3729
4105
  };
3730
4106
  }
3731
- var openaiResponsesProviderOptionsSchema = z16.object({
3732
- include: z16.array(
3733
- z16.enum([
3734
- "reasoning.encrypted_content",
3735
- "file_search_call.results",
3736
- "message.output_text.logprobs"
3737
- ])
3738
- ).nullish(),
3739
- instructions: z16.string().nullish(),
3740
- /**
3741
- * Return the log probabilities of the tokens.
3742
- *
3743
- * Setting to true will return the log probabilities of the tokens that
3744
- * were generated.
3745
- *
3746
- * Setting to a number will return the log probabilities of the top n
3747
- * tokens that were generated.
3748
- *
3749
- * @see https://platform.openai.com/docs/api-reference/responses/create
3750
- * @see https://cookbook.openai.com/examples/using_logprobs
3751
- */
3752
- logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3753
- /**
3754
- * The maximum number of total calls to built-in tools that can be processed in a response.
3755
- * This maximum number applies across all built-in tool calls, not per individual tool.
3756
- * Any further attempts to call a tool by the model will be ignored.
3757
- */
3758
- maxToolCalls: z16.number().nullish(),
3759
- metadata: z16.any().nullish(),
3760
- parallelToolCalls: z16.boolean().nullish(),
3761
- previousResponseId: z16.string().nullish(),
3762
- promptCacheKey: z16.string().nullish(),
3763
- reasoningEffort: z16.string().nullish(),
3764
- reasoningSummary: z16.string().nullish(),
3765
- safetyIdentifier: z16.string().nullish(),
3766
- serviceTier: z16.enum(["auto", "flex", "priority"]).nullish(),
3767
- store: z16.boolean().nullish(),
3768
- strictJsonSchema: z16.boolean().nullish(),
3769
- textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
3770
- user: z16.string().nullish()
3771
- });
3772
4107
 
3773
4108
  // src/speech/openai-speech-model.ts
3774
4109
  import {
@@ -3777,11 +4112,23 @@ import {
3777
4112
  parseProviderOptions as parseProviderOptions6,
3778
4113
  postJsonToApi as postJsonToApi6
3779
4114
  } from "@ai-sdk/provider-utils";
3780
- import { z as z17 } from "zod/v4";
3781
- var OpenAIProviderOptionsSchema = z17.object({
3782
- instructions: z17.string().nullish(),
3783
- speed: z17.number().min(0.25).max(4).default(1).nullish()
3784
- });
4115
+
4116
+ // src/speech/openai-speech-options.ts
4117
+ import {
4118
+ lazyValidator as lazyValidator10,
4119
+ zodSchema as zodSchema16
4120
+ } from "@ai-sdk/provider-utils";
4121
+ import * as z18 from "zod/v4";
4122
+ var openaiSpeechProviderOptionsSchema = lazyValidator10(
4123
+ () => zodSchema16(
4124
+ z18.object({
4125
+ instructions: z18.string().nullish(),
4126
+ speed: z18.number().min(0.25).max(4).default(1).nullish()
4127
+ })
4128
+ )
4129
+ );
4130
+
4131
+ // src/speech/openai-speech-model.ts
3785
4132
  var OpenAISpeechModel = class {
3786
4133
  constructor(modelId, config) {
3787
4134
  this.modelId = modelId;
@@ -3804,7 +4151,7 @@ var OpenAISpeechModel = class {
3804
4151
  const openAIOptions = await parseProviderOptions6({
3805
4152
  provider: "openai",
3806
4153
  providerOptions,
3807
- schema: OpenAIProviderOptionsSchema
4154
+ schema: openaiSpeechProviderOptionsSchema
3808
4155
  });
3809
4156
  const requestBody = {
3810
4157
  model: this.modelId,
@@ -3891,34 +4238,75 @@ import {
3891
4238
  parseProviderOptions as parseProviderOptions7,
3892
4239
  postFormDataToApi
3893
4240
  } from "@ai-sdk/provider-utils";
3894
- import { z as z19 } from "zod/v4";
4241
+
4242
+ // src/transcription/openai-transcription-api.ts
4243
+ import { lazyValidator as lazyValidator11, zodSchema as zodSchema17 } from "@ai-sdk/provider-utils";
4244
+ import * as z19 from "zod/v4";
4245
+ var openaiTranscriptionResponseSchema = lazyValidator11(
4246
+ () => zodSchema17(
4247
+ z19.object({
4248
+ text: z19.string(),
4249
+ language: z19.string().nullish(),
4250
+ duration: z19.number().nullish(),
4251
+ words: z19.array(
4252
+ z19.object({
4253
+ word: z19.string(),
4254
+ start: z19.number(),
4255
+ end: z19.number()
4256
+ })
4257
+ ).nullish(),
4258
+ segments: z19.array(
4259
+ z19.object({
4260
+ id: z19.number(),
4261
+ seek: z19.number(),
4262
+ start: z19.number(),
4263
+ end: z19.number(),
4264
+ text: z19.string(),
4265
+ tokens: z19.array(z19.number()),
4266
+ temperature: z19.number(),
4267
+ avg_logprob: z19.number(),
4268
+ compression_ratio: z19.number(),
4269
+ no_speech_prob: z19.number()
4270
+ })
4271
+ ).nullish()
4272
+ })
4273
+ )
4274
+ );
3895
4275
 
3896
4276
  // src/transcription/openai-transcription-options.ts
3897
- import { z as z18 } from "zod/v4";
3898
- var openAITranscriptionProviderOptions = z18.object({
3899
- /**
3900
- * Additional information to include in the transcription response.
3901
- */
3902
- include: z18.array(z18.string()).optional(),
3903
- /**
3904
- * The language of the input audio in ISO-639-1 format.
3905
- */
3906
- language: z18.string().optional(),
3907
- /**
3908
- * An optional text to guide the model's style or continue a previous audio segment.
3909
- */
3910
- prompt: z18.string().optional(),
3911
- /**
3912
- * The sampling temperature, between 0 and 1.
3913
- * @default 0
3914
- */
3915
- temperature: z18.number().min(0).max(1).default(0).optional(),
3916
- /**
3917
- * The timestamp granularities to populate for this transcription.
3918
- * @default ['segment']
3919
- */
3920
- timestampGranularities: z18.array(z18.enum(["word", "segment"])).default(["segment"]).optional()
3921
- });
4277
+ import {
4278
+ lazyValidator as lazyValidator12,
4279
+ zodSchema as zodSchema18
4280
+ } from "@ai-sdk/provider-utils";
4281
+ import * as z20 from "zod/v4";
4282
+ var openAITranscriptionProviderOptions = lazyValidator12(
4283
+ () => zodSchema18(
4284
+ z20.object({
4285
+ /**
4286
+ * Additional information to include in the transcription response.
4287
+ */
4288
+ include: z20.array(z20.string()).optional(),
4289
+ /**
4290
+ * The language of the input audio in ISO-639-1 format.
4291
+ */
4292
+ language: z20.string().optional(),
4293
+ /**
4294
+ * An optional text to guide the model's style or continue a previous audio segment.
4295
+ */
4296
+ prompt: z20.string().optional(),
4297
+ /**
4298
+ * The sampling temperature, between 0 and 1.
4299
+ * @default 0
4300
+ */
4301
+ temperature: z20.number().min(0).max(1).default(0).optional(),
4302
+ /**
4303
+ * The timestamp granularities to populate for this transcription.
4304
+ * @default ['segment']
4305
+ */
4306
+ timestampGranularities: z20.array(z20.enum(["word", "segment"])).default(["segment"]).optional()
4307
+ })
4308
+ )
4309
+ );
3922
4310
 
3923
4311
  // src/transcription/openai-transcription-model.ts
3924
4312
  var languageMap = {
@@ -4086,35 +4474,9 @@ var OpenAITranscriptionModel = class {
4086
4474
  };
4087
4475
  }
4088
4476
  };
4089
- var openaiTranscriptionResponseSchema = z19.object({
4090
- text: z19.string(),
4091
- language: z19.string().nullish(),
4092
- duration: z19.number().nullish(),
4093
- words: z19.array(
4094
- z19.object({
4095
- word: z19.string(),
4096
- start: z19.number(),
4097
- end: z19.number()
4098
- })
4099
- ).nullish(),
4100
- segments: z19.array(
4101
- z19.object({
4102
- id: z19.number(),
4103
- seek: z19.number(),
4104
- start: z19.number(),
4105
- end: z19.number(),
4106
- text: z19.string(),
4107
- tokens: z19.array(z19.number()),
4108
- temperature: z19.number(),
4109
- avg_logprob: z19.number(),
4110
- compression_ratio: z19.number(),
4111
- no_speech_prob: z19.number()
4112
- })
4113
- ).nullish()
4114
- });
4115
4477
 
4116
4478
  // src/version.ts
4117
- var VERSION = true ? "2.0.43" : "0.0.0-test";
4479
+ var VERSION = true ? "2.0.45" : "0.0.0-test";
4118
4480
 
4119
4481
  // src/openai-provider.ts
4120
4482
  function createOpenAI(options = {}) {