@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.
package/dist/index.mjs CHANGED
@@ -22,8 +22,12 @@ import {
22
22
 
23
23
  // src/openai-error.ts
24
24
  import { z } from "zod/v4";
25
- import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
26
- var openaiErrorDataSchema = z.object({
25
+ import {
26
+ lazySchema,
27
+ zodSchema,
28
+ createJsonErrorResponseHandler
29
+ } from "@ai-sdk/provider-utils";
30
+ var openaiErrorDataSchema = () => z.object({
27
31
  error: z.object({
28
32
  message: z.string(),
29
33
  // The additional information below is handled loosely to support
@@ -34,8 +38,11 @@ var openaiErrorDataSchema = z.object({
34
38
  code: z.union([z.string(), z.number()]).nullish()
35
39
  })
36
40
  });
41
+ var openaiErrorDataSchemaValidator = lazySchema(
42
+ () => zodSchema(openaiErrorDataSchema())
43
+ );
37
44
  var openaiFailedResponseHandler = createJsonErrorResponseHandler({
38
- errorSchema: openaiErrorDataSchema,
45
+ errorSchema: openaiErrorDataSchemaValidator,
39
46
  errorToMessage: (data) => data.error.message
40
47
  });
41
48
 
@@ -651,12 +658,12 @@ function mapOpenAIFinishReason(finishReason) {
651
658
 
652
659
  // src/chat/openai-chat-api.ts
653
660
  import {
654
- lazySchema,
655
- zodSchema
661
+ lazySchema as lazySchema2,
662
+ zodSchema as zodSchema2
656
663
  } from "@ai-sdk/provider-utils";
657
664
  import { z as z2 } from "zod/v4";
658
- var openaiChatResponseSchema = lazySchema(
659
- () => zodSchema(
665
+ var openaiChatResponseSchema = lazySchema2(
666
+ () => zodSchema2(
660
667
  z2.object({
661
668
  id: z2.string().nullish(),
662
669
  created: z2.number().nullish(),
@@ -726,8 +733,8 @@ var openaiChatResponseSchema = lazySchema(
726
733
  })
727
734
  )
728
735
  );
729
- var openaiChatChunkSchema = lazySchema(
730
- () => zodSchema(
736
+ var openaiChatChunkSchema = lazySchema2(
737
+ () => zodSchema2(
731
738
  z2.union([
732
739
  z2.object({
733
740
  id: z2.string().nullish(),
@@ -794,19 +801,19 @@ var openaiChatChunkSchema = lazySchema(
794
801
  }).nullish()
795
802
  }).nullish()
796
803
  }),
797
- openaiErrorDataSchema
804
+ openaiErrorDataSchema()
798
805
  ])
799
806
  )
800
807
  );
801
808
 
802
809
  // src/chat/openai-chat-options.ts
803
810
  import {
804
- lazySchema as lazySchema2,
805
- zodSchema as zodSchema2
811
+ lazySchema as lazySchema3,
812
+ zodSchema as zodSchema3
806
813
  } from "@ai-sdk/provider-utils";
807
814
  import { z as z3 } from "zod/v4";
808
- var openaiLanguageModelChatOptions = lazySchema2(
809
- () => zodSchema2(
815
+ var openaiLanguageModelChatOptions = lazySchema3(
816
+ () => zodSchema3(
810
817
  z3.object({
811
818
  /**
812
819
  * Modify the likelihood of specified tokens appearing in the completion.
@@ -1607,11 +1614,11 @@ function mapOpenAIFinishReason2(finishReason) {
1607
1614
  // src/completion/openai-completion-api.ts
1608
1615
  import { z as z4 } from "zod/v4";
1609
1616
  import {
1610
- lazySchema as lazySchema3,
1611
- zodSchema as zodSchema3
1617
+ lazySchema as lazySchema4,
1618
+ zodSchema as zodSchema4
1612
1619
  } from "@ai-sdk/provider-utils";
1613
- var openaiCompletionResponseSchema = lazySchema3(
1614
- () => zodSchema3(
1620
+ var openaiCompletionResponseSchema = lazySchema4(
1621
+ () => zodSchema4(
1615
1622
  z4.object({
1616
1623
  id: z4.string().nullish(),
1617
1624
  created: z4.number().nullish(),
@@ -1635,8 +1642,8 @@ var openaiCompletionResponseSchema = lazySchema3(
1635
1642
  })
1636
1643
  )
1637
1644
  );
1638
- var openaiCompletionChunkSchema = lazySchema3(
1639
- () => zodSchema3(
1645
+ var openaiCompletionChunkSchema = lazySchema4(
1646
+ () => zodSchema4(
1640
1647
  z4.union([
1641
1648
  z4.object({
1642
1649
  id: z4.string().nullish(),
@@ -1660,19 +1667,19 @@ var openaiCompletionChunkSchema = lazySchema3(
1660
1667
  total_tokens: z4.number()
1661
1668
  }).nullish()
1662
1669
  }),
1663
- openaiErrorDataSchema
1670
+ openaiErrorDataSchema()
1664
1671
  ])
1665
1672
  )
1666
1673
  );
1667
1674
 
1668
1675
  // src/completion/openai-completion-options.ts
1669
1676
  import {
1670
- lazySchema as lazySchema4,
1671
- zodSchema as zodSchema4
1677
+ lazySchema as lazySchema5,
1678
+ zodSchema as zodSchema5
1672
1679
  } from "@ai-sdk/provider-utils";
1673
1680
  import { z as z5 } from "zod/v4";
1674
- var openaiLanguageModelCompletionOptions = lazySchema4(
1675
- () => zodSchema4(
1681
+ var openaiLanguageModelCompletionOptions = lazySchema5(
1682
+ () => zodSchema5(
1676
1683
  z5.object({
1677
1684
  /**
1678
1685
  * Echo back the prompt in addition to the completion.
@@ -1972,12 +1979,12 @@ import {
1972
1979
 
1973
1980
  // src/embedding/openai-embedding-options.ts
1974
1981
  import {
1975
- lazySchema as lazySchema5,
1976
- zodSchema as zodSchema5
1982
+ lazySchema as lazySchema6,
1983
+ zodSchema as zodSchema6
1977
1984
  } from "@ai-sdk/provider-utils";
1978
1985
  import { z as z6 } from "zod/v4";
1979
- var openaiEmbeddingModelOptions = lazySchema5(
1980
- () => zodSchema5(
1986
+ var openaiEmbeddingModelOptions = lazySchema6(
1987
+ () => zodSchema6(
1981
1988
  z6.object({
1982
1989
  /**
1983
1990
  * The number of dimensions the resulting output embeddings should have.
@@ -1994,10 +2001,10 @@ var openaiEmbeddingModelOptions = lazySchema5(
1994
2001
  );
1995
2002
 
1996
2003
  // src/embedding/openai-embedding-api.ts
1997
- import { lazySchema as lazySchema6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
2004
+ import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1998
2005
  import { z as z7 } from "zod/v4";
1999
- var openaiTextEmbeddingResponseSchema = lazySchema6(
2000
- () => zodSchema6(
2006
+ var openaiTextEmbeddingResponseSchema = lazySchema7(
2007
+ () => zodSchema7(
2001
2008
  z7.object({
2002
2009
  data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
2003
2010
  usage: z7.object({ prompt_tokens: z7.number() }).nullish()
@@ -2086,10 +2093,10 @@ import {
2086
2093
  } from "@ai-sdk/provider-utils";
2087
2094
 
2088
2095
  // src/image/openai-image-api.ts
2089
- import { lazySchema as lazySchema7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
2096
+ import { lazySchema as lazySchema8, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
2090
2097
  import { z as z8 } from "zod/v4";
2091
- var openaiImageResponseSchema = lazySchema7(
2092
- () => zodSchema7(
2098
+ var openaiImageResponseSchema = lazySchema8(
2099
+ () => zodSchema8(
2093
2100
  z8.object({
2094
2101
  created: z8.number().nullish(),
2095
2102
  data: z8.array(
@@ -2117,8 +2124,8 @@ var openaiImageResponseSchema = lazySchema7(
2117
2124
 
2118
2125
  // src/image/openai-image-model-options.ts
2119
2126
  import {
2120
- lazySchema as lazySchema8,
2121
- zodSchema as zodSchema8
2127
+ lazySchema as lazySchema9,
2128
+ zodSchema as zodSchema9
2122
2129
  } from "@ai-sdk/provider-utils";
2123
2130
  import { z as z9 } from "zod/v4";
2124
2131
  var modelMaxImagesPerCall = {
@@ -2144,7 +2151,7 @@ function getMaxImagesPerCall(modelId) {
2144
2151
  var _a2;
2145
2152
  return (_a2 = modelMaxImagesPerCall[modelId]) != null ? _a2 : modelId.startsWith("gpt-image-") ? 10 : 1;
2146
2153
  }
2147
- var baseImageModelOptionsObject = z9.object({
2154
+ var baseImageModelOptionsObject = () => z9.object({
2148
2155
  /**
2149
2156
  * Quality of the generated image(s).
2150
2157
  *
@@ -2174,12 +2181,12 @@ var baseImageModelOptionsObject = z9.object({
2174
2181
  */
2175
2182
  user: z9.string().optional()
2176
2183
  });
2177
- var openaiImageModelOptions = lazySchema8(
2178
- () => zodSchema8(baseImageModelOptionsObject)
2184
+ var openaiImageModelOptions = lazySchema9(
2185
+ () => zodSchema9(baseImageModelOptionsObject())
2179
2186
  );
2180
- var openaiImageModelGenerationOptions = lazySchema8(
2181
- () => zodSchema8(
2182
- baseImageModelOptionsObject.extend({
2187
+ var openaiImageModelGenerationOptions = lazySchema9(
2188
+ () => zodSchema9(
2189
+ baseImageModelOptionsObject().extend({
2183
2190
  /**
2184
2191
  * Style of the generated image. `vivid` produces hyper-real and
2185
2192
  * dramatic images; `natural` produces more subdued, less hyper-real
@@ -2194,9 +2201,9 @@ var openaiImageModelGenerationOptions = lazySchema8(
2194
2201
  })
2195
2202
  )
2196
2203
  );
2197
- var openaiImageModelEditOptions = lazySchema8(
2198
- () => zodSchema8(
2199
- baseImageModelOptionsObject.extend({
2204
+ var openaiImageModelEditOptions = lazySchema9(
2205
+ () => zodSchema9(
2206
+ baseImageModelOptionsObject().extend({
2200
2207
  /**
2201
2208
  * Fidelity of the output image(s) to the input image(s).
2202
2209
  */
@@ -2421,12 +2428,12 @@ async function fileToBlob(file) {
2421
2428
  // src/tool/apply-patch.ts
2422
2429
  import {
2423
2430
  createProviderToolFactoryWithOutputSchema,
2424
- lazySchema as lazySchema9,
2425
- zodSchema as zodSchema9
2431
+ lazySchema as lazySchema10,
2432
+ zodSchema as zodSchema10
2426
2433
  } from "@ai-sdk/provider-utils";
2427
2434
  import { z as z10 } from "zod/v4";
2428
- var applyPatchInputSchema = lazySchema9(
2429
- () => zodSchema9(
2435
+ var applyPatchInputSchema = lazySchema10(
2436
+ () => zodSchema10(
2430
2437
  z10.object({
2431
2438
  callId: z10.string(),
2432
2439
  operation: z10.discriminatedUnion("type", [
@@ -2448,15 +2455,15 @@ var applyPatchInputSchema = lazySchema9(
2448
2455
  })
2449
2456
  )
2450
2457
  );
2451
- var applyPatchOutputSchema = lazySchema9(
2452
- () => zodSchema9(
2458
+ var applyPatchOutputSchema = lazySchema10(
2459
+ () => zodSchema10(
2453
2460
  z10.object({
2454
2461
  status: z10.enum(["completed", "failed"]),
2455
2462
  output: z10.string().optional()
2456
2463
  })
2457
2464
  )
2458
2465
  );
2459
- var applyPatchArgsSchema = lazySchema9(() => zodSchema9(z10.object({})));
2466
+ var applyPatchArgsSchema = lazySchema10(() => zodSchema10(z10.object({})));
2460
2467
  var applyPatchToolFactory = createProviderToolFactoryWithOutputSchema({
2461
2468
  id: "openai.apply_patch",
2462
2469
  inputSchema: applyPatchInputSchema,
@@ -2467,20 +2474,20 @@ var applyPatch = applyPatchToolFactory;
2467
2474
  // src/tool/code-interpreter.ts
2468
2475
  import {
2469
2476
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
2470
- lazySchema as lazySchema10,
2471
- zodSchema as zodSchema10
2477
+ lazySchema as lazySchema11,
2478
+ zodSchema as zodSchema11
2472
2479
  } from "@ai-sdk/provider-utils";
2473
2480
  import { z as z11 } from "zod/v4";
2474
- var codeInterpreterInputSchema = lazySchema10(
2475
- () => zodSchema10(
2481
+ var codeInterpreterInputSchema = lazySchema11(
2482
+ () => zodSchema11(
2476
2483
  z11.object({
2477
2484
  code: z11.string().nullish(),
2478
2485
  containerId: z11.string()
2479
2486
  })
2480
2487
  )
2481
2488
  );
2482
- var codeInterpreterOutputSchema = lazySchema10(
2483
- () => zodSchema10(
2489
+ var codeInterpreterOutputSchema = lazySchema11(
2490
+ () => zodSchema11(
2484
2491
  z11.object({
2485
2492
  outputs: z11.array(
2486
2493
  z11.discriminatedUnion("type", [
@@ -2491,8 +2498,8 @@ var codeInterpreterOutputSchema = lazySchema10(
2491
2498
  })
2492
2499
  )
2493
2500
  );
2494
- var codeInterpreterArgsSchema = lazySchema10(
2495
- () => zodSchema10(
2501
+ var codeInterpreterArgsSchema = lazySchema11(
2502
+ () => zodSchema11(
2496
2503
  z11.object({
2497
2504
  container: z11.union([
2498
2505
  z11.string(),
@@ -2515,12 +2522,12 @@ var codeInterpreter = (args = {}) => {
2515
2522
  // src/tool/custom.ts
2516
2523
  import {
2517
2524
  createProviderToolFactory,
2518
- lazySchema as lazySchema11,
2519
- zodSchema as zodSchema11
2525
+ lazySchema as lazySchema12,
2526
+ zodSchema as zodSchema12
2520
2527
  } from "@ai-sdk/provider-utils";
2521
2528
  import { z as z12 } from "zod/v4";
2522
- var customArgsSchema = lazySchema11(
2523
- () => zodSchema11(
2529
+ var customArgsSchema = lazySchema12(
2530
+ () => zodSchema12(
2524
2531
  z12.object({
2525
2532
  name: z12.string(),
2526
2533
  description: z12.string().optional(),
@@ -2538,7 +2545,7 @@ var customArgsSchema = lazySchema11(
2538
2545
  })
2539
2546
  )
2540
2547
  );
2541
- var customInputSchema = lazySchema11(() => zodSchema11(z12.string()));
2548
+ var customInputSchema = lazySchema12(() => zodSchema12(z12.string()));
2542
2549
  var customToolFactory = createProviderToolFactory({
2543
2550
  id: "openai.custom",
2544
2551
  inputSchema: customInputSchema
@@ -2548,23 +2555,24 @@ var customTool = (args) => customToolFactory(args);
2548
2555
  // src/tool/file-search.ts
2549
2556
  import {
2550
2557
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2551
- lazySchema as lazySchema12,
2552
- zodSchema as zodSchema12
2558
+ lazySchema as lazySchema13,
2559
+ zodSchema as zodSchema13
2553
2560
  } from "@ai-sdk/provider-utils";
2554
2561
  import { z as z13 } from "zod/v4";
2555
- var comparisonFilterSchema = z13.object({
2562
+ var comparisonFilterSchema = () => z13.object({
2556
2563
  key: z13.string(),
2557
2564
  type: z13.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
2558
2565
  value: z13.union([z13.string(), z13.number(), z13.boolean(), z13.array(z13.string())])
2559
2566
  });
2560
- var compoundFilterSchema = z13.object({
2567
+ var cachedCompoundFilterSchema;
2568
+ var compoundFilterSchema = () => cachedCompoundFilterSchema != null ? cachedCompoundFilterSchema : cachedCompoundFilterSchema = z13.object({
2561
2569
  type: z13.enum(["and", "or"]),
2562
2570
  filters: z13.array(
2563
- z13.union([comparisonFilterSchema, z13.lazy(() => compoundFilterSchema)])
2571
+ z13.union([comparisonFilterSchema(), z13.lazy(() => compoundFilterSchema())])
2564
2572
  )
2565
2573
  });
2566
- var fileSearchArgsSchema = lazySchema12(
2567
- () => zodSchema12(
2574
+ var fileSearchArgsSchema = lazySchema13(
2575
+ () => zodSchema13(
2568
2576
  z13.object({
2569
2577
  vectorStoreIds: z13.array(z13.string()),
2570
2578
  maxNumResults: z13.number().optional(),
@@ -2572,12 +2580,12 @@ var fileSearchArgsSchema = lazySchema12(
2572
2580
  ranker: z13.string().optional(),
2573
2581
  scoreThreshold: z13.number().optional()
2574
2582
  }).optional(),
2575
- filters: z13.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2583
+ filters: z13.union([comparisonFilterSchema(), compoundFilterSchema()]).optional()
2576
2584
  })
2577
2585
  )
2578
2586
  );
2579
- var fileSearchOutputSchema = lazySchema12(
2580
- () => zodSchema12(
2587
+ var fileSearchOutputSchema = lazySchema13(
2588
+ () => zodSchema13(
2581
2589
  z13.object({
2582
2590
  queries: z13.array(z13.string()),
2583
2591
  results: z13.array(
@@ -2601,12 +2609,12 @@ var fileSearch = createProviderToolFactoryWithOutputSchema3({
2601
2609
  // src/tool/image-generation.ts
2602
2610
  import {
2603
2611
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
2604
- lazySchema as lazySchema13,
2605
- zodSchema as zodSchema13
2612
+ lazySchema as lazySchema14,
2613
+ zodSchema as zodSchema14
2606
2614
  } from "@ai-sdk/provider-utils";
2607
2615
  import { z as z14 } from "zod/v4";
2608
- var imageGenerationArgsSchema = lazySchema13(
2609
- () => zodSchema13(
2616
+ var imageGenerationArgsSchema = lazySchema14(
2617
+ () => zodSchema14(
2610
2618
  z14.object({
2611
2619
  background: z14.enum(["auto", "opaque", "transparent"]).optional(),
2612
2620
  inputFidelity: z14.enum(["low", "high"]).optional(),
@@ -2624,9 +2632,9 @@ var imageGenerationArgsSchema = lazySchema13(
2624
2632
  }).strict()
2625
2633
  )
2626
2634
  );
2627
- var imageGenerationInputSchema = lazySchema13(() => zodSchema13(z14.object({})));
2628
- var imageGenerationOutputSchema = lazySchema13(
2629
- () => zodSchema13(z14.object({ result: z14.string() }))
2635
+ var imageGenerationInputSchema = lazySchema14(() => zodSchema14(z14.object({})));
2636
+ var imageGenerationOutputSchema = lazySchema14(
2637
+ () => zodSchema14(z14.object({ result: z14.string() }))
2630
2638
  );
2631
2639
  var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
2632
2640
  id: "openai.image_generation",
@@ -2640,12 +2648,12 @@ var imageGeneration = (args = {}) => {
2640
2648
  // src/tool/local-shell.ts
2641
2649
  import {
2642
2650
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
2643
- lazySchema as lazySchema14,
2644
- zodSchema as zodSchema14
2651
+ lazySchema as lazySchema15,
2652
+ zodSchema as zodSchema15
2645
2653
  } from "@ai-sdk/provider-utils";
2646
2654
  import { z as z15 } from "zod/v4";
2647
- var localShellInputSchema = lazySchema14(
2648
- () => zodSchema14(
2655
+ var localShellInputSchema = lazySchema15(
2656
+ () => zodSchema15(
2649
2657
  z15.object({
2650
2658
  action: z15.object({
2651
2659
  type: z15.literal("exec"),
@@ -2658,8 +2666,8 @@ var localShellInputSchema = lazySchema14(
2658
2666
  })
2659
2667
  )
2660
2668
  );
2661
- var localShellOutputSchema = lazySchema14(
2662
- () => zodSchema14(z15.object({ output: z15.string() }))
2669
+ var localShellOutputSchema = lazySchema15(
2670
+ () => zodSchema15(z15.object({ output: z15.string() }))
2663
2671
  );
2664
2672
  var localShell = createProviderToolFactoryWithOutputSchema5({
2665
2673
  id: "openai.local_shell",
@@ -2670,12 +2678,12 @@ var localShell = createProviderToolFactoryWithOutputSchema5({
2670
2678
  // src/tool/shell.ts
2671
2679
  import {
2672
2680
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
2673
- lazySchema as lazySchema15,
2674
- zodSchema as zodSchema15
2681
+ lazySchema as lazySchema16,
2682
+ zodSchema as zodSchema16
2675
2683
  } from "@ai-sdk/provider-utils";
2676
2684
  import { z as z16 } from "zod/v4";
2677
- var shellInputSchema = lazySchema15(
2678
- () => zodSchema15(
2685
+ var shellInputSchema = lazySchema16(
2686
+ () => zodSchema16(
2679
2687
  z16.object({
2680
2688
  action: z16.object({
2681
2689
  commands: z16.array(z16.string()),
@@ -2685,8 +2693,8 @@ var shellInputSchema = lazySchema15(
2685
2693
  })
2686
2694
  )
2687
2695
  );
2688
- var shellOutputSchema = lazySchema15(
2689
- () => zodSchema15(
2696
+ var shellOutputSchema = lazySchema16(
2697
+ () => zodSchema16(
2690
2698
  z16.object({
2691
2699
  output: z16.array(
2692
2700
  z16.object({
@@ -2701,7 +2709,7 @@ var shellOutputSchema = lazySchema15(
2701
2709
  })
2702
2710
  )
2703
2711
  );
2704
- var shellSkillsSchema = z16.array(
2712
+ var shellSkillsSchema = () => z16.array(
2705
2713
  z16.discriminatedUnion("type", [
2706
2714
  z16.object({
2707
2715
  type: z16.literal("skillReference"),
@@ -2720,8 +2728,8 @@ var shellSkillsSchema = z16.array(
2720
2728
  })
2721
2729
  ])
2722
2730
  ).optional();
2723
- var shellArgsSchema = lazySchema15(
2724
- () => zodSchema15(
2731
+ var shellArgsSchema = lazySchema16(
2732
+ () => zodSchema16(
2725
2733
  z16.object({
2726
2734
  environment: z16.union([
2727
2735
  z16.object({
@@ -2742,7 +2750,7 @@ var shellArgsSchema = lazySchema15(
2742
2750
  ).optional()
2743
2751
  })
2744
2752
  ]).optional(),
2745
- skills: shellSkillsSchema
2753
+ skills: shellSkillsSchema()
2746
2754
  }),
2747
2755
  z16.object({
2748
2756
  type: z16.literal("containerReference"),
@@ -2771,12 +2779,12 @@ var shell = createProviderToolFactoryWithOutputSchema6({
2771
2779
  // src/tool/tool-search.ts
2772
2780
  import {
2773
2781
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
2774
- lazySchema as lazySchema16,
2775
- zodSchema as zodSchema16
2782
+ lazySchema as lazySchema17,
2783
+ zodSchema as zodSchema17
2776
2784
  } from "@ai-sdk/provider-utils";
2777
2785
  import { z as z17 } from "zod/v4";
2778
- var toolSearchArgsSchema = lazySchema16(
2779
- () => zodSchema16(
2786
+ var toolSearchArgsSchema = lazySchema17(
2787
+ () => zodSchema17(
2780
2788
  z17.object({
2781
2789
  execution: z17.enum(["server", "client"]).optional(),
2782
2790
  description: z17.string().optional(),
@@ -2784,16 +2792,16 @@ var toolSearchArgsSchema = lazySchema16(
2784
2792
  })
2785
2793
  )
2786
2794
  );
2787
- var toolSearchInputSchema = lazySchema16(
2788
- () => zodSchema16(
2795
+ var toolSearchInputSchema = lazySchema17(
2796
+ () => zodSchema17(
2789
2797
  z17.object({
2790
2798
  arguments: z17.unknown().optional(),
2791
2799
  call_id: z17.string().nullish()
2792
2800
  })
2793
2801
  )
2794
2802
  );
2795
- var toolSearchOutputSchema = lazySchema16(
2796
- () => zodSchema16(
2803
+ var toolSearchOutputSchema = lazySchema17(
2804
+ () => zodSchema17(
2797
2805
  z17.object({
2798
2806
  tools: z17.array(z17.record(z17.string(), z17.unknown()))
2799
2807
  })
@@ -2809,12 +2817,12 @@ var toolSearch = (args = {}) => toolSearchToolFactory(args);
2809
2817
  // src/tool/web-search.ts
2810
2818
  import {
2811
2819
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
2812
- lazySchema as lazySchema17,
2813
- zodSchema as zodSchema17
2820
+ lazySchema as lazySchema18,
2821
+ zodSchema as zodSchema18
2814
2822
  } from "@ai-sdk/provider-utils";
2815
2823
  import { z as z18 } from "zod/v4";
2816
- var webSearchArgsSchema = lazySchema17(
2817
- () => zodSchema17(
2824
+ var webSearchArgsSchema = lazySchema18(
2825
+ () => zodSchema18(
2818
2826
  z18.object({
2819
2827
  externalWebAccess: z18.boolean().optional(),
2820
2828
  filters: z18.object({
@@ -2832,9 +2840,9 @@ var webSearchArgsSchema = lazySchema17(
2832
2840
  })
2833
2841
  )
2834
2842
  );
2835
- var webSearchInputSchema = lazySchema17(() => zodSchema17(z18.object({})));
2836
- var webSearchOutputSchema = lazySchema17(
2837
- () => zodSchema17(
2843
+ var webSearchInputSchema = lazySchema18(() => zodSchema18(z18.object({})));
2844
+ var webSearchOutputSchema = lazySchema18(
2845
+ () => zodSchema18(
2838
2846
  z18.object({
2839
2847
  action: z18.discriminatedUnion("type", [
2840
2848
  z18.object({
@@ -2871,12 +2879,12 @@ var webSearch = (args = {}) => webSearchToolFactory(args);
2871
2879
  // src/tool/web-search-preview.ts
2872
2880
  import {
2873
2881
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
2874
- lazySchema as lazySchema18,
2875
- zodSchema as zodSchema18
2882
+ lazySchema as lazySchema19,
2883
+ zodSchema as zodSchema19
2876
2884
  } from "@ai-sdk/provider-utils";
2877
2885
  import { z as z19 } from "zod/v4";
2878
- var webSearchPreviewArgsSchema = lazySchema18(
2879
- () => zodSchema18(
2886
+ var webSearchPreviewArgsSchema = lazySchema19(
2887
+ () => zodSchema19(
2880
2888
  z19.object({
2881
2889
  searchContextSize: z19.enum(["low", "medium", "high"]).optional(),
2882
2890
  userLocation: z19.object({
@@ -2889,11 +2897,11 @@ var webSearchPreviewArgsSchema = lazySchema18(
2889
2897
  })
2890
2898
  )
2891
2899
  );
2892
- var webSearchPreviewInputSchema = lazySchema18(
2893
- () => zodSchema18(z19.object({}))
2900
+ var webSearchPreviewInputSchema = lazySchema19(
2901
+ () => zodSchema19(z19.object({}))
2894
2902
  );
2895
- var webSearchPreviewOutputSchema = lazySchema18(
2896
- () => zodSchema18(
2903
+ var webSearchPreviewOutputSchema = lazySchema19(
2904
+ () => zodSchema19(
2897
2905
  z19.object({
2898
2906
  action: z19.discriminatedUnion("type", [
2899
2907
  z19.object({
@@ -2922,22 +2930,23 @@ var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
2922
2930
  // src/tool/mcp.ts
2923
2931
  import {
2924
2932
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
2925
- lazySchema as lazySchema19,
2926
- zodSchema as zodSchema19
2933
+ lazySchema as lazySchema20,
2934
+ zodSchema as zodSchema20
2927
2935
  } from "@ai-sdk/provider-utils";
2928
2936
  import { z as z20 } from "zod/v4";
2929
- var jsonValueSchema = z20.lazy(
2937
+ var cachedJsonValueSchema;
2938
+ var jsonValueSchema = () => cachedJsonValueSchema != null ? cachedJsonValueSchema : cachedJsonValueSchema = z20.lazy(
2930
2939
  () => z20.union([
2931
2940
  z20.string(),
2932
2941
  z20.number(),
2933
2942
  z20.boolean(),
2934
2943
  z20.null(),
2935
- z20.array(jsonValueSchema),
2936
- z20.record(z20.string(), jsonValueSchema)
2944
+ z20.array(jsonValueSchema()),
2945
+ z20.record(z20.string(), jsonValueSchema())
2937
2946
  ])
2938
2947
  );
2939
- var mcpArgsSchema = lazySchema19(
2940
- () => zodSchema19(
2948
+ var mcpArgsSchema = lazySchema20(
2949
+ () => zodSchema20(
2941
2950
  z20.object({
2942
2951
  serverLabel: z20.string(),
2943
2952
  allowedTools: z20.union([
@@ -2966,16 +2975,16 @@ var mcpArgsSchema = lazySchema19(
2966
2975
  )
2967
2976
  )
2968
2977
  );
2969
- var mcpInputSchema = lazySchema19(() => zodSchema19(z20.object({})));
2970
- var mcpOutputSchema = lazySchema19(
2971
- () => zodSchema19(
2978
+ var mcpInputSchema = lazySchema20(() => zodSchema20(z20.object({})));
2979
+ var mcpOutputSchema = lazySchema20(
2980
+ () => zodSchema20(
2972
2981
  z20.object({
2973
2982
  type: z20.literal("call"),
2974
2983
  serverLabel: z20.string(),
2975
2984
  name: z20.string(),
2976
2985
  arguments: z20.string(),
2977
2986
  output: z20.string().nullish(),
2978
- error: z20.union([z20.string(), jsonValueSchema]).optional()
2987
+ error: z20.union([z20.string(), jsonValueSchema()]).optional()
2979
2988
  })
2980
2989
  )
2981
2990
  );
@@ -3165,6 +3174,8 @@ import {
3165
3174
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
3166
3175
  } from "@ai-sdk/provider";
3167
3176
  import {
3177
+ lazySchema as lazySchema22,
3178
+ zodSchema as zodSchema22,
3168
3179
  convertToBase64 as convertToBase642,
3169
3180
  isNonNullable,
3170
3181
  parseJSON,
@@ -3176,8 +3187,8 @@ import { z as z22 } from "zod/v4";
3176
3187
 
3177
3188
  // src/responses/openai-responses-options.ts
3178
3189
  import {
3179
- lazySchema as lazySchema20,
3180
- zodSchema as zodSchema20
3190
+ lazySchema as lazySchema21,
3191
+ zodSchema as zodSchema21
3181
3192
  } from "@ai-sdk/provider-utils";
3182
3193
  import { z as z21 } from "zod/v4";
3183
3194
  var TOP_LOGPROBS_MAX = 20;
@@ -3254,8 +3265,8 @@ var openaiResponsesModelIds = [
3254
3265
  "gpt-5-chat-latest",
3255
3266
  ...openaiResponsesReasoningModelIds
3256
3267
  ];
3257
- var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
3258
- () => zodSchema20(
3268
+ var openaiLanguageModelResponsesOptionsSchema = lazySchema21(
3269
+ () => zodSchema21(
3259
3270
  z21.object({
3260
3271
  /**
3261
3272
  * The ID of the OpenAI Conversation to continue.
@@ -3325,11 +3336,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
3325
3336
  /**
3326
3337
  * Prompt cache behavior for GPT-5.6 and later models.
3327
3338
  * `mode` controls whether OpenAI also places an implicit breakpoint.
3328
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
3339
+ * `ttl` sets the minimum cache lifetime: `'30m'` (default) or `'12h'`.
3340
+ * `prewarm` writes the prompt to the cache without generating output.
3329
3341
  */
3330
3342
  promptCacheOptions: z21.object({
3331
3343
  mode: z21.enum(["implicit", "explicit"]).optional(),
3332
- ttl: z21.literal("30m").optional()
3344
+ ttl: z21.enum(["30m", "12h"]).optional(),
3345
+ prewarm: z21.boolean().optional()
3333
3346
  }).optional(),
3334
3347
  /**
3335
3348
  * The retention policy for the prompt cache.
@@ -3461,8 +3474,8 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
3461
3474
  })
3462
3475
  )
3463
3476
  );
3464
- var openaiResponsesSystemMessageOptionsSchema = lazySchema20(
3465
- () => zodSchema20(
3477
+ var openaiResponsesSystemMessageOptionsSchema = lazySchema21(
3478
+ () => zodSchema21(
3466
3479
  z21.object({
3467
3480
  /**
3468
3481
  * Emit a configuration update at this position in Responses history.
@@ -4591,10 +4604,14 @@ ${text}`,
4591
4604
  }
4592
4605
  return { input, warnings };
4593
4606
  }
4594
- var openaiResponsesReasoningProviderOptionsSchema = z22.object({
4595
- itemId: z22.string().nullish(),
4596
- reasoningEncryptedContent: z22.string().nullish()
4597
- });
4607
+ var openaiResponsesReasoningProviderOptionsSchema = lazySchema22(
4608
+ () => zodSchema22(
4609
+ z22.object({
4610
+ itemId: z22.string().nullish(),
4611
+ reasoningEncryptedContent: z22.string().nullish()
4612
+ })
4613
+ )
4614
+ );
4598
4615
 
4599
4616
  // src/responses/map-openai-responses-finish-reason.ts
4600
4617
  function mapOpenAIResponseFinishReason({
@@ -4616,37 +4633,45 @@ function mapOpenAIResponseFinishReason({
4616
4633
 
4617
4634
  // src/responses/openai-responses-api.ts
4618
4635
  import {
4619
- lazySchema as lazySchema21,
4620
- zodSchema as zodSchema21
4636
+ lazySchema as lazySchema23,
4637
+ zodSchema as zodSchema23
4621
4638
  } from "@ai-sdk/provider-utils";
4622
4639
  import { z as z23 } from "zod/v4";
4623
- var jsonValueSchema2 = z23.lazy(
4640
+ var cachedJsonValueSchema2;
4641
+ var jsonValueSchema2 = () => cachedJsonValueSchema2 != null ? cachedJsonValueSchema2 : cachedJsonValueSchema2 = z23.lazy(
4624
4642
  () => z23.union([
4625
4643
  z23.string(),
4626
4644
  z23.number(),
4627
4645
  z23.boolean(),
4628
4646
  z23.null(),
4629
- z23.array(jsonValueSchema2),
4630
- z23.record(z23.string(), jsonValueSchema2.optional())
4647
+ z23.array(jsonValueSchema2()),
4648
+ z23.record(z23.string(), jsonValueSchema2().optional())
4631
4649
  ])
4632
4650
  );
4633
- var jsonObjectSchema = z23.record(z23.string(), jsonValueSchema2.optional());
4634
- var openaiResponsesUsageSchema = z23.intersection(
4635
- jsonObjectSchema,
4651
+ var jsonObjectSchema = () => z23.record(z23.string(), jsonValueSchema2().optional());
4652
+ var openaiResponsesUsageSchema = () => z23.intersection(
4653
+ jsonObjectSchema(),
4636
4654
  z23.object({
4637
4655
  input_tokens: z23.number(),
4638
4656
  input_tokens_details: z23.intersection(
4639
- jsonObjectSchema,
4657
+ jsonObjectSchema(),
4640
4658
  z23.object({
4641
4659
  cached_tokens: z23.number().nullish(),
4642
4660
  cache_write_tokens: z23.number().nullish(),
4661
+ cache_write_tokens_details: z23.intersection(
4662
+ jsonObjectSchema(),
4663
+ z23.object({
4664
+ ttl_30m_tokens: z23.number().nullish(),
4665
+ ttl_12h_tokens: z23.number().nullish()
4666
+ })
4667
+ ).nullish(),
4643
4668
  orchestration_input_tokens: z23.number().nullish(),
4644
4669
  orchestration_input_cached_tokens: z23.number().nullish()
4645
4670
  })
4646
4671
  ).nullish(),
4647
4672
  output_tokens: z23.number(),
4648
4673
  output_tokens_details: z23.intersection(
4649
- jsonObjectSchema,
4674
+ jsonObjectSchema(),
4650
4675
  z23.object({
4651
4676
  reasoning_tokens: z23.number().nullish(),
4652
4677
  orchestration_output_tokens: z23.number().nullish()
@@ -4658,7 +4683,7 @@ var openaiResponsesUsageSchema = z23.intersection(
4658
4683
  function isRecord(value) {
4659
4684
  return value != null && typeof value === "object" && !Array.isArray(value);
4660
4685
  }
4661
- var openaiResponsesLocalShellCallSchema = z23.object({
4686
+ var openaiResponsesLocalShellCallSchema = () => z23.object({
4662
4687
  type: z23.literal("local_shell_call"),
4663
4688
  id: z23.string(),
4664
4689
  call_id: z23.string(),
@@ -4671,7 +4696,7 @@ var openaiResponsesLocalShellCallSchema = z23.object({
4671
4696
  env: z23.record(z23.string(), z23.string()).optional()
4672
4697
  })
4673
4698
  });
4674
- var openaiResponsesNestedErrorChunkSchema = z23.object({
4699
+ var openaiResponsesNestedErrorChunkSchema = () => z23.object({
4675
4700
  type: z23.literal("error"),
4676
4701
  sequence_number: z23.number(),
4677
4702
  error: z23.object({
@@ -4681,7 +4706,7 @@ var openaiResponsesNestedErrorChunkSchema = z23.object({
4681
4706
  param: z23.string().nullish()
4682
4707
  })
4683
4708
  });
4684
- var openaiResponsesErrorChunkSchema = z23.object({
4709
+ var openaiResponsesErrorChunkSchema = () => z23.object({
4685
4710
  type: z23.literal("error"),
4686
4711
  sequence_number: z23.number(),
4687
4712
  code: z23.string().nullish(),
@@ -4742,8 +4767,8 @@ function isModeledOpenAIResponsesChunk(value) {
4742
4767
  }
4743
4768
  return openaiResponsesModeledOutputItemTypes.has(value.item.type);
4744
4769
  }
4745
- var openaiResponsesChunkSchema = lazySchema21(
4746
- () => zodSchema21(
4770
+ var openaiResponsesChunkSchema = lazySchema23(
4771
+ () => zodSchema23(
4747
4772
  z23.union([
4748
4773
  z23.object({
4749
4774
  type: z23.literal("response.output_text.delta"),
@@ -4766,7 +4791,7 @@ var openaiResponsesChunkSchema = lazySchema21(
4766
4791
  type: z23.enum(["response.completed", "response.incomplete"]),
4767
4792
  response: z23.object({
4768
4793
  incomplete_details: z23.object({ reason: z23.string() }).nullish(),
4769
- usage: openaiResponsesUsageSchema.nullish(),
4794
+ usage: openaiResponsesUsageSchema().nullish(),
4770
4795
  reasoning: z23.object({
4771
4796
  context: z23.string().nullish()
4772
4797
  }).nullish(),
@@ -4782,7 +4807,7 @@ var openaiResponsesChunkSchema = lazySchema21(
4782
4807
  message: z23.string()
4783
4808
  }).nullish(),
4784
4809
  incomplete_details: z23.object({ reason: z23.string() }).nullish(),
4785
- usage: openaiResponsesUsageSchema.nullish(),
4810
+ usage: openaiResponsesUsageSchema().nullish(),
4786
4811
  reasoning: z23.object({
4787
4812
  context: z23.string().nullish()
4788
4813
  }).nullish(),
@@ -4835,7 +4860,7 @@ var openaiResponsesChunkSchema = lazySchema21(
4835
4860
  type: z23.literal("file_search_call"),
4836
4861
  id: z23.string()
4837
4862
  }),
4838
- openaiResponsesLocalShellCallSchema,
4863
+ openaiResponsesLocalShellCallSchema(),
4839
4864
  z23.object({
4840
4865
  type: z23.literal("image_generation_call"),
4841
4866
  id: z23.string()
@@ -4939,7 +4964,7 @@ var openaiResponsesChunkSchema = lazySchema21(
4939
4964
  execution: z23.enum(["server", "client"]),
4940
4965
  call_id: z23.string().nullable(),
4941
4966
  status: z23.enum(["in_progress", "completed", "incomplete"]),
4942
- tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
4967
+ tools: z23.array(z23.record(z23.string(), jsonValueSchema2().optional()))
4943
4968
  })
4944
4969
  ])
4945
4970
  }),
@@ -5037,7 +5062,7 @@ var openaiResponsesChunkSchema = lazySchema21(
5037
5062
  })
5038
5063
  ).nullish()
5039
5064
  }),
5040
- openaiResponsesLocalShellCallSchema,
5065
+ openaiResponsesLocalShellCallSchema(),
5041
5066
  z23.object({
5042
5067
  type: z23.literal("computer_call"),
5043
5068
  id: z23.string(),
@@ -5154,7 +5179,7 @@ var openaiResponsesChunkSchema = lazySchema21(
5154
5179
  execution: z23.enum(["server", "client"]),
5155
5180
  call_id: z23.string().nullable(),
5156
5181
  status: z23.enum(["in_progress", "completed", "incomplete"]),
5157
- tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
5182
+ tools: z23.array(z23.record(z23.string(), jsonValueSchema2().optional()))
5158
5183
  })
5159
5184
  ])
5160
5185
  }),
@@ -5256,8 +5281,8 @@ var openaiResponsesChunkSchema = lazySchema21(
5256
5281
  output_index: z23.number(),
5257
5282
  diff: z23.string()
5258
5283
  }),
5259
- openaiResponsesNestedErrorChunkSchema,
5260
- openaiResponsesErrorChunkSchema,
5284
+ openaiResponsesNestedErrorChunkSchema(),
5285
+ openaiResponsesErrorChunkSchema(),
5261
5286
  z23.object({ type: z23.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
5262
5287
  message: "Known response chunk failed schema validation"
5263
5288
  }).transform((value) => ({
@@ -5268,8 +5293,8 @@ var openaiResponsesChunkSchema = lazySchema21(
5268
5293
  ])
5269
5294
  )
5270
5295
  );
5271
- var openaiResponsesResponseSchema = lazySchema21(
5272
- () => zodSchema21(
5296
+ var openaiResponsesResponseSchema = lazySchema23(
5297
+ () => zodSchema23(
5273
5298
  z23.object({
5274
5299
  id: z23.string().optional(),
5275
5300
  created_at: z23.number().optional(),
@@ -5400,7 +5425,7 @@ var openaiResponsesResponseSchema = lazySchema21(
5400
5425
  id: z23.string(),
5401
5426
  result: z23.string()
5402
5427
  }),
5403
- openaiResponsesLocalShellCallSchema,
5428
+ openaiResponsesLocalShellCallSchema(),
5404
5429
  z23.object({
5405
5430
  type: z23.literal("function_call"),
5406
5431
  call_id: z23.string(),
@@ -5545,7 +5570,9 @@ var openaiResponsesResponseSchema = lazySchema21(
5545
5570
  execution: z23.enum(["server", "client"]),
5546
5571
  call_id: z23.string().nullable(),
5547
5572
  status: z23.enum(["in_progress", "completed", "incomplete"]),
5548
- tools: z23.array(z23.record(z23.string(), jsonValueSchema2.optional()))
5573
+ tools: z23.array(
5574
+ z23.record(z23.string(), jsonValueSchema2().optional())
5575
+ )
5549
5576
  })
5550
5577
  ])
5551
5578
  ).optional(),
@@ -5554,7 +5581,7 @@ var openaiResponsesResponseSchema = lazySchema21(
5554
5581
  context: z23.string().nullish()
5555
5582
  }).nullish(),
5556
5583
  incomplete_details: z23.object({ reason: z23.string() }).nullish(),
5557
- usage: openaiResponsesUsageSchema.nullish()
5584
+ usage: openaiResponsesUsageSchema().nullish()
5558
5585
  })
5559
5586
  )
5560
5587
  );
@@ -8070,12 +8097,12 @@ import {
8070
8097
 
8071
8098
  // src/speech/openai-speech-options.ts
8072
8099
  import {
8073
- lazySchema as lazySchema22,
8074
- zodSchema as zodSchema22
8100
+ lazySchema as lazySchema24,
8101
+ zodSchema as zodSchema24
8075
8102
  } from "@ai-sdk/provider-utils";
8076
8103
  import { z as z24 } from "zod/v4";
8077
- var openaiSpeechModelOptionsSchema = lazySchema22(
8078
- () => zodSchema22(
8104
+ var openaiSpeechModelOptionsSchema = lazySchema24(
8105
+ () => zodSchema24(
8079
8106
  z24.object({
8080
8107
  instructions: z24.string().nullish(),
8081
8108
  speed: z24.number().min(0.25).max(4).default(1).nullish()
@@ -8195,10 +8222,10 @@ import {
8195
8222
  } from "@ai-sdk/provider-utils";
8196
8223
 
8197
8224
  // src/transcription/openai-transcription-api.ts
8198
- import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
8225
+ import { lazySchema as lazySchema25, zodSchema as zodSchema25 } from "@ai-sdk/provider-utils";
8199
8226
  import { z as z25 } from "zod/v4";
8200
- var openaiTranscriptionResponseSchema = lazySchema23(
8201
- () => zodSchema23(
8227
+ var openaiTranscriptionResponseSchema = lazySchema25(
8228
+ () => zodSchema25(
8202
8229
  z25.object({
8203
8230
  text: z25.string(),
8204
8231
  language: z25.string().nullish(),
@@ -8230,12 +8257,12 @@ var openaiTranscriptionResponseSchema = lazySchema23(
8230
8257
 
8231
8258
  // src/transcription/openai-transcription-options.ts
8232
8259
  import {
8233
- lazySchema as lazySchema24,
8234
- zodSchema as zodSchema24
8260
+ lazySchema as lazySchema26,
8261
+ zodSchema as zodSchema26
8235
8262
  } from "@ai-sdk/provider-utils";
8236
8263
  import { z as z26 } from "zod/v4";
8237
- var openAITranscriptionModelOptions = lazySchema24(
8238
- () => zodSchema24(
8264
+ var openAITranscriptionModelOptions = lazySchema26(
8265
+ () => zodSchema26(
8239
8266
  z26.object({
8240
8267
  /**
8241
8268
  * Additional information to include in the transcription response.
@@ -8431,7 +8458,7 @@ var OpenAITranscriptionModel = class {
8431
8458
  };
8432
8459
 
8433
8460
  // src/version.ts
8434
- var VERSION = true ? "3.0.130" : "0.0.0-test";
8461
+ var VERSION = true ? "3.0.131" : "0.0.0-test";
8435
8462
 
8436
8463
  // src/openai-provider.ts
8437
8464
  function createOpenAI(options = {}) {