@ai-sdk/openai 3.0.130 → 3.0.132

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.
@@ -14,8 +14,12 @@ import {
14
14
 
15
15
  // src/openai-error.ts
16
16
  import { z } from "zod/v4";
17
- import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
18
- var openaiErrorDataSchema = z.object({
17
+ import {
18
+ lazySchema,
19
+ zodSchema,
20
+ createJsonErrorResponseHandler
21
+ } from "@ai-sdk/provider-utils";
22
+ var openaiErrorDataSchema = () => z.object({
19
23
  error: z.object({
20
24
  message: z.string(),
21
25
  // The additional information below is handled loosely to support
@@ -26,8 +30,11 @@ var openaiErrorDataSchema = z.object({
26
30
  code: z.union([z.string(), z.number()]).nullish()
27
31
  })
28
32
  });
33
+ var openaiErrorDataSchemaValidator = lazySchema(
34
+ () => zodSchema(openaiErrorDataSchema())
35
+ );
29
36
  var openaiFailedResponseHandler = createJsonErrorResponseHandler({
30
- errorSchema: openaiErrorDataSchema,
37
+ errorSchema: openaiErrorDataSchemaValidator,
31
38
  errorToMessage: (data) => data.error.message
32
39
  });
33
40
 
@@ -643,12 +650,12 @@ function mapOpenAIFinishReason(finishReason) {
643
650
 
644
651
  // src/chat/openai-chat-api.ts
645
652
  import {
646
- lazySchema,
647
- zodSchema
653
+ lazySchema as lazySchema2,
654
+ zodSchema as zodSchema2
648
655
  } from "@ai-sdk/provider-utils";
649
656
  import { z as z2 } from "zod/v4";
650
- var openaiChatResponseSchema = lazySchema(
651
- () => zodSchema(
657
+ var openaiChatResponseSchema = lazySchema2(
658
+ () => zodSchema2(
652
659
  z2.object({
653
660
  id: z2.string().nullish(),
654
661
  created: z2.number().nullish(),
@@ -718,8 +725,8 @@ var openaiChatResponseSchema = lazySchema(
718
725
  })
719
726
  )
720
727
  );
721
- var openaiChatChunkSchema = lazySchema(
722
- () => zodSchema(
728
+ var openaiChatChunkSchema = lazySchema2(
729
+ () => zodSchema2(
723
730
  z2.union([
724
731
  z2.object({
725
732
  id: z2.string().nullish(),
@@ -786,19 +793,19 @@ var openaiChatChunkSchema = lazySchema(
786
793
  }).nullish()
787
794
  }).nullish()
788
795
  }),
789
- openaiErrorDataSchema
796
+ openaiErrorDataSchema()
790
797
  ])
791
798
  )
792
799
  );
793
800
 
794
801
  // src/chat/openai-chat-options.ts
795
802
  import {
796
- lazySchema as lazySchema2,
797
- zodSchema as zodSchema2
803
+ lazySchema as lazySchema3,
804
+ zodSchema as zodSchema3
798
805
  } from "@ai-sdk/provider-utils";
799
806
  import { z as z3 } from "zod/v4";
800
- var openaiLanguageModelChatOptions = lazySchema2(
801
- () => zodSchema2(
807
+ var openaiLanguageModelChatOptions = lazySchema3(
808
+ () => zodSchema3(
802
809
  z3.object({
803
810
  /**
804
811
  * Modify the likelihood of specified tokens appearing in the completion.
@@ -1599,11 +1606,11 @@ function mapOpenAIFinishReason2(finishReason) {
1599
1606
  // src/completion/openai-completion-api.ts
1600
1607
  import { z as z4 } from "zod/v4";
1601
1608
  import {
1602
- lazySchema as lazySchema3,
1603
- zodSchema as zodSchema3
1609
+ lazySchema as lazySchema4,
1610
+ zodSchema as zodSchema4
1604
1611
  } from "@ai-sdk/provider-utils";
1605
- var openaiCompletionResponseSchema = lazySchema3(
1606
- () => zodSchema3(
1612
+ var openaiCompletionResponseSchema = lazySchema4(
1613
+ () => zodSchema4(
1607
1614
  z4.object({
1608
1615
  id: z4.string().nullish(),
1609
1616
  created: z4.number().nullish(),
@@ -1627,8 +1634,8 @@ var openaiCompletionResponseSchema = lazySchema3(
1627
1634
  })
1628
1635
  )
1629
1636
  );
1630
- var openaiCompletionChunkSchema = lazySchema3(
1631
- () => zodSchema3(
1637
+ var openaiCompletionChunkSchema = lazySchema4(
1638
+ () => zodSchema4(
1632
1639
  z4.union([
1633
1640
  z4.object({
1634
1641
  id: z4.string().nullish(),
@@ -1652,19 +1659,19 @@ var openaiCompletionChunkSchema = lazySchema3(
1652
1659
  total_tokens: z4.number()
1653
1660
  }).nullish()
1654
1661
  }),
1655
- openaiErrorDataSchema
1662
+ openaiErrorDataSchema()
1656
1663
  ])
1657
1664
  )
1658
1665
  );
1659
1666
 
1660
1667
  // src/completion/openai-completion-options.ts
1661
1668
  import {
1662
- lazySchema as lazySchema4,
1663
- zodSchema as zodSchema4
1669
+ lazySchema as lazySchema5,
1670
+ zodSchema as zodSchema5
1664
1671
  } from "@ai-sdk/provider-utils";
1665
1672
  import { z as z5 } from "zod/v4";
1666
- var openaiLanguageModelCompletionOptions = lazySchema4(
1667
- () => zodSchema4(
1673
+ var openaiLanguageModelCompletionOptions = lazySchema5(
1674
+ () => zodSchema5(
1668
1675
  z5.object({
1669
1676
  /**
1670
1677
  * Echo back the prompt in addition to the completion.
@@ -1964,12 +1971,12 @@ import {
1964
1971
 
1965
1972
  // src/embedding/openai-embedding-options.ts
1966
1973
  import {
1967
- lazySchema as lazySchema5,
1968
- zodSchema as zodSchema5
1974
+ lazySchema as lazySchema6,
1975
+ zodSchema as zodSchema6
1969
1976
  } from "@ai-sdk/provider-utils";
1970
1977
  import { z as z6 } from "zod/v4";
1971
- var openaiEmbeddingModelOptions = lazySchema5(
1972
- () => zodSchema5(
1978
+ var openaiEmbeddingModelOptions = lazySchema6(
1979
+ () => zodSchema6(
1973
1980
  z6.object({
1974
1981
  /**
1975
1982
  * The number of dimensions the resulting output embeddings should have.
@@ -1986,10 +1993,10 @@ var openaiEmbeddingModelOptions = lazySchema5(
1986
1993
  );
1987
1994
 
1988
1995
  // src/embedding/openai-embedding-api.ts
1989
- import { lazySchema as lazySchema6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
1996
+ import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1990
1997
  import { z as z7 } from "zod/v4";
1991
- var openaiTextEmbeddingResponseSchema = lazySchema6(
1992
- () => zodSchema6(
1998
+ var openaiTextEmbeddingResponseSchema = lazySchema7(
1999
+ () => zodSchema7(
1993
2000
  z7.object({
1994
2001
  data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1995
2002
  usage: z7.object({ prompt_tokens: z7.number() }).nullish()
@@ -2078,10 +2085,10 @@ import {
2078
2085
  } from "@ai-sdk/provider-utils";
2079
2086
 
2080
2087
  // src/image/openai-image-api.ts
2081
- import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
2088
+ import { lazySchema as lazySchema8, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
2082
2089
  import { z as z8 } from "zod/v4";
2083
- var openaiImageResponseSchema = lazySchema7(
2084
- () => zodSchema7(
2090
+ var openaiImageResponseSchema = lazySchema8(
2091
+ () => zodSchema8(
2085
2092
  z8.object({
2086
2093
  created: z8.number().nullish(),
2087
2094
  data: z8.array(
@@ -2109,8 +2116,8 @@ var openaiImageResponseSchema = lazySchema7(
2109
2116
 
2110
2117
  // src/image/openai-image-model-options.ts
2111
2118
  import {
2112
- lazySchema as lazySchema8,
2113
- zodSchema as zodSchema8
2119
+ lazySchema as lazySchema9,
2120
+ zodSchema as zodSchema9
2114
2121
  } from "@ai-sdk/provider-utils";
2115
2122
  import { z as z9 } from "zod/v4";
2116
2123
  var modelMaxImagesPerCall = {
@@ -2136,7 +2143,7 @@ function getMaxImagesPerCall(modelId) {
2136
2143
  var _a2;
2137
2144
  return (_a2 = modelMaxImagesPerCall[modelId]) != null ? _a2 : modelId.startsWith("gpt-image-") ? 10 : 1;
2138
2145
  }
2139
- var baseImageModelOptionsObject = z9.object({
2146
+ var baseImageModelOptionsObject = () => z9.object({
2140
2147
  /**
2141
2148
  * Quality of the generated image(s).
2142
2149
  *
@@ -2166,12 +2173,12 @@ var baseImageModelOptionsObject = z9.object({
2166
2173
  */
2167
2174
  user: z9.string().optional()
2168
2175
  });
2169
- var openaiImageModelOptions = lazySchema8(
2170
- () => zodSchema8(baseImageModelOptionsObject)
2176
+ var openaiImageModelOptions = lazySchema9(
2177
+ () => zodSchema9(baseImageModelOptionsObject())
2171
2178
  );
2172
- var openaiImageModelGenerationOptions = lazySchema8(
2173
- () => zodSchema8(
2174
- baseImageModelOptionsObject.extend({
2179
+ var openaiImageModelGenerationOptions = lazySchema9(
2180
+ () => zodSchema9(
2181
+ baseImageModelOptionsObject().extend({
2175
2182
  /**
2176
2183
  * Style of the generated image. `vivid` produces hyper-real and
2177
2184
  * dramatic images; `natural` produces more subdued, less hyper-real
@@ -2186,9 +2193,9 @@ var openaiImageModelGenerationOptions = lazySchema8(
2186
2193
  })
2187
2194
  )
2188
2195
  );
2189
- var openaiImageModelEditOptions = lazySchema8(
2190
- () => zodSchema8(
2191
- baseImageModelOptionsObject.extend({
2196
+ var openaiImageModelEditOptions = lazySchema9(
2197
+ () => zodSchema9(
2198
+ baseImageModelOptionsObject().extend({
2192
2199
  /**
2193
2200
  * Fidelity of the output image(s) to the input image(s).
2194
2201
  */
@@ -2421,10 +2428,10 @@ import {
2421
2428
  } from "@ai-sdk/provider-utils";
2422
2429
 
2423
2430
  // src/transcription/openai-transcription-api.ts
2424
- import { lazySchema as lazySchema9, zodSchema as zodSchema9 } from "@ai-sdk/provider-utils";
2431
+ import { lazySchema as lazySchema10, zodSchema as zodSchema10 } from "@ai-sdk/provider-utils";
2425
2432
  import { z as z10 } from "zod/v4";
2426
- var openaiTranscriptionResponseSchema = lazySchema9(
2427
- () => zodSchema9(
2433
+ var openaiTranscriptionResponseSchema = lazySchema10(
2434
+ () => zodSchema10(
2428
2435
  z10.object({
2429
2436
  text: z10.string(),
2430
2437
  language: z10.string().nullish(),
@@ -2456,12 +2463,12 @@ var openaiTranscriptionResponseSchema = lazySchema9(
2456
2463
 
2457
2464
  // src/transcription/openai-transcription-options.ts
2458
2465
  import {
2459
- lazySchema as lazySchema10,
2460
- zodSchema as zodSchema10
2466
+ lazySchema as lazySchema11,
2467
+ zodSchema as zodSchema11
2461
2468
  } from "@ai-sdk/provider-utils";
2462
2469
  import { z as z11 } from "zod/v4";
2463
- var openAITranscriptionModelOptions = lazySchema10(
2464
- () => zodSchema10(
2470
+ var openAITranscriptionModelOptions = lazySchema11(
2471
+ () => zodSchema11(
2465
2472
  z11.object({
2466
2473
  /**
2467
2474
  * Additional information to include in the transcription response.
@@ -2666,12 +2673,12 @@ import {
2666
2673
 
2667
2674
  // src/speech/openai-speech-options.ts
2668
2675
  import {
2669
- lazySchema as lazySchema11,
2670
- zodSchema as zodSchema11
2676
+ lazySchema as lazySchema12,
2677
+ zodSchema as zodSchema12
2671
2678
  } from "@ai-sdk/provider-utils";
2672
2679
  import { z as z12 } from "zod/v4";
2673
- var openaiSpeechModelOptionsSchema = lazySchema11(
2674
- () => zodSchema11(
2680
+ var openaiSpeechModelOptionsSchema = lazySchema12(
2681
+ () => zodSchema12(
2675
2682
  z12.object({
2676
2683
  instructions: z12.string().nullish(),
2677
2684
  speed: z12.number().min(0.25).max(4).default(1).nullish()
@@ -2840,6 +2847,8 @@ import {
2840
2847
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2841
2848
  } from "@ai-sdk/provider";
2842
2849
  import {
2850
+ lazySchema as lazySchema19,
2851
+ zodSchema as zodSchema19,
2843
2852
  convertToBase64 as convertToBase642,
2844
2853
  isNonNullable,
2845
2854
  parseJSON,
@@ -2851,8 +2860,8 @@ import { z as z19 } from "zod/v4";
2851
2860
 
2852
2861
  // src/responses/openai-responses-options.ts
2853
2862
  import {
2854
- lazySchema as lazySchema12,
2855
- zodSchema as zodSchema12
2863
+ lazySchema as lazySchema13,
2864
+ zodSchema as zodSchema13
2856
2865
  } from "@ai-sdk/provider-utils";
2857
2866
  import { z as z13 } from "zod/v4";
2858
2867
  var TOP_LOGPROBS_MAX = 20;
@@ -2929,8 +2938,8 @@ var openaiResponsesModelIds = [
2929
2938
  "gpt-5-chat-latest",
2930
2939
  ...openaiResponsesReasoningModelIds
2931
2940
  ];
2932
- var openaiLanguageModelResponsesOptionsSchema = lazySchema12(
2933
- () => zodSchema12(
2941
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema13(
2942
+ () => zodSchema13(
2934
2943
  z13.object({
2935
2944
  /**
2936
2945
  * The ID of the OpenAI Conversation to continue.
@@ -3000,11 +3009,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema12(
3000
3009
  /**
3001
3010
  * Prompt cache behavior for GPT-5.6 and later models.
3002
3011
  * `mode` controls whether OpenAI also places an implicit breakpoint.
3003
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
3012
+ * `ttl` sets the minimum cache lifetime: `'30m'` (default) or `'12h'`.
3013
+ * `prewarm` writes the prompt to the cache without generating output.
3004
3014
  */
3005
3015
  promptCacheOptions: z13.object({
3006
3016
  mode: z13.enum(["implicit", "explicit"]).optional(),
3007
- ttl: z13.literal("30m").optional()
3017
+ ttl: z13.enum(["30m", "12h"]).optional(),
3018
+ prewarm: z13.boolean().optional()
3008
3019
  }).optional(),
3009
3020
  /**
3010
3021
  * The retention policy for the prompt cache.
@@ -3136,8 +3147,8 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema12(
3136
3147
  })
3137
3148
  )
3138
3149
  );
3139
- var openaiResponsesSystemMessageOptionsSchema = lazySchema12(
3140
- () => zodSchema12(
3150
+ var openaiResponsesSystemMessageOptionsSchema = lazySchema13(
3151
+ () => zodSchema13(
3141
3152
  z13.object({
3142
3153
  /**
3143
3154
  * Emit a configuration update at this position in Responses history.
@@ -3155,12 +3166,12 @@ var openaiResponsesSystemMessageOptionsSchema = lazySchema12(
3155
3166
  // src/tool/apply-patch.ts
3156
3167
  import {
3157
3168
  createProviderToolFactoryWithOutputSchema,
3158
- lazySchema as lazySchema13,
3159
- zodSchema as zodSchema13
3169
+ lazySchema as lazySchema14,
3170
+ zodSchema as zodSchema14
3160
3171
  } from "@ai-sdk/provider-utils";
3161
3172
  import { z as z14 } from "zod/v4";
3162
- var applyPatchInputSchema = lazySchema13(
3163
- () => zodSchema13(
3173
+ var applyPatchInputSchema = lazySchema14(
3174
+ () => zodSchema14(
3164
3175
  z14.object({
3165
3176
  callId: z14.string(),
3166
3177
  operation: z14.discriminatedUnion("type", [
@@ -3182,15 +3193,15 @@ var applyPatchInputSchema = lazySchema13(
3182
3193
  })
3183
3194
  )
3184
3195
  );
3185
- var applyPatchOutputSchema = lazySchema13(
3186
- () => zodSchema13(
3196
+ var applyPatchOutputSchema = lazySchema14(
3197
+ () => zodSchema14(
3187
3198
  z14.object({
3188
3199
  status: z14.enum(["completed", "failed"]),
3189
3200
  output: z14.string().optional()
3190
3201
  })
3191
3202
  )
3192
3203
  );
3193
- var applyPatchArgsSchema = lazySchema13(() => zodSchema13(z14.object({})));
3204
+ var applyPatchArgsSchema = lazySchema14(() => zodSchema14(z14.object({})));
3194
3205
  var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
3195
3206
  id: "openai.apply_patch",
3196
3207
  inputSchema: applyPatchInputSchema,
@@ -3201,12 +3212,12 @@ var applyPatch = applyPatchToolFactory;
3201
3212
  // src/tool/local-shell.ts
3202
3213
  import {
3203
3214
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
3204
- lazySchema as lazySchema14,
3205
- zodSchema as zodSchema14
3215
+ lazySchema as lazySchema15,
3216
+ zodSchema as zodSchema15
3206
3217
  } from "@ai-sdk/provider-utils";
3207
3218
  import { z as z15 } from "zod/v4";
3208
- var localShellInputSchema = lazySchema14(
3209
- () => zodSchema14(
3219
+ var localShellInputSchema = lazySchema15(
3220
+ () => zodSchema15(
3210
3221
  z15.object({
3211
3222
  action: z15.object({
3212
3223
  type: z15.literal("exec"),
@@ -3219,8 +3230,8 @@ var localShellInputSchema = lazySchema14(
3219
3230
  })
3220
3231
  )
3221
3232
  );
3222
- var localShellOutputSchema = lazySchema14(
3223
- () => zodSchema14(z15.object({ output: z15.string() }))
3233
+ var localShellOutputSchema = lazySchema15(
3234
+ () => zodSchema15(z15.object({ output: z15.string() }))
3224
3235
  );
3225
3236
  var localShell = createProviderToolFactoryWithOutputSchema2({
3226
3237
  id: "openai.local_shell",
@@ -3231,12 +3242,12 @@ var localShell = createProviderToolFactoryWithOutputSchema2({
3231
3242
  // src/tool/shell.ts
3232
3243
  import {
3233
3244
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
3234
- lazySchema as lazySchema15,
3235
- zodSchema as zodSchema15
3245
+ lazySchema as lazySchema16,
3246
+ zodSchema as zodSchema16
3236
3247
  } from "@ai-sdk/provider-utils";
3237
3248
  import { z as z16 } from "zod/v4";
3238
- var shellInputSchema = lazySchema15(
3239
- () => zodSchema15(
3249
+ var shellInputSchema = lazySchema16(
3250
+ () => zodSchema16(
3240
3251
  z16.object({
3241
3252
  action: z16.object({
3242
3253
  commands: z16.array(z16.string()),
@@ -3246,8 +3257,8 @@ var shellInputSchema = lazySchema15(
3246
3257
  })
3247
3258
  )
3248
3259
  );
3249
- var shellOutputSchema = lazySchema15(
3250
- () => zodSchema15(
3260
+ var shellOutputSchema = lazySchema16(
3261
+ () => zodSchema16(
3251
3262
  z16.object({
3252
3263
  output: z16.array(
3253
3264
  z16.object({
@@ -3262,7 +3273,7 @@ var shellOutputSchema = lazySchema15(
3262
3273
  })
3263
3274
  )
3264
3275
  );
3265
- var shellSkillsSchema = z16.array(
3276
+ var shellSkillsSchema = () => z16.array(
3266
3277
  z16.discriminatedUnion("type", [
3267
3278
  z16.object({
3268
3279
  type: z16.literal("skillReference"),
@@ -3281,8 +3292,8 @@ var shellSkillsSchema = z16.array(
3281
3292
  })
3282
3293
  ])
3283
3294
  ).optional();
3284
- var shellArgsSchema = lazySchema15(
3285
- () => zodSchema15(
3295
+ var shellArgsSchema = lazySchema16(
3296
+ () => zodSchema16(
3286
3297
  z16.object({
3287
3298
  environment: z16.union([
3288
3299
  z16.object({
@@ -3303,7 +3314,7 @@ var shellArgsSchema = lazySchema15(
3303
3314
  ).optional()
3304
3315
  })
3305
3316
  ]).optional(),
3306
- skills: shellSkillsSchema
3317
+ skills: shellSkillsSchema()
3307
3318
  }),
3308
3319
  z16.object({
3309
3320
  type: z16.literal("containerReference"),
@@ -3332,12 +3343,12 @@ var shell = createProviderToolFactoryWithOutputSchema3({
3332
3343
  // src/tool/tool-search.ts
3333
3344
  import {
3334
3345
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
3335
- lazySchema as lazySchema16,
3336
- zodSchema as zodSchema16
3346
+ lazySchema as lazySchema17,
3347
+ zodSchema as zodSchema17
3337
3348
  } from "@ai-sdk/provider-utils";
3338
3349
  import { z as z17 } from "zod/v4";
3339
- var toolSearchArgsSchema = lazySchema16(
3340
- () => zodSchema16(
3350
+ var toolSearchArgsSchema = lazySchema17(
3351
+ () => zodSchema17(
3341
3352
  z17.object({
3342
3353
  execution: z17.enum(["server", "client"]).optional(),
3343
3354
  description: z17.string().optional(),
@@ -3345,16 +3356,16 @@ var toolSearchArgsSchema = lazySchema16(
3345
3356
  })
3346
3357
  )
3347
3358
  );
3348
- var toolSearchInputSchema = lazySchema16(
3349
- () => zodSchema16(
3359
+ var toolSearchInputSchema = lazySchema17(
3360
+ () => zodSchema17(
3350
3361
  z17.object({
3351
3362
  arguments: z17.unknown().optional(),
3352
3363
  call_id: z17.string().nullish()
3353
3364
  })
3354
3365
  )
3355
3366
  );
3356
- var toolSearchOutputSchema = lazySchema16(
3357
- () => zodSchema16(
3367
+ var toolSearchOutputSchema = lazySchema17(
3368
+ () => zodSchema17(
3358
3369
  z17.object({
3359
3370
  tools: z17.array(z17.record(z17.string(), z17.unknown()))
3360
3371
  })
@@ -3365,16 +3376,17 @@ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
3365
3376
  inputSchema: toolSearchInputSchema,
3366
3377
  outputSchema: toolSearchOutputSchema
3367
3378
  });
3379
+ var toolSearch = (args = {}) => toolSearchToolFactory(args);
3368
3380
 
3369
3381
  // src/tool/web-search.ts
3370
3382
  import {
3371
3383
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3372
- lazySchema as lazySchema17,
3373
- zodSchema as zodSchema17
3384
+ lazySchema as lazySchema18,
3385
+ zodSchema as zodSchema18
3374
3386
  } from "@ai-sdk/provider-utils";
3375
3387
  import { z as z18 } from "zod/v4";
3376
- var webSearchArgsSchema = lazySchema17(
3377
- () => zodSchema17(
3388
+ var webSearchArgsSchema = lazySchema18(
3389
+ () => zodSchema18(
3378
3390
  z18.object({
3379
3391
  externalWebAccess: z18.boolean().optional(),
3380
3392
  filters: z18.object({
@@ -3392,9 +3404,9 @@ var webSearchArgsSchema = lazySchema17(
3392
3404
  })
3393
3405
  )
3394
3406
  );
3395
- var webSearchInputSchema = lazySchema17(() => zodSchema17(z18.object({})));
3396
- var webSearchOutputSchema = lazySchema17(
3397
- () => zodSchema17(
3407
+ var webSearchInputSchema = lazySchema18(() => zodSchema18(z18.object({})));
3408
+ var webSearchOutputSchema = lazySchema18(
3409
+ () => zodSchema18(
3398
3410
  z18.object({
3399
3411
  action: z18.discriminatedUnion("type", [
3400
3412
  z18.object({
@@ -4542,10 +4554,14 @@ ${text}`,
4542
4554
  }
4543
4555
  return { input, warnings };
4544
4556
  }
4545
- var openaiResponsesReasoningProviderOptionsSchema = z19.object({
4546
- itemId: z19.string().nullish(),
4547
- reasoningEncryptedContent: z19.string().nullish()
4548
- });
4557
+ var openaiResponsesReasoningProviderOptionsSchema = lazySchema19(
4558
+ () => zodSchema19(
4559
+ z19.object({
4560
+ itemId: z19.string().nullish(),
4561
+ reasoningEncryptedContent: z19.string().nullish()
4562
+ })
4563
+ )
4564
+ );
4549
4565
 
4550
4566
  // src/responses/map-openai-responses-finish-reason.ts
4551
4567
  function mapOpenAIResponseFinishReason({
@@ -4567,37 +4583,45 @@ function mapOpenAIResponseFinishReason({
4567
4583
 
4568
4584
  // src/responses/openai-responses-api.ts
4569
4585
  import {
4570
- lazySchema as lazySchema18,
4571
- zodSchema as zodSchema18
4586
+ lazySchema as lazySchema20,
4587
+ zodSchema as zodSchema20
4572
4588
  } from "@ai-sdk/provider-utils";
4573
4589
  import { z as z20 } from "zod/v4";
4574
- var jsonValueSchema = z20.lazy(
4590
+ var cachedJsonValueSchema;
4591
+ var jsonValueSchema = () => cachedJsonValueSchema != null ? cachedJsonValueSchema : cachedJsonValueSchema = z20.lazy(
4575
4592
  () => z20.union([
4576
4593
  z20.string(),
4577
4594
  z20.number(),
4578
4595
  z20.boolean(),
4579
4596
  z20.null(),
4580
- z20.array(jsonValueSchema),
4581
- z20.record(z20.string(), jsonValueSchema.optional())
4597
+ z20.array(jsonValueSchema()),
4598
+ z20.record(z20.string(), jsonValueSchema().optional())
4582
4599
  ])
4583
4600
  );
4584
- var jsonObjectSchema = z20.record(z20.string(), jsonValueSchema.optional());
4585
- var openaiResponsesUsageSchema = z20.intersection(
4586
- jsonObjectSchema,
4601
+ var jsonObjectSchema = () => z20.record(z20.string(), jsonValueSchema().optional());
4602
+ var openaiResponsesUsageSchema = () => z20.intersection(
4603
+ jsonObjectSchema(),
4587
4604
  z20.object({
4588
4605
  input_tokens: z20.number(),
4589
4606
  input_tokens_details: z20.intersection(
4590
- jsonObjectSchema,
4607
+ jsonObjectSchema(),
4591
4608
  z20.object({
4592
4609
  cached_tokens: z20.number().nullish(),
4593
4610
  cache_write_tokens: z20.number().nullish(),
4611
+ cache_write_tokens_details: z20.intersection(
4612
+ jsonObjectSchema(),
4613
+ z20.object({
4614
+ ttl_30m_tokens: z20.number().nullish(),
4615
+ ttl_12h_tokens: z20.number().nullish()
4616
+ })
4617
+ ).nullish(),
4594
4618
  orchestration_input_tokens: z20.number().nullish(),
4595
4619
  orchestration_input_cached_tokens: z20.number().nullish()
4596
4620
  })
4597
4621
  ).nullish(),
4598
4622
  output_tokens: z20.number(),
4599
4623
  output_tokens_details: z20.intersection(
4600
- jsonObjectSchema,
4624
+ jsonObjectSchema(),
4601
4625
  z20.object({
4602
4626
  reasoning_tokens: z20.number().nullish(),
4603
4627
  orchestration_output_tokens: z20.number().nullish()
@@ -4609,7 +4633,7 @@ var openaiResponsesUsageSchema = z20.intersection(
4609
4633
  function isRecord(value) {
4610
4634
  return value != null && typeof value === "object" && !Array.isArray(value);
4611
4635
  }
4612
- var openaiResponsesLocalShellCallSchema = z20.object({
4636
+ var openaiResponsesLocalShellCallSchema = () => z20.object({
4613
4637
  type: z20.literal("local_shell_call"),
4614
4638
  id: z20.string(),
4615
4639
  call_id: z20.string(),
@@ -4622,7 +4646,7 @@ var openaiResponsesLocalShellCallSchema = z20.object({
4622
4646
  env: z20.record(z20.string(), z20.string()).optional()
4623
4647
  })
4624
4648
  });
4625
- var openaiResponsesNestedErrorChunkSchema = z20.object({
4649
+ var openaiResponsesNestedErrorChunkSchema = () => z20.object({
4626
4650
  type: z20.literal("error"),
4627
4651
  sequence_number: z20.number(),
4628
4652
  error: z20.object({
@@ -4632,7 +4656,7 @@ var openaiResponsesNestedErrorChunkSchema = z20.object({
4632
4656
  param: z20.string().nullish()
4633
4657
  })
4634
4658
  });
4635
- var openaiResponsesErrorChunkSchema = z20.object({
4659
+ var openaiResponsesErrorChunkSchema = () => z20.object({
4636
4660
  type: z20.literal("error"),
4637
4661
  sequence_number: z20.number(),
4638
4662
  code: z20.string().nullish(),
@@ -4693,8 +4717,8 @@ function isModeledOpenAIResponsesChunk(value) {
4693
4717
  }
4694
4718
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4695
4719
  }
4696
- var openaiResponsesChunkSchema = lazySchema18(
4697
- () => zodSchema18(
4720
+ var openaiResponsesChunkSchema = lazySchema20(
4721
+ () => zodSchema20(
4698
4722
  z20.union([
4699
4723
  z20.object({
4700
4724
  type: z20.literal("response.output_text.delta"),
@@ -4717,7 +4741,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4717
4741
  type: z20.enum(["response.completed", "response.incomplete"]),
4718
4742
  response: z20.object({
4719
4743
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4720
- usage: openaiResponsesUsageSchema.nullish(),
4744
+ usage: openaiResponsesUsageSchema().nullish(),
4721
4745
  reasoning: z20.object({
4722
4746
  context: z20.string().nullish()
4723
4747
  }).nullish(),
@@ -4733,7 +4757,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4733
4757
  message: z20.string()
4734
4758
  }).nullish(),
4735
4759
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4736
- usage: openaiResponsesUsageSchema.nullish(),
4760
+ usage: openaiResponsesUsageSchema().nullish(),
4737
4761
  reasoning: z20.object({
4738
4762
  context: z20.string().nullish()
4739
4763
  }).nullish(),
@@ -4786,7 +4810,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4786
4810
  type: z20.literal("file_search_call"),
4787
4811
  id: z20.string()
4788
4812
  }),
4789
- openaiResponsesLocalShellCallSchema,
4813
+ openaiResponsesLocalShellCallSchema(),
4790
4814
  z20.object({
4791
4815
  type: z20.literal("image_generation_call"),
4792
4816
  id: z20.string()
@@ -4890,7 +4914,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4890
4914
  execution: z20.enum(["server", "client"]),
4891
4915
  call_id: z20.string().nullable(),
4892
4916
  status: z20.enum(["in_progress", "completed", "incomplete"]),
4893
- tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
4917
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema().optional()))
4894
4918
  })
4895
4919
  ])
4896
4920
  }),
@@ -4988,7 +5012,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4988
5012
  })
4989
5013
  ).nullish()
4990
5014
  }),
4991
- openaiResponsesLocalShellCallSchema,
5015
+ openaiResponsesLocalShellCallSchema(),
4992
5016
  z20.object({
4993
5017
  type: z20.literal("computer_call"),
4994
5018
  id: z20.string(),
@@ -5105,7 +5129,7 @@ var openaiResponsesChunkSchema = lazySchema18(
5105
5129
  execution: z20.enum(["server", "client"]),
5106
5130
  call_id: z20.string().nullable(),
5107
5131
  status: z20.enum(["in_progress", "completed", "incomplete"]),
5108
- tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
5132
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema().optional()))
5109
5133
  })
5110
5134
  ])
5111
5135
  }),
@@ -5207,8 +5231,8 @@ var openaiResponsesChunkSchema = lazySchema18(
5207
5231
  output_index: z20.number(),
5208
5232
  diff: z20.string()
5209
5233
  }),
5210
- openaiResponsesNestedErrorChunkSchema,
5211
- openaiResponsesErrorChunkSchema,
5234
+ openaiResponsesNestedErrorChunkSchema(),
5235
+ openaiResponsesErrorChunkSchema(),
5212
5236
  z20.object({ type: z20.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5213
5237
  message: "Known response chunk failed schema validation"
5214
5238
  }).transform((value) => ({
@@ -5219,8 +5243,8 @@ var openaiResponsesChunkSchema = lazySchema18(
5219
5243
  ])
5220
5244
  )
5221
5245
  );
5222
- var openaiResponsesResponseSchema = lazySchema18(
5223
- () => zodSchema18(
5246
+ var openaiResponsesResponseSchema = lazySchema20(
5247
+ () => zodSchema20(
5224
5248
  z20.object({
5225
5249
  id: z20.string().optional(),
5226
5250
  created_at: z20.number().optional(),
@@ -5351,7 +5375,7 @@ var openaiResponsesResponseSchema = lazySchema18(
5351
5375
  id: z20.string(),
5352
5376
  result: z20.string()
5353
5377
  }),
5354
- openaiResponsesLocalShellCallSchema,
5378
+ openaiResponsesLocalShellCallSchema(),
5355
5379
  z20.object({
5356
5380
  type: z20.literal("function_call"),
5357
5381
  call_id: z20.string(),
@@ -5496,7 +5520,9 @@ var openaiResponsesResponseSchema = lazySchema18(
5496
5520
  execution: z20.enum(["server", "client"]),
5497
5521
  call_id: z20.string().nullable(),
5498
5522
  status: z20.enum(["in_progress", "completed", "incomplete"]),
5499
- tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
5523
+ tools: z20.array(
5524
+ z20.record(z20.string(), jsonValueSchema().optional())
5525
+ )
5500
5526
  })
5501
5527
  ])
5502
5528
  ).optional(),
@@ -5505,7 +5531,7 @@ var openaiResponsesResponseSchema = lazySchema18(
5505
5531
  context: z20.string().nullish()
5506
5532
  }).nullish(),
5507
5533
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
5508
- usage: openaiResponsesUsageSchema.nullish()
5534
+ usage: openaiResponsesUsageSchema().nullish()
5509
5535
  })
5510
5536
  )
5511
5537
  );
@@ -5519,20 +5545,20 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
5519
5545
  // src/tool/code-interpreter.ts
5520
5546
  import {
5521
5547
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
5522
- lazySchema as lazySchema19,
5523
- zodSchema as zodSchema19
5548
+ lazySchema as lazySchema21,
5549
+ zodSchema as zodSchema21
5524
5550
  } from "@ai-sdk/provider-utils";
5525
5551
  import { z as z21 } from "zod/v4";
5526
- var codeInterpreterInputSchema = lazySchema19(
5527
- () => zodSchema19(
5552
+ var codeInterpreterInputSchema = lazySchema21(
5553
+ () => zodSchema21(
5528
5554
  z21.object({
5529
5555
  code: z21.string().nullish(),
5530
5556
  containerId: z21.string()
5531
5557
  })
5532
5558
  )
5533
5559
  );
5534
- var codeInterpreterOutputSchema = lazySchema19(
5535
- () => zodSchema19(
5560
+ var codeInterpreterOutputSchema = lazySchema21(
5561
+ () => zodSchema21(
5536
5562
  z21.object({
5537
5563
  outputs: z21.array(
5538
5564
  z21.discriminatedUnion("type", [
@@ -5543,8 +5569,8 @@ var codeInterpreterOutputSchema = lazySchema19(
5543
5569
  })
5544
5570
  )
5545
5571
  );
5546
- var codeInterpreterArgsSchema = lazySchema19(
5547
- () => zodSchema19(
5572
+ var codeInterpreterArgsSchema = lazySchema21(
5573
+ () => zodSchema21(
5548
5574
  z21.object({
5549
5575
  container: z21.union([
5550
5576
  z21.string(),
@@ -5567,23 +5593,24 @@ var codeInterpreter = (args = {}) => {
5567
5593
  // src/tool/file-search.ts
5568
5594
  import {
5569
5595
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
5570
- lazySchema as lazySchema20,
5571
- zodSchema as zodSchema20
5596
+ lazySchema as lazySchema22,
5597
+ zodSchema as zodSchema22
5572
5598
  } from "@ai-sdk/provider-utils";
5573
5599
  import { z as z22 } from "zod/v4";
5574
- var comparisonFilterSchema = z22.object({
5600
+ var comparisonFilterSchema = () => z22.object({
5575
5601
  key: z22.string(),
5576
5602
  type: z22.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5577
5603
  value: z22.union([z22.string(), z22.number(), z22.boolean(), z22.array(z22.string())])
5578
5604
  });
5579
- var compoundFilterSchema = z22.object({
5605
+ var cachedCompoundFilterSchema;
5606
+ var compoundFilterSchema = () => cachedCompoundFilterSchema != null ? cachedCompoundFilterSchema : cachedCompoundFilterSchema = z22.object({
5580
5607
  type: z22.enum(["and", "or"]),
5581
5608
  filters: z22.array(
5582
- z22.union([comparisonFilterSchema, z22.lazy(() => compoundFilterSchema)])
5609
+ z22.union([comparisonFilterSchema(), z22.lazy(() => compoundFilterSchema())])
5583
5610
  )
5584
5611
  });
5585
- var fileSearchArgsSchema = lazySchema20(
5586
- () => zodSchema20(
5612
+ var fileSearchArgsSchema = lazySchema22(
5613
+ () => zodSchema22(
5587
5614
  z22.object({
5588
5615
  vectorStoreIds: z22.array(z22.string()),
5589
5616
  maxNumResults: z22.number().optional(),
@@ -5591,12 +5618,12 @@ var fileSearchArgsSchema = lazySchema20(
5591
5618
  ranker: z22.string().optional(),
5592
5619
  scoreThreshold: z22.number().optional()
5593
5620
  }).optional(),
5594
- filters: z22.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5621
+ filters: z22.union([comparisonFilterSchema(), compoundFilterSchema()]).optional()
5595
5622
  })
5596
5623
  )
5597
5624
  );
5598
- var fileSearchOutputSchema = lazySchema20(
5599
- () => zodSchema20(
5625
+ var fileSearchOutputSchema = lazySchema22(
5626
+ () => zodSchema22(
5600
5627
  z22.object({
5601
5628
  queries: z22.array(z22.string()),
5602
5629
  results: z22.array(
@@ -5620,12 +5647,12 @@ var fileSearch = createProviderToolFactoryWithOutputSchema7({
5620
5647
  // src/tool/image-generation.ts
5621
5648
  import {
5622
5649
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
5623
- lazySchema as lazySchema21,
5624
- zodSchema as zodSchema21
5650
+ lazySchema as lazySchema23,
5651
+ zodSchema as zodSchema23
5625
5652
  } from "@ai-sdk/provider-utils";
5626
5653
  import { z as z23 } from "zod/v4";
5627
- var imageGenerationArgsSchema = lazySchema21(
5628
- () => zodSchema21(
5654
+ var imageGenerationArgsSchema = lazySchema23(
5655
+ () => zodSchema23(
5629
5656
  z23.object({
5630
5657
  background: z23.enum(["auto", "opaque", "transparent"]).optional(),
5631
5658
  inputFidelity: z23.enum(["low", "high"]).optional(),
@@ -5643,9 +5670,9 @@ var imageGenerationArgsSchema = lazySchema21(
5643
5670
  }).strict()
5644
5671
  )
5645
5672
  );
5646
- var imageGenerationInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
5647
- var imageGenerationOutputSchema = lazySchema21(
5648
- () => zodSchema21(z23.object({ result: z23.string() }))
5673
+ var imageGenerationInputSchema = lazySchema23(() => zodSchema23(z23.object({})));
5674
+ var imageGenerationOutputSchema = lazySchema23(
5675
+ () => zodSchema23(z23.object({ result: z23.string() }))
5649
5676
  );
5650
5677
  var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema8({
5651
5678
  id: "openai.image_generation",
@@ -5659,12 +5686,12 @@ var imageGeneration = (args = {}) => {
5659
5686
  // src/tool/custom.ts
5660
5687
  import {
5661
5688
  createProviderToolFactory,
5662
- lazySchema as lazySchema22,
5663
- zodSchema as zodSchema22
5689
+ lazySchema as lazySchema24,
5690
+ zodSchema as zodSchema24
5664
5691
  } from "@ai-sdk/provider-utils";
5665
5692
  import { z as z24 } from "zod/v4";
5666
- var customArgsSchema = lazySchema22(
5667
- () => zodSchema22(
5693
+ var customArgsSchema = lazySchema24(
5694
+ () => zodSchema24(
5668
5695
  z24.object({
5669
5696
  name: z24.string(),
5670
5697
  description: z24.string().optional(),
@@ -5682,7 +5709,7 @@ var customArgsSchema = lazySchema22(
5682
5709
  })
5683
5710
  )
5684
5711
  );
5685
- var customInputSchema = lazySchema22(() => zodSchema22(z24.string()));
5712
+ var customInputSchema = lazySchema24(() => zodSchema24(z24.string()));
5686
5713
  var customToolFactory = createProviderToolFactory({
5687
5714
  id: "openai.custom",
5688
5715
  inputSchema: customInputSchema
@@ -5691,22 +5718,23 @@ var customToolFactory = createProviderToolFactory({
5691
5718
  // src/tool/mcp.ts
5692
5719
  import {
5693
5720
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5694
- lazySchema as lazySchema23,
5695
- zodSchema as zodSchema23
5721
+ lazySchema as lazySchema25,
5722
+ zodSchema as zodSchema25
5696
5723
  } from "@ai-sdk/provider-utils";
5697
5724
  import { z as z25 } from "zod/v4";
5698
- var jsonValueSchema2 = z25.lazy(
5725
+ var cachedJsonValueSchema2;
5726
+ var jsonValueSchema2 = () => cachedJsonValueSchema2 != null ? cachedJsonValueSchema2 : cachedJsonValueSchema2 = z25.lazy(
5699
5727
  () => z25.union([
5700
5728
  z25.string(),
5701
5729
  z25.number(),
5702
5730
  z25.boolean(),
5703
5731
  z25.null(),
5704
- z25.array(jsonValueSchema2),
5705
- z25.record(z25.string(), jsonValueSchema2)
5732
+ z25.array(jsonValueSchema2()),
5733
+ z25.record(z25.string(), jsonValueSchema2())
5706
5734
  ])
5707
5735
  );
5708
- var mcpArgsSchema = lazySchema23(
5709
- () => zodSchema23(
5736
+ var mcpArgsSchema = lazySchema25(
5737
+ () => zodSchema25(
5710
5738
  z25.object({
5711
5739
  serverLabel: z25.string(),
5712
5740
  allowedTools: z25.union([
@@ -5735,16 +5763,16 @@ var mcpArgsSchema = lazySchema23(
5735
5763
  )
5736
5764
  )
5737
5765
  );
5738
- var mcpInputSchema = lazySchema23(() => zodSchema23(z25.object({})));
5739
- var mcpOutputSchema = lazySchema23(
5740
- () => zodSchema23(
5766
+ var mcpInputSchema = lazySchema25(() => zodSchema25(z25.object({})));
5767
+ var mcpOutputSchema = lazySchema25(
5768
+ () => zodSchema25(
5741
5769
  z25.object({
5742
5770
  type: z25.literal("call"),
5743
5771
  serverLabel: z25.string(),
5744
5772
  name: z25.string(),
5745
5773
  arguments: z25.string(),
5746
5774
  output: z25.string().nullish(),
5747
- error: z25.union([z25.string(), jsonValueSchema2]).optional()
5775
+ error: z25.union([z25.string(), jsonValueSchema2()]).optional()
5748
5776
  })
5749
5777
  )
5750
5778
  );
@@ -5757,12 +5785,12 @@ var mcpToolFactory = createProviderToolFactoryWithOutputSchema9({
5757
5785
  // src/tool/web-search-preview.ts
5758
5786
  import {
5759
5787
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
5760
- lazySchema as lazySchema24,
5761
- zodSchema as zodSchema24
5788
+ lazySchema as lazySchema26,
5789
+ zodSchema as zodSchema26
5762
5790
  } from "@ai-sdk/provider-utils";
5763
5791
  import { z as z26 } from "zod/v4";
5764
- var webSearchPreviewArgsSchema = lazySchema24(
5765
- () => zodSchema24(
5792
+ var webSearchPreviewArgsSchema = lazySchema26(
5793
+ () => zodSchema26(
5766
5794
  z26.object({
5767
5795
  searchContextSize: z26.enum(["low", "medium", "high"]).optional(),
5768
5796
  userLocation: z26.object({
@@ -5775,11 +5803,11 @@ var webSearchPreviewArgsSchema = lazySchema24(
5775
5803
  })
5776
5804
  )
5777
5805
  );
5778
- var webSearchPreviewInputSchema = lazySchema24(
5779
- () => zodSchema24(z26.object({}))
5806
+ var webSearchPreviewInputSchema = lazySchema26(
5807
+ () => zodSchema26(z26.object({}))
5780
5808
  );
5781
- var webSearchPreviewOutputSchema = lazySchema24(
5782
- () => zodSchema24(
5809
+ var webSearchPreviewOutputSchema = lazySchema26(
5810
+ () => zodSchema26(
5783
5811
  z26.object({
5784
5812
  action: z26.discriminatedUnion("type", [
5785
5813
  z26.object({
@@ -5812,9 +5840,10 @@ async function prepareResponsesTools({
5812
5840
  allowedTools,
5813
5841
  toolNameMapping,
5814
5842
  customProviderToolNames,
5815
- supportsAsyncToolCalling = true
5843
+ supportsAsyncToolCalling = true,
5844
+ providerOptionsName = "openai"
5816
5845
  }) {
5817
- var _a2, _b, _c, _d;
5846
+ var _a2, _b, _c, _d, _e, _f;
5818
5847
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
5819
5848
  const toolWarnings = [];
5820
5849
  if (tools == null) {
@@ -5840,7 +5869,7 @@ async function prepareResponsesTools({
5840
5869
  for (const tool of tools) {
5841
5870
  switch (tool.type) {
5842
5871
  case "function": {
5843
- const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
5872
+ const openaiOptions = (_c = (_a2 = tool.providerOptions) == null ? void 0 : _a2[providerOptionsName]) != null ? _c : (_b = tool.providerOptions) == null ? void 0 : _b.openai;
5844
5873
  const openaiFunctionTool = prepareFunctionTool({
5845
5874
  tool,
5846
5875
  options: openaiOptions,
@@ -6104,7 +6133,7 @@ async function prepareResponsesTools({
6104
6133
  });
6105
6134
  allowedToolEntries.push({
6106
6135
  type: "function",
6107
- name: (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _b : name
6136
+ name: (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(name)) != null ? _d : name
6108
6137
  });
6109
6138
  continue;
6110
6139
  }
@@ -6130,7 +6159,7 @@ async function prepareResponsesTools({
6130
6159
  tools: openaiTools,
6131
6160
  toolChoice: {
6132
6161
  type: "allowed_tools",
6133
- mode: (_c = allowedTools.mode) != null ? _c : "auto",
6162
+ mode: (_e = allowedTools.mode) != null ? _e : "auto",
6134
6163
  tools: allowedToolEntries
6135
6164
  },
6136
6165
  toolWarnings
@@ -6146,7 +6175,7 @@ async function prepareResponsesTools({
6146
6175
  case "required":
6147
6176
  return { tools: openaiTools, toolChoice: type, toolWarnings };
6148
6177
  case "tool": {
6149
- const resolvedToolName = (_d = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _d : toolChoice.toolName;
6178
+ const resolvedToolName = (_f = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _f : toolChoice.toolName;
6150
6179
  return {
6151
6180
  tools: openaiTools,
6152
6181
  toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
@@ -6418,7 +6447,8 @@ var OpenAIResponsesLanguageModel = class {
6418
6447
  allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
6419
6448
  toolNameMapping,
6420
6449
  customProviderToolNames,
6421
- supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
6450
+ supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling,
6451
+ providerOptionsName
6422
6452
  });
6423
6453
  const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
6424
6454
  modelCapabilities,
@@ -8336,6 +8366,10 @@ export {
8336
8366
  openaiLanguageModelChatOptions,
8337
8367
  openaiLanguageModelCompletionOptions,
8338
8368
  openaiSpeechModelOptionsSchema,
8369
+ toolSearch,
8370
+ toolSearchArgsSchema,
8371
+ toolSearchInputSchema,
8372
+ toolSearchOutputSchema,
8339
8373
  webSearch,
8340
8374
  webSearchArgsSchema,
8341
8375
  webSearchOutputSchema,