@ai-sdk/openai 2.0.134 → 2.0.136

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
 
@@ -368,11 +375,11 @@ function mapOpenAIFinishReason(finishReason) {
368
375
  // src/chat/openai-chat-api.ts
369
376
  import {
370
377
  lazyValidator,
371
- zodSchema
378
+ zodSchema as zodSchema2
372
379
  } from "@ai-sdk/provider-utils";
373
380
  import { z as z2 } from "zod/v4";
374
381
  var openaiChatResponseSchema = lazyValidator(
375
- () => zodSchema(
382
+ () => zodSchema2(
376
383
  z2.object({
377
384
  id: z2.string().nullish(),
378
385
  created: z2.number().nullish(),
@@ -443,7 +450,7 @@ var openaiChatResponseSchema = lazyValidator(
443
450
  )
444
451
  );
445
452
  var openaiChatChunkSchema = lazyValidator(
446
- () => zodSchema(
453
+ () => zodSchema2(
447
454
  z2.union([
448
455
  z2.object({
449
456
  id: z2.string().nullish(),
@@ -510,7 +517,7 @@ var openaiChatChunkSchema = lazyValidator(
510
517
  }).nullish()
511
518
  }).nullish()
512
519
  }),
513
- openaiErrorDataSchema
520
+ openaiErrorDataSchema()
514
521
  ])
515
522
  )
516
523
  );
@@ -518,11 +525,11 @@ var openaiChatChunkSchema = lazyValidator(
518
525
  // src/chat/openai-chat-options.ts
519
526
  import {
520
527
  lazyValidator as lazyValidator2,
521
- zodSchema as zodSchema2
528
+ zodSchema as zodSchema3
522
529
  } from "@ai-sdk/provider-utils";
523
530
  import { z as z3 } from "zod/v4";
524
531
  var openaiChatLanguageModelOptions = lazyValidator2(
525
- () => zodSchema2(
532
+ () => zodSchema3(
526
533
  z3.object({
527
534
  /**
528
535
  * Modify the likelihood of specified tokens appearing in the completion.
@@ -1278,10 +1285,10 @@ function mapOpenAIFinishReason2(finishReason) {
1278
1285
  import { z as z4 } from "zod/v4";
1279
1286
  import {
1280
1287
  lazyValidator as lazyValidator3,
1281
- zodSchema as zodSchema3
1288
+ zodSchema as zodSchema4
1282
1289
  } from "@ai-sdk/provider-utils";
1283
1290
  var openaiCompletionResponseSchema = lazyValidator3(
1284
- () => zodSchema3(
1291
+ () => zodSchema4(
1285
1292
  z4.object({
1286
1293
  id: z4.string().nullish(),
1287
1294
  created: z4.number().nullish(),
@@ -1306,7 +1313,7 @@ var openaiCompletionResponseSchema = lazyValidator3(
1306
1313
  )
1307
1314
  );
1308
1315
  var openaiCompletionChunkSchema = lazyValidator3(
1309
- () => zodSchema3(
1316
+ () => zodSchema4(
1310
1317
  z4.union([
1311
1318
  z4.object({
1312
1319
  id: z4.string().nullish(),
@@ -1330,7 +1337,7 @@ var openaiCompletionChunkSchema = lazyValidator3(
1330
1337
  total_tokens: z4.number()
1331
1338
  }).nullish()
1332
1339
  }),
1333
- openaiErrorDataSchema
1340
+ openaiErrorDataSchema()
1334
1341
  ])
1335
1342
  )
1336
1343
  );
@@ -1338,11 +1345,11 @@ var openaiCompletionChunkSchema = lazyValidator3(
1338
1345
  // src/completion/openai-completion-options.ts
1339
1346
  import {
1340
1347
  lazyValidator as lazyValidator4,
1341
- zodSchema as zodSchema4
1348
+ zodSchema as zodSchema5
1342
1349
  } from "@ai-sdk/provider-utils";
1343
1350
  import { z as z5 } from "zod/v4";
1344
1351
  var openaiCompletionProviderOptions = lazyValidator4(
1345
- () => zodSchema4(
1352
+ () => zodSchema5(
1346
1353
  z5.object({
1347
1354
  /**
1348
1355
  Echo back the prompt in addition to the completion.
@@ -1631,11 +1638,11 @@ import {
1631
1638
  // src/embedding/openai-embedding-options.ts
1632
1639
  import {
1633
1640
  lazyValidator as lazyValidator5,
1634
- zodSchema as zodSchema5
1641
+ zodSchema as zodSchema6
1635
1642
  } from "@ai-sdk/provider-utils";
1636
1643
  import { z as z6 } from "zod/v4";
1637
1644
  var openaiEmbeddingProviderOptions = lazyValidator5(
1638
- () => zodSchema5(
1645
+ () => zodSchema6(
1639
1646
  z6.object({
1640
1647
  /**
1641
1648
  The number of dimensions the resulting output embeddings should have.
@@ -1652,10 +1659,10 @@ var openaiEmbeddingProviderOptions = lazyValidator5(
1652
1659
  );
1653
1660
 
1654
1661
  // src/embedding/openai-embedding-api.ts
1655
- import { lazyValidator as lazyValidator6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
1662
+ import { lazyValidator as lazyValidator6, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1656
1663
  import { z as z7 } from "zod/v4";
1657
1664
  var openaiTextEmbeddingResponseSchema = lazyValidator6(
1658
- () => zodSchema6(
1665
+ () => zodSchema7(
1659
1666
  z7.object({
1660
1667
  data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1661
1668
  usage: z7.object({ prompt_tokens: z7.number() }).nullish()
@@ -1739,10 +1746,10 @@ import {
1739
1746
  } from "@ai-sdk/provider-utils";
1740
1747
 
1741
1748
  // src/image/openai-image-api.ts
1742
- import { lazyValidator as lazyValidator7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
1749
+ import { lazyValidator as lazyValidator7, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
1743
1750
  import { z as z8 } from "zod/v4";
1744
1751
  var openaiImageResponseSchema = lazyValidator7(
1745
- () => zodSchema7(
1752
+ () => zodSchema8(
1746
1753
  z8.object({
1747
1754
  created: z8.number().nullish(),
1748
1755
  data: z8.array(
@@ -1771,7 +1778,7 @@ var openaiImageResponseSchema = lazyValidator7(
1771
1778
  // src/image/openai-image-options.ts
1772
1779
  import {
1773
1780
  lazyValidator as lazyValidator8,
1774
- zodSchema as zodSchema8
1781
+ zodSchema as zodSchema9
1775
1782
  } from "@ai-sdk/provider-utils";
1776
1783
  import { z as z9 } from "zod/v4";
1777
1784
  var modelMaxImagesPerCall = {
@@ -1792,7 +1799,7 @@ function getMaxImagesPerCall(modelId) {
1792
1799
  var _a2;
1793
1800
  return (_a2 = modelMaxImagesPerCall[modelId]) != null ? _a2 : modelId.startsWith("gpt-image-") ? 10 : 1;
1794
1801
  }
1795
- var baseImageModelOptionsObject = z9.object({
1802
+ var baseImageModelOptionsObject = () => z9.object({
1796
1803
  /**
1797
1804
  * Quality of the generated image(s).
1798
1805
  *
@@ -1822,11 +1829,11 @@ var baseImageModelOptionsObject = z9.object({
1822
1829
  user: z9.string().optional()
1823
1830
  });
1824
1831
  var openaiImageModelOptions = lazyValidator8(
1825
- () => zodSchema8(baseImageModelOptionsObject)
1832
+ () => zodSchema9(baseImageModelOptionsObject())
1826
1833
  );
1827
1834
  var openaiImageModelGenerationOptions = lazyValidator8(
1828
- () => zodSchema8(
1829
- baseImageModelOptionsObject.extend({
1835
+ () => zodSchema9(
1836
+ baseImageModelOptionsObject().extend({
1830
1837
  /**
1831
1838
  * Style of the generated image. `vivid` produces hyper-real and
1832
1839
  * dramatic images; `natural` produces more subdued, less hyper-real
@@ -1970,20 +1977,20 @@ function distributeTokenDetails(usage, index, total) {
1970
1977
  // src/tool/code-interpreter.ts
1971
1978
  import {
1972
1979
  createProviderDefinedToolFactoryWithOutputSchema,
1973
- lazySchema,
1974
- zodSchema as zodSchema9
1980
+ lazySchema as lazySchema2,
1981
+ zodSchema as zodSchema10
1975
1982
  } from "@ai-sdk/provider-utils";
1976
1983
  import { z as z10 } from "zod/v4";
1977
- var codeInterpreterInputSchema = lazySchema(
1978
- () => zodSchema9(
1984
+ var codeInterpreterInputSchema = lazySchema2(
1985
+ () => zodSchema10(
1979
1986
  z10.object({
1980
1987
  code: z10.string().nullish(),
1981
1988
  containerId: z10.string()
1982
1989
  })
1983
1990
  )
1984
1991
  );
1985
- var codeInterpreterOutputSchema = lazySchema(
1986
- () => zodSchema9(
1992
+ var codeInterpreterOutputSchema = lazySchema2(
1993
+ () => zodSchema10(
1987
1994
  z10.object({
1988
1995
  outputs: z10.array(
1989
1996
  z10.discriminatedUnion("type", [
@@ -1994,8 +2001,8 @@ var codeInterpreterOutputSchema = lazySchema(
1994
2001
  })
1995
2002
  )
1996
2003
  );
1997
- var codeInterpreterArgsSchema = lazySchema(
1998
- () => zodSchema9(
2004
+ var codeInterpreterArgsSchema = lazySchema2(
2005
+ () => zodSchema10(
1999
2006
  z10.object({
2000
2007
  container: z10.union([
2001
2008
  z10.string(),
@@ -2019,23 +2026,24 @@ var codeInterpreter = (args = {}) => {
2019
2026
  // src/tool/file-search.ts
2020
2027
  import {
2021
2028
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
2022
- lazySchema as lazySchema2,
2023
- zodSchema as zodSchema10
2029
+ lazySchema as lazySchema3,
2030
+ zodSchema as zodSchema11
2024
2031
  } from "@ai-sdk/provider-utils";
2025
2032
  import { z as z11 } from "zod/v4";
2026
- var comparisonFilterSchema = z11.object({
2033
+ var comparisonFilterSchema = () => z11.object({
2027
2034
  key: z11.string(),
2028
2035
  type: z11.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
2029
2036
  value: z11.union([z11.string(), z11.number(), z11.boolean(), z11.array(z11.string())])
2030
2037
  });
2031
- var compoundFilterSchema = z11.object({
2038
+ var cachedCompoundFilterSchema;
2039
+ var compoundFilterSchema = () => cachedCompoundFilterSchema != null ? cachedCompoundFilterSchema : cachedCompoundFilterSchema = z11.object({
2032
2040
  type: z11.enum(["and", "or"]),
2033
2041
  filters: z11.array(
2034
- z11.union([comparisonFilterSchema, z11.lazy(() => compoundFilterSchema)])
2042
+ z11.union([comparisonFilterSchema(), z11.lazy(() => compoundFilterSchema())])
2035
2043
  )
2036
2044
  });
2037
- var fileSearchArgsSchema = lazySchema2(
2038
- () => zodSchema10(
2045
+ var fileSearchArgsSchema = lazySchema3(
2046
+ () => zodSchema11(
2039
2047
  z11.object({
2040
2048
  vectorStoreIds: z11.array(z11.string()),
2041
2049
  maxNumResults: z11.number().optional(),
@@ -2043,12 +2051,12 @@ var fileSearchArgsSchema = lazySchema2(
2043
2051
  ranker: z11.string().optional(),
2044
2052
  scoreThreshold: z11.number().optional()
2045
2053
  }).optional(),
2046
- filters: z11.union([comparisonFilterSchema, compoundFilterSchema]).optional()
2054
+ filters: z11.union([comparisonFilterSchema(), compoundFilterSchema()]).optional()
2047
2055
  })
2048
2056
  )
2049
2057
  );
2050
- var fileSearchOutputSchema = lazySchema2(
2051
- () => zodSchema10(
2058
+ var fileSearchOutputSchema = lazySchema3(
2059
+ () => zodSchema11(
2052
2060
  z11.object({
2053
2061
  queries: z11.array(z11.string()),
2054
2062
  results: z11.array(
@@ -2073,12 +2081,12 @@ var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
2073
2081
  // src/tool/image-generation.ts
2074
2082
  import {
2075
2083
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
2076
- lazySchema as lazySchema3,
2077
- zodSchema as zodSchema11
2084
+ lazySchema as lazySchema4,
2085
+ zodSchema as zodSchema12
2078
2086
  } from "@ai-sdk/provider-utils";
2079
2087
  import { z as z12 } from "zod/v4";
2080
- var imageGenerationArgsSchema = lazySchema3(
2081
- () => zodSchema11(
2088
+ var imageGenerationArgsSchema = lazySchema4(
2089
+ () => zodSchema12(
2082
2090
  z12.object({
2083
2091
  background: z12.enum(["auto", "opaque", "transparent"]).optional(),
2084
2092
  inputFidelity: z12.enum(["low", "high"]).optional(),
@@ -2096,9 +2104,9 @@ var imageGenerationArgsSchema = lazySchema3(
2096
2104
  }).strict()
2097
2105
  )
2098
2106
  );
2099
- var imageGenerationInputSchema = lazySchema3(() => zodSchema11(z12.object({})));
2100
- var imageGenerationOutputSchema = lazySchema3(
2101
- () => zodSchema11(z12.object({ result: z12.string() }))
2107
+ var imageGenerationInputSchema = lazySchema4(() => zodSchema12(z12.object({})));
2108
+ var imageGenerationOutputSchema = lazySchema4(
2109
+ () => zodSchema12(z12.object({ result: z12.string() }))
2102
2110
  );
2103
2111
  var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
2104
2112
  id: "openai.image_generation",
@@ -2113,12 +2121,12 @@ var imageGeneration = (args = {}) => {
2113
2121
  // src/tool/local-shell.ts
2114
2122
  import {
2115
2123
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
2116
- lazySchema as lazySchema4,
2117
- zodSchema as zodSchema12
2124
+ lazySchema as lazySchema5,
2125
+ zodSchema as zodSchema13
2118
2126
  } from "@ai-sdk/provider-utils";
2119
2127
  import { z as z13 } from "zod/v4";
2120
- var localShellInputSchema = lazySchema4(
2121
- () => zodSchema12(
2128
+ var localShellInputSchema = lazySchema5(
2129
+ () => zodSchema13(
2122
2130
  z13.object({
2123
2131
  action: z13.object({
2124
2132
  type: z13.literal("exec"),
@@ -2131,8 +2139,8 @@ var localShellInputSchema = lazySchema4(
2131
2139
  })
2132
2140
  )
2133
2141
  );
2134
- var localShellOutputSchema = lazySchema4(
2135
- () => zodSchema12(z13.object({ output: z13.string() }))
2142
+ var localShellOutputSchema = lazySchema5(
2143
+ () => zodSchema13(z13.object({ output: z13.string() }))
2136
2144
  );
2137
2145
  var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
2138
2146
  id: "openai.local_shell",
@@ -2144,12 +2152,12 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
2144
2152
  // src/tool/web-search.ts
2145
2153
  import {
2146
2154
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
2147
- lazySchema as lazySchema5,
2148
- zodSchema as zodSchema13
2155
+ lazySchema as lazySchema6,
2156
+ zodSchema as zodSchema14
2149
2157
  } from "@ai-sdk/provider-utils";
2150
2158
  import { z as z14 } from "zod/v4";
2151
- var webSearchArgsSchema = lazySchema5(
2152
- () => zodSchema13(
2159
+ var webSearchArgsSchema = lazySchema6(
2160
+ () => zodSchema14(
2153
2161
  z14.object({
2154
2162
  externalWebAccess: z14.boolean().optional(),
2155
2163
  filters: z14.object({
@@ -2167,9 +2175,9 @@ var webSearchArgsSchema = lazySchema5(
2167
2175
  })
2168
2176
  )
2169
2177
  );
2170
- var webSearchInputSchema = lazySchema5(() => zodSchema13(z14.object({})));
2171
- var webSearchOutputSchema = lazySchema5(
2172
- () => zodSchema13(
2178
+ var webSearchInputSchema = lazySchema6(() => zodSchema14(z14.object({})));
2179
+ var webSearchOutputSchema = lazySchema6(
2180
+ () => zodSchema14(
2173
2181
  z14.object({
2174
2182
  action: z14.discriminatedUnion("type", [
2175
2183
  z14.object({
@@ -2206,12 +2214,12 @@ var webSearch = (args = {}) => webSearchToolFactory(args);
2206
2214
  // src/tool/web-search-preview.ts
2207
2215
  import {
2208
2216
  createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
2209
- lazySchema as lazySchema6,
2210
- zodSchema as zodSchema14
2217
+ lazySchema as lazySchema7,
2218
+ zodSchema as zodSchema15
2211
2219
  } from "@ai-sdk/provider-utils";
2212
2220
  import { z as z15 } from "zod/v4";
2213
- var webSearchPreviewArgsSchema = lazySchema6(
2214
- () => zodSchema14(
2221
+ var webSearchPreviewArgsSchema = lazySchema7(
2222
+ () => zodSchema15(
2215
2223
  z15.object({
2216
2224
  searchContextSize: z15.enum(["low", "medium", "high"]).optional(),
2217
2225
  userLocation: z15.object({
@@ -2224,11 +2232,11 @@ var webSearchPreviewArgsSchema = lazySchema6(
2224
2232
  })
2225
2233
  )
2226
2234
  );
2227
- var webSearchPreviewInputSchema = lazySchema6(
2228
- () => zodSchema14(z15.object({}))
2235
+ var webSearchPreviewInputSchema = lazySchema7(
2236
+ () => zodSchema15(z15.object({}))
2229
2237
  );
2230
- var webSearchPreviewOutputSchema = lazySchema6(
2231
- () => zodSchema14(
2238
+ var webSearchPreviewOutputSchema = lazySchema7(
2239
+ () => zodSchema15(
2232
2240
  z15.object({
2233
2241
  action: z15.discriminatedUnion("type", [
2234
2242
  z15.object({
@@ -2347,6 +2355,8 @@ import {
2347
2355
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
2348
2356
  } from "@ai-sdk/provider";
2349
2357
  import {
2358
+ lazySchema as lazySchema8,
2359
+ zodSchema as zodSchema17,
2350
2360
  convertToBase64 as convertToBase642,
2351
2361
  parseProviderOptions as parseProviderOptions5,
2352
2362
  safeValidateTypes,
@@ -2357,7 +2367,7 @@ import { z as z17 } from "zod/v4";
2357
2367
  // src/responses/openai-responses-options.ts
2358
2368
  import {
2359
2369
  lazyValidator as lazyValidator9,
2360
- zodSchema as zodSchema15
2370
+ zodSchema as zodSchema16
2361
2371
  } from "@ai-sdk/provider-utils";
2362
2372
  import { z as z16 } from "zod/v4";
2363
2373
  var TOP_LOGPROBS_MAX = 20;
@@ -2450,7 +2460,7 @@ var openaiResponsesModelIds = [
2450
2460
  ...openaiResponsesReasoningModelIds
2451
2461
  ];
2452
2462
  var openaiResponsesProviderOptionsSchema = lazyValidator9(
2453
- () => zodSchema15(
2463
+ () => zodSchema16(
2454
2464
  z16.object({
2455
2465
  conversation: z16.string().nullish(),
2456
2466
  include: z16.array(
@@ -2544,7 +2554,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2544
2554
  )
2545
2555
  );
2546
2556
  var openaiResponsesSystemMessageOptionsSchema = lazyValidator9(
2547
- () => zodSchema15(
2557
+ () => zodSchema16(
2548
2558
  z16.object({
2549
2559
  /**
2550
2560
  * Emit a configuration update at this position in Responses history.
@@ -2625,6 +2635,7 @@ async function convertToOpenAIResponsesInput({
2625
2635
  explicitMessageItemType = false,
2626
2636
  fileIdPrefixes,
2627
2637
  store,
2638
+ isReasoningModel = false,
2628
2639
  configurationUpdateUnsupportedReason,
2629
2640
  hasLocalShellTool = false,
2630
2641
  webSearchToolName
@@ -2778,12 +2789,14 @@ async function convertToOpenAIResponsesInput({
2778
2789
  case "assistant": {
2779
2790
  const reasoningMessages = {};
2780
2791
  const toolCallParts = {};
2792
+ let hasPrecedingReasoning = false;
2781
2793
  for (const part of content) {
2782
2794
  switch (part.type) {
2783
2795
  case "text": {
2784
2796
  const id = (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.itemId;
2785
2797
  const phase = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.phase;
2786
- if (store && id != null) {
2798
+ const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
2799
+ if (store && canUseItemId) {
2787
2800
  input.push({ type: "item_reference", id });
2788
2801
  break;
2789
2802
  }
@@ -2791,7 +2804,7 @@ async function convertToOpenAIResponsesInput({
2791
2804
  ...explicitMessageItemType && { type: "message" },
2792
2805
  role: "assistant",
2793
2806
  content: [{ type: "output_text", text: part.text }],
2794
- id,
2807
+ id: canUseItemId ? id : void 0,
2795
2808
  ...phase != null && { phase }
2796
2809
  });
2797
2810
  break;
@@ -2803,7 +2816,8 @@ async function convertToOpenAIResponsesInput({
2803
2816
  }
2804
2817
  const id = (_f = (_e = part.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
2805
2818
  const isAsync = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.async;
2806
- if (store && id != null) {
2819
+ const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
2820
+ if (store && canUseItemId) {
2807
2821
  input.push({ type: "item_reference", id });
2808
2822
  break;
2809
2823
  }
@@ -2833,7 +2847,7 @@ async function convertToOpenAIResponsesInput({
2833
2847
  name: part.toolName,
2834
2848
  arguments: JSON.stringify(part.input),
2835
2849
  ...isAsync != null && { async: isAsync },
2836
- id
2850
+ id: canUseItemId ? id : void 0
2837
2851
  });
2838
2852
  break;
2839
2853
  }
@@ -2865,6 +2879,7 @@ async function convertToOpenAIResponsesInput({
2865
2879
  break;
2866
2880
  }
2867
2881
  case "reasoning": {
2882
+ hasPrecedingReasoning = true;
2868
2883
  const providerOptions2 = await parseProviderOptions5({
2869
2884
  provider: "openai",
2870
2885
  providerOptions: part.providerOptions,
@@ -3022,10 +3037,14 @@ async function convertToOpenAIResponsesInput({
3022
3037
  }
3023
3038
  return { input, warnings };
3024
3039
  }
3025
- var openaiResponsesReasoningProviderOptionsSchema = z17.object({
3026
- itemId: z17.string().nullish(),
3027
- reasoningEncryptedContent: z17.string().nullish()
3028
- });
3040
+ var openaiResponsesReasoningProviderOptionsSchema = lazySchema8(
3041
+ () => zodSchema17(
3042
+ z17.object({
3043
+ itemId: z17.string().nullish(),
3044
+ reasoningEncryptedContent: z17.string().nullish()
3045
+ })
3046
+ )
3047
+ );
3029
3048
 
3030
3049
  // src/responses/map-openai-responses-finish-reason.ts
3031
3050
  function mapOpenAIResponseFinishReason({
@@ -3048,11 +3067,11 @@ function mapOpenAIResponseFinishReason({
3048
3067
  // src/responses/openai-responses-api.ts
3049
3068
  import {
3050
3069
  lazyValidator as lazyValidator10,
3051
- zodSchema as zodSchema16
3070
+ zodSchema as zodSchema18
3052
3071
  } from "@ai-sdk/provider-utils";
3053
3072
  import { z as z18 } from "zod/v4";
3054
3073
  var openaiResponsesChunkSchema = lazyValidator10(
3055
- () => zodSchema16(
3074
+ () => zodSchema18(
3056
3075
  z18.union([
3057
3076
  z18.object({
3058
3077
  type: z18.literal("response.output_text.delta"),
@@ -3339,7 +3358,7 @@ var openaiResponsesChunkSchema = lazyValidator10(
3339
3358
  )
3340
3359
  );
3341
3360
  var openaiResponsesResponseSchema = lazyValidator10(
3342
- () => zodSchema16(
3361
+ () => zodSchema18(
3343
3362
  z18.object({
3344
3363
  id: z18.string().optional(),
3345
3364
  created_at: z18.number().optional(),
@@ -3800,6 +3819,7 @@ var OpenAIResponsesLanguageModel = class {
3800
3819
  explicitMessageItemType: this.config.explicitMessageItemType,
3801
3820
  fileIdPrefixes: this.config.fileIdPrefixes,
3802
3821
  store: (_b = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _b : true,
3822
+ isReasoningModel: modelCapabilities.isReasoningModel,
3803
3823
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
3804
3824
  webSearchToolName
3805
3825
  });
@@ -4944,11 +4964,11 @@ import {
4944
4964
  // src/speech/openai-speech-options.ts
4945
4965
  import {
4946
4966
  lazyValidator as lazyValidator11,
4947
- zodSchema as zodSchema17
4967
+ zodSchema as zodSchema19
4948
4968
  } from "@ai-sdk/provider-utils";
4949
4969
  import { z as z19 } from "zod/v4";
4950
4970
  var openaiSpeechProviderOptionsSchema = lazyValidator11(
4951
- () => zodSchema17(
4971
+ () => zodSchema19(
4952
4972
  z19.object({
4953
4973
  instructions: z19.string().nullish(),
4954
4974
  speed: z19.number().min(0.25).max(4).default(1).nullish()
@@ -5068,10 +5088,10 @@ import {
5068
5088
  } from "@ai-sdk/provider-utils";
5069
5089
 
5070
5090
  // src/transcription/openai-transcription-api.ts
5071
- import { lazyValidator as lazyValidator12, zodSchema as zodSchema18 } from "@ai-sdk/provider-utils";
5091
+ import { lazyValidator as lazyValidator12, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
5072
5092
  import { z as z20 } from "zod/v4";
5073
5093
  var openaiTranscriptionResponseSchema = lazyValidator12(
5074
- () => zodSchema18(
5094
+ () => zodSchema20(
5075
5095
  z20.object({
5076
5096
  text: z20.string(),
5077
5097
  language: z20.string().nullish(),
@@ -5104,11 +5124,11 @@ var openaiTranscriptionResponseSchema = lazyValidator12(
5104
5124
  // src/transcription/openai-transcription-options.ts
5105
5125
  import {
5106
5126
  lazyValidator as lazyValidator13,
5107
- zodSchema as zodSchema19
5127
+ zodSchema as zodSchema21
5108
5128
  } from "@ai-sdk/provider-utils";
5109
5129
  import { z as z21 } from "zod/v4";
5110
5130
  var openAITranscriptionProviderOptions = lazyValidator13(
5111
- () => zodSchema19(
5131
+ () => zodSchema21(
5112
5132
  z21.object({
5113
5133
  /**
5114
5134
  * Additional information to include in the transcription response.
@@ -5304,7 +5324,7 @@ var OpenAITranscriptionModel = class {
5304
5324
  };
5305
5325
 
5306
5326
  // src/version.ts
5307
- var VERSION = true ? "2.0.134" : "0.0.0-test";
5327
+ var VERSION = true ? "2.0.136" : "0.0.0-test";
5308
5328
 
5309
5329
  // src/openai-provider.ts
5310
5330
  function createOpenAI(options = {}) {