@ai-sdk/openai 3.0.130 → 3.0.131

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
  })
@@ -3369,12 +3380,12 @@ var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
3369
3380
  // src/tool/web-search.ts
3370
3381
  import {
3371
3382
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
3372
- lazySchema as lazySchema17,
3373
- zodSchema as zodSchema17
3383
+ lazySchema as lazySchema18,
3384
+ zodSchema as zodSchema18
3374
3385
  } from "@ai-sdk/provider-utils";
3375
3386
  import { z as z18 } from "zod/v4";
3376
- var webSearchArgsSchema = lazySchema17(
3377
- () => zodSchema17(
3387
+ var webSearchArgsSchema = lazySchema18(
3388
+ () => zodSchema18(
3378
3389
  z18.object({
3379
3390
  externalWebAccess: z18.boolean().optional(),
3380
3391
  filters: z18.object({
@@ -3392,9 +3403,9 @@ var webSearchArgsSchema = lazySchema17(
3392
3403
  })
3393
3404
  )
3394
3405
  );
3395
- var webSearchInputSchema = lazySchema17(() => zodSchema17(z18.object({})));
3396
- var webSearchOutputSchema = lazySchema17(
3397
- () => zodSchema17(
3406
+ var webSearchInputSchema = lazySchema18(() => zodSchema18(z18.object({})));
3407
+ var webSearchOutputSchema = lazySchema18(
3408
+ () => zodSchema18(
3398
3409
  z18.object({
3399
3410
  action: z18.discriminatedUnion("type", [
3400
3411
  z18.object({
@@ -4542,10 +4553,14 @@ ${text}`,
4542
4553
  }
4543
4554
  return { input, warnings };
4544
4555
  }
4545
- var openaiResponsesReasoningProviderOptionsSchema = z19.object({
4546
- itemId: z19.string().nullish(),
4547
- reasoningEncryptedContent: z19.string().nullish()
4548
- });
4556
+ var openaiResponsesReasoningProviderOptionsSchema = lazySchema19(
4557
+ () => zodSchema19(
4558
+ z19.object({
4559
+ itemId: z19.string().nullish(),
4560
+ reasoningEncryptedContent: z19.string().nullish()
4561
+ })
4562
+ )
4563
+ );
4549
4564
 
4550
4565
  // src/responses/map-openai-responses-finish-reason.ts
4551
4566
  function mapOpenAIResponseFinishReason({
@@ -4567,37 +4582,45 @@ function mapOpenAIResponseFinishReason({
4567
4582
 
4568
4583
  // src/responses/openai-responses-api.ts
4569
4584
  import {
4570
- lazySchema as lazySchema18,
4571
- zodSchema as zodSchema18
4585
+ lazySchema as lazySchema20,
4586
+ zodSchema as zodSchema20
4572
4587
  } from "@ai-sdk/provider-utils";
4573
4588
  import { z as z20 } from "zod/v4";
4574
- var jsonValueSchema = z20.lazy(
4589
+ var cachedJsonValueSchema;
4590
+ var jsonValueSchema = () => cachedJsonValueSchema != null ? cachedJsonValueSchema : cachedJsonValueSchema = z20.lazy(
4575
4591
  () => z20.union([
4576
4592
  z20.string(),
4577
4593
  z20.number(),
4578
4594
  z20.boolean(),
4579
4595
  z20.null(),
4580
- z20.array(jsonValueSchema),
4581
- z20.record(z20.string(), jsonValueSchema.optional())
4596
+ z20.array(jsonValueSchema()),
4597
+ z20.record(z20.string(), jsonValueSchema().optional())
4582
4598
  ])
4583
4599
  );
4584
- var jsonObjectSchema = z20.record(z20.string(), jsonValueSchema.optional());
4585
- var openaiResponsesUsageSchema = z20.intersection(
4586
- jsonObjectSchema,
4600
+ var jsonObjectSchema = () => z20.record(z20.string(), jsonValueSchema().optional());
4601
+ var openaiResponsesUsageSchema = () => z20.intersection(
4602
+ jsonObjectSchema(),
4587
4603
  z20.object({
4588
4604
  input_tokens: z20.number(),
4589
4605
  input_tokens_details: z20.intersection(
4590
- jsonObjectSchema,
4606
+ jsonObjectSchema(),
4591
4607
  z20.object({
4592
4608
  cached_tokens: z20.number().nullish(),
4593
4609
  cache_write_tokens: z20.number().nullish(),
4610
+ cache_write_tokens_details: z20.intersection(
4611
+ jsonObjectSchema(),
4612
+ z20.object({
4613
+ ttl_30m_tokens: z20.number().nullish(),
4614
+ ttl_12h_tokens: z20.number().nullish()
4615
+ })
4616
+ ).nullish(),
4594
4617
  orchestration_input_tokens: z20.number().nullish(),
4595
4618
  orchestration_input_cached_tokens: z20.number().nullish()
4596
4619
  })
4597
4620
  ).nullish(),
4598
4621
  output_tokens: z20.number(),
4599
4622
  output_tokens_details: z20.intersection(
4600
- jsonObjectSchema,
4623
+ jsonObjectSchema(),
4601
4624
  z20.object({
4602
4625
  reasoning_tokens: z20.number().nullish(),
4603
4626
  orchestration_output_tokens: z20.number().nullish()
@@ -4609,7 +4632,7 @@ var openaiResponsesUsageSchema = z20.intersection(
4609
4632
  function isRecord(value) {
4610
4633
  return value != null && typeof value === "object" && !Array.isArray(value);
4611
4634
  }
4612
- var openaiResponsesLocalShellCallSchema = z20.object({
4635
+ var openaiResponsesLocalShellCallSchema = () => z20.object({
4613
4636
  type: z20.literal("local_shell_call"),
4614
4637
  id: z20.string(),
4615
4638
  call_id: z20.string(),
@@ -4622,7 +4645,7 @@ var openaiResponsesLocalShellCallSchema = z20.object({
4622
4645
  env: z20.record(z20.string(), z20.string()).optional()
4623
4646
  })
4624
4647
  });
4625
- var openaiResponsesNestedErrorChunkSchema = z20.object({
4648
+ var openaiResponsesNestedErrorChunkSchema = () => z20.object({
4626
4649
  type: z20.literal("error"),
4627
4650
  sequence_number: z20.number(),
4628
4651
  error: z20.object({
@@ -4632,7 +4655,7 @@ var openaiResponsesNestedErrorChunkSchema = z20.object({
4632
4655
  param: z20.string().nullish()
4633
4656
  })
4634
4657
  });
4635
- var openaiResponsesErrorChunkSchema = z20.object({
4658
+ var openaiResponsesErrorChunkSchema = () => z20.object({
4636
4659
  type: z20.literal("error"),
4637
4660
  sequence_number: z20.number(),
4638
4661
  code: z20.string().nullish(),
@@ -4693,8 +4716,8 @@ function isModeledOpenAIResponsesChunk(value) {
4693
4716
  }
4694
4717
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4695
4718
  }
4696
- var openaiResponsesChunkSchema = lazySchema18(
4697
- () => zodSchema18(
4719
+ var openaiResponsesChunkSchema = lazySchema20(
4720
+ () => zodSchema20(
4698
4721
  z20.union([
4699
4722
  z20.object({
4700
4723
  type: z20.literal("response.output_text.delta"),
@@ -4717,7 +4740,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4717
4740
  type: z20.enum(["response.completed", "response.incomplete"]),
4718
4741
  response: z20.object({
4719
4742
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4720
- usage: openaiResponsesUsageSchema.nullish(),
4743
+ usage: openaiResponsesUsageSchema().nullish(),
4721
4744
  reasoning: z20.object({
4722
4745
  context: z20.string().nullish()
4723
4746
  }).nullish(),
@@ -4733,7 +4756,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4733
4756
  message: z20.string()
4734
4757
  }).nullish(),
4735
4758
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4736
- usage: openaiResponsesUsageSchema.nullish(),
4759
+ usage: openaiResponsesUsageSchema().nullish(),
4737
4760
  reasoning: z20.object({
4738
4761
  context: z20.string().nullish()
4739
4762
  }).nullish(),
@@ -4786,7 +4809,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4786
4809
  type: z20.literal("file_search_call"),
4787
4810
  id: z20.string()
4788
4811
  }),
4789
- openaiResponsesLocalShellCallSchema,
4812
+ openaiResponsesLocalShellCallSchema(),
4790
4813
  z20.object({
4791
4814
  type: z20.literal("image_generation_call"),
4792
4815
  id: z20.string()
@@ -4890,7 +4913,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4890
4913
  execution: z20.enum(["server", "client"]),
4891
4914
  call_id: z20.string().nullable(),
4892
4915
  status: z20.enum(["in_progress", "completed", "incomplete"]),
4893
- tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
4916
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema().optional()))
4894
4917
  })
4895
4918
  ])
4896
4919
  }),
@@ -4988,7 +5011,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4988
5011
  })
4989
5012
  ).nullish()
4990
5013
  }),
4991
- openaiResponsesLocalShellCallSchema,
5014
+ openaiResponsesLocalShellCallSchema(),
4992
5015
  z20.object({
4993
5016
  type: z20.literal("computer_call"),
4994
5017
  id: z20.string(),
@@ -5105,7 +5128,7 @@ var openaiResponsesChunkSchema = lazySchema18(
5105
5128
  execution: z20.enum(["server", "client"]),
5106
5129
  call_id: z20.string().nullable(),
5107
5130
  status: z20.enum(["in_progress", "completed", "incomplete"]),
5108
- tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
5131
+ tools: z20.array(z20.record(z20.string(), jsonValueSchema().optional()))
5109
5132
  })
5110
5133
  ])
5111
5134
  }),
@@ -5207,8 +5230,8 @@ var openaiResponsesChunkSchema = lazySchema18(
5207
5230
  output_index: z20.number(),
5208
5231
  diff: z20.string()
5209
5232
  }),
5210
- openaiResponsesNestedErrorChunkSchema,
5211
- openaiResponsesErrorChunkSchema,
5233
+ openaiResponsesNestedErrorChunkSchema(),
5234
+ openaiResponsesErrorChunkSchema(),
5212
5235
  z20.object({ type: z20.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5213
5236
  message: "Known response chunk failed schema validation"
5214
5237
  }).transform((value) => ({
@@ -5219,8 +5242,8 @@ var openaiResponsesChunkSchema = lazySchema18(
5219
5242
  ])
5220
5243
  )
5221
5244
  );
5222
- var openaiResponsesResponseSchema = lazySchema18(
5223
- () => zodSchema18(
5245
+ var openaiResponsesResponseSchema = lazySchema20(
5246
+ () => zodSchema20(
5224
5247
  z20.object({
5225
5248
  id: z20.string().optional(),
5226
5249
  created_at: z20.number().optional(),
@@ -5351,7 +5374,7 @@ var openaiResponsesResponseSchema = lazySchema18(
5351
5374
  id: z20.string(),
5352
5375
  result: z20.string()
5353
5376
  }),
5354
- openaiResponsesLocalShellCallSchema,
5377
+ openaiResponsesLocalShellCallSchema(),
5355
5378
  z20.object({
5356
5379
  type: z20.literal("function_call"),
5357
5380
  call_id: z20.string(),
@@ -5496,7 +5519,9 @@ var openaiResponsesResponseSchema = lazySchema18(
5496
5519
  execution: z20.enum(["server", "client"]),
5497
5520
  call_id: z20.string().nullable(),
5498
5521
  status: z20.enum(["in_progress", "completed", "incomplete"]),
5499
- tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
5522
+ tools: z20.array(
5523
+ z20.record(z20.string(), jsonValueSchema().optional())
5524
+ )
5500
5525
  })
5501
5526
  ])
5502
5527
  ).optional(),
@@ -5505,7 +5530,7 @@ var openaiResponsesResponseSchema = lazySchema18(
5505
5530
  context: z20.string().nullish()
5506
5531
  }).nullish(),
5507
5532
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
5508
- usage: openaiResponsesUsageSchema.nullish()
5533
+ usage: openaiResponsesUsageSchema().nullish()
5509
5534
  })
5510
5535
  )
5511
5536
  );
@@ -5519,20 +5544,20 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
5519
5544
  // src/tool/code-interpreter.ts
5520
5545
  import {
5521
5546
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
5522
- lazySchema as lazySchema19,
5523
- zodSchema as zodSchema19
5547
+ lazySchema as lazySchema21,
5548
+ zodSchema as zodSchema21
5524
5549
  } from "@ai-sdk/provider-utils";
5525
5550
  import { z as z21 } from "zod/v4";
5526
- var codeInterpreterInputSchema = lazySchema19(
5527
- () => zodSchema19(
5551
+ var codeInterpreterInputSchema = lazySchema21(
5552
+ () => zodSchema21(
5528
5553
  z21.object({
5529
5554
  code: z21.string().nullish(),
5530
5555
  containerId: z21.string()
5531
5556
  })
5532
5557
  )
5533
5558
  );
5534
- var codeInterpreterOutputSchema = lazySchema19(
5535
- () => zodSchema19(
5559
+ var codeInterpreterOutputSchema = lazySchema21(
5560
+ () => zodSchema21(
5536
5561
  z21.object({
5537
5562
  outputs: z21.array(
5538
5563
  z21.discriminatedUnion("type", [
@@ -5543,8 +5568,8 @@ var codeInterpreterOutputSchema = lazySchema19(
5543
5568
  })
5544
5569
  )
5545
5570
  );
5546
- var codeInterpreterArgsSchema = lazySchema19(
5547
- () => zodSchema19(
5571
+ var codeInterpreterArgsSchema = lazySchema21(
5572
+ () => zodSchema21(
5548
5573
  z21.object({
5549
5574
  container: z21.union([
5550
5575
  z21.string(),
@@ -5567,23 +5592,24 @@ var codeInterpreter = (args = {}) => {
5567
5592
  // src/tool/file-search.ts
5568
5593
  import {
5569
5594
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
5570
- lazySchema as lazySchema20,
5571
- zodSchema as zodSchema20
5595
+ lazySchema as lazySchema22,
5596
+ zodSchema as zodSchema22
5572
5597
  } from "@ai-sdk/provider-utils";
5573
5598
  import { z as z22 } from "zod/v4";
5574
- var comparisonFilterSchema = z22.object({
5599
+ var comparisonFilterSchema = () => z22.object({
5575
5600
  key: z22.string(),
5576
5601
  type: z22.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
5577
5602
  value: z22.union([z22.string(), z22.number(), z22.boolean(), z22.array(z22.string())])
5578
5603
  });
5579
- var compoundFilterSchema = z22.object({
5604
+ var cachedCompoundFilterSchema;
5605
+ var compoundFilterSchema = () => cachedCompoundFilterSchema != null ? cachedCompoundFilterSchema : cachedCompoundFilterSchema = z22.object({
5580
5606
  type: z22.enum(["and", "or"]),
5581
5607
  filters: z22.array(
5582
- z22.union([comparisonFilterSchema, z22.lazy(() => compoundFilterSchema)])
5608
+ z22.union([comparisonFilterSchema(), z22.lazy(() => compoundFilterSchema())])
5583
5609
  )
5584
5610
  });
5585
- var fileSearchArgsSchema = lazySchema20(
5586
- () => zodSchema20(
5611
+ var fileSearchArgsSchema = lazySchema22(
5612
+ () => zodSchema22(
5587
5613
  z22.object({
5588
5614
  vectorStoreIds: z22.array(z22.string()),
5589
5615
  maxNumResults: z22.number().optional(),
@@ -5591,12 +5617,12 @@ var fileSearchArgsSchema = lazySchema20(
5591
5617
  ranker: z22.string().optional(),
5592
5618
  scoreThreshold: z22.number().optional()
5593
5619
  }).optional(),
5594
- filters: z22.union([comparisonFilterSchema, compoundFilterSchema]).optional()
5620
+ filters: z22.union([comparisonFilterSchema(), compoundFilterSchema()]).optional()
5595
5621
  })
5596
5622
  )
5597
5623
  );
5598
- var fileSearchOutputSchema = lazySchema20(
5599
- () => zodSchema20(
5624
+ var fileSearchOutputSchema = lazySchema22(
5625
+ () => zodSchema22(
5600
5626
  z22.object({
5601
5627
  queries: z22.array(z22.string()),
5602
5628
  results: z22.array(
@@ -5620,12 +5646,12 @@ var fileSearch = createProviderToolFactoryWithOutputSchema7({
5620
5646
  // src/tool/image-generation.ts
5621
5647
  import {
5622
5648
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
5623
- lazySchema as lazySchema21,
5624
- zodSchema as zodSchema21
5649
+ lazySchema as lazySchema23,
5650
+ zodSchema as zodSchema23
5625
5651
  } from "@ai-sdk/provider-utils";
5626
5652
  import { z as z23 } from "zod/v4";
5627
- var imageGenerationArgsSchema = lazySchema21(
5628
- () => zodSchema21(
5653
+ var imageGenerationArgsSchema = lazySchema23(
5654
+ () => zodSchema23(
5629
5655
  z23.object({
5630
5656
  background: z23.enum(["auto", "opaque", "transparent"]).optional(),
5631
5657
  inputFidelity: z23.enum(["low", "high"]).optional(),
@@ -5643,9 +5669,9 @@ var imageGenerationArgsSchema = lazySchema21(
5643
5669
  }).strict()
5644
5670
  )
5645
5671
  );
5646
- var imageGenerationInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
5647
- var imageGenerationOutputSchema = lazySchema21(
5648
- () => zodSchema21(z23.object({ result: z23.string() }))
5672
+ var imageGenerationInputSchema = lazySchema23(() => zodSchema23(z23.object({})));
5673
+ var imageGenerationOutputSchema = lazySchema23(
5674
+ () => zodSchema23(z23.object({ result: z23.string() }))
5649
5675
  );
5650
5676
  var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema8({
5651
5677
  id: "openai.image_generation",
@@ -5659,12 +5685,12 @@ var imageGeneration = (args = {}) => {
5659
5685
  // src/tool/custom.ts
5660
5686
  import {
5661
5687
  createProviderToolFactory,
5662
- lazySchema as lazySchema22,
5663
- zodSchema as zodSchema22
5688
+ lazySchema as lazySchema24,
5689
+ zodSchema as zodSchema24
5664
5690
  } from "@ai-sdk/provider-utils";
5665
5691
  import { z as z24 } from "zod/v4";
5666
- var customArgsSchema = lazySchema22(
5667
- () => zodSchema22(
5692
+ var customArgsSchema = lazySchema24(
5693
+ () => zodSchema24(
5668
5694
  z24.object({
5669
5695
  name: z24.string(),
5670
5696
  description: z24.string().optional(),
@@ -5682,7 +5708,7 @@ var customArgsSchema = lazySchema22(
5682
5708
  })
5683
5709
  )
5684
5710
  );
5685
- var customInputSchema = lazySchema22(() => zodSchema22(z24.string()));
5711
+ var customInputSchema = lazySchema24(() => zodSchema24(z24.string()));
5686
5712
  var customToolFactory = createProviderToolFactory({
5687
5713
  id: "openai.custom",
5688
5714
  inputSchema: customInputSchema
@@ -5691,22 +5717,23 @@ var customToolFactory = createProviderToolFactory({
5691
5717
  // src/tool/mcp.ts
5692
5718
  import {
5693
5719
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
5694
- lazySchema as lazySchema23,
5695
- zodSchema as zodSchema23
5720
+ lazySchema as lazySchema25,
5721
+ zodSchema as zodSchema25
5696
5722
  } from "@ai-sdk/provider-utils";
5697
5723
  import { z as z25 } from "zod/v4";
5698
- var jsonValueSchema2 = z25.lazy(
5724
+ var cachedJsonValueSchema2;
5725
+ var jsonValueSchema2 = () => cachedJsonValueSchema2 != null ? cachedJsonValueSchema2 : cachedJsonValueSchema2 = z25.lazy(
5699
5726
  () => z25.union([
5700
5727
  z25.string(),
5701
5728
  z25.number(),
5702
5729
  z25.boolean(),
5703
5730
  z25.null(),
5704
- z25.array(jsonValueSchema2),
5705
- z25.record(z25.string(), jsonValueSchema2)
5731
+ z25.array(jsonValueSchema2()),
5732
+ z25.record(z25.string(), jsonValueSchema2())
5706
5733
  ])
5707
5734
  );
5708
- var mcpArgsSchema = lazySchema23(
5709
- () => zodSchema23(
5735
+ var mcpArgsSchema = lazySchema25(
5736
+ () => zodSchema25(
5710
5737
  z25.object({
5711
5738
  serverLabel: z25.string(),
5712
5739
  allowedTools: z25.union([
@@ -5735,16 +5762,16 @@ var mcpArgsSchema = lazySchema23(
5735
5762
  )
5736
5763
  )
5737
5764
  );
5738
- var mcpInputSchema = lazySchema23(() => zodSchema23(z25.object({})));
5739
- var mcpOutputSchema = lazySchema23(
5740
- () => zodSchema23(
5765
+ var mcpInputSchema = lazySchema25(() => zodSchema25(z25.object({})));
5766
+ var mcpOutputSchema = lazySchema25(
5767
+ () => zodSchema25(
5741
5768
  z25.object({
5742
5769
  type: z25.literal("call"),
5743
5770
  serverLabel: z25.string(),
5744
5771
  name: z25.string(),
5745
5772
  arguments: z25.string(),
5746
5773
  output: z25.string().nullish(),
5747
- error: z25.union([z25.string(), jsonValueSchema2]).optional()
5774
+ error: z25.union([z25.string(), jsonValueSchema2()]).optional()
5748
5775
  })
5749
5776
  )
5750
5777
  );
@@ -5757,12 +5784,12 @@ var mcpToolFactory = createProviderToolFactoryWithOutputSchema9({
5757
5784
  // src/tool/web-search-preview.ts
5758
5785
  import {
5759
5786
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
5760
- lazySchema as lazySchema24,
5761
- zodSchema as zodSchema24
5787
+ lazySchema as lazySchema26,
5788
+ zodSchema as zodSchema26
5762
5789
  } from "@ai-sdk/provider-utils";
5763
5790
  import { z as z26 } from "zod/v4";
5764
- var webSearchPreviewArgsSchema = lazySchema24(
5765
- () => zodSchema24(
5791
+ var webSearchPreviewArgsSchema = lazySchema26(
5792
+ () => zodSchema26(
5766
5793
  z26.object({
5767
5794
  searchContextSize: z26.enum(["low", "medium", "high"]).optional(),
5768
5795
  userLocation: z26.object({
@@ -5775,11 +5802,11 @@ var webSearchPreviewArgsSchema = lazySchema24(
5775
5802
  })
5776
5803
  )
5777
5804
  );
5778
- var webSearchPreviewInputSchema = lazySchema24(
5779
- () => zodSchema24(z26.object({}))
5805
+ var webSearchPreviewInputSchema = lazySchema26(
5806
+ () => zodSchema26(z26.object({}))
5780
5807
  );
5781
- var webSearchPreviewOutputSchema = lazySchema24(
5782
- () => zodSchema24(
5808
+ var webSearchPreviewOutputSchema = lazySchema26(
5809
+ () => zodSchema26(
5783
5810
  z26.object({
5784
5811
  action: z26.discriminatedUnion("type", [
5785
5812
  z26.object({