@ai-sdk/openai 2.1.0-beta.0 → 2.1.0-beta.10

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.js CHANGED
@@ -20,13 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ VERSION: () => VERSION,
23
24
  createOpenAI: () => createOpenAI,
24
25
  openai: () => openai
25
26
  });
26
27
  module.exports = __toCommonJS(src_exports);
27
28
 
28
29
  // src/openai-provider.ts
29
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
30
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
30
31
 
31
32
  // src/chat/openai-chat-language-model.ts
32
33
  var import_provider3 = require("@ai-sdk/provider");
@@ -262,7 +263,7 @@ function mapOpenAIFinishReason(finishReason) {
262
263
 
263
264
  // src/chat/openai-chat-options.ts
264
265
  var import_v42 = require("zod/v4");
265
- var openaiProviderOptions = import_v42.z.object({
266
+ var openaiChatLanguageModelOptions = import_v42.z.object({
266
267
  /**
267
268
  * Modify the likelihood of specified tokens appearing in the completion.
268
269
  *
@@ -414,7 +415,7 @@ function prepareChatTools({
414
415
  // src/chat/openai-chat-language-model.ts
415
416
  var OpenAIChatLanguageModel = class {
416
417
  constructor(modelId, config) {
417
- this.specificationVersion = "v2";
418
+ this.specificationVersion = "v3";
418
419
  this.supportedUrls = {
419
420
  "image/*": [/^https?:\/\/.*$/]
420
421
  };
@@ -444,7 +445,7 @@ var OpenAIChatLanguageModel = class {
444
445
  const openaiOptions = (_a = await (0, import_provider_utils3.parseProviderOptions)({
445
446
  provider: "openai",
446
447
  providerOptions,
447
- schema: openaiProviderOptions
448
+ schema: openaiChatLanguageModelOptions
448
449
  })) != null ? _a : {};
449
450
  const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
450
451
  if (topK != null) {
@@ -1223,7 +1224,7 @@ var openaiCompletionProviderOptions = import_v44.z.object({
1223
1224
  // src/completion/openai-completion-language-model.ts
1224
1225
  var OpenAICompletionLanguageModel = class {
1225
1226
  constructor(modelId, config) {
1226
- this.specificationVersion = "v2";
1227
+ this.specificationVersion = "v3";
1227
1228
  this.supportedUrls = {
1228
1229
  // No URLs are supported for completion models.
1229
1230
  };
@@ -1516,7 +1517,7 @@ var openaiEmbeddingProviderOptions = import_v46.z.object({
1516
1517
  // src/embedding/openai-embedding-model.ts
1517
1518
  var OpenAIEmbeddingModel = class {
1518
1519
  constructor(modelId, config) {
1519
- this.specificationVersion = "v2";
1520
+ this.specificationVersion = "v3";
1520
1521
  this.maxEmbeddingsPerCall = 2048;
1521
1522
  this.supportsParallelCalls = true;
1522
1523
  this.modelId = modelId;
@@ -1598,7 +1599,7 @@ var OpenAIImageModel = class {
1598
1599
  constructor(modelId, config) {
1599
1600
  this.modelId = modelId;
1600
1601
  this.config = config;
1601
- this.specificationVersion = "v2";
1602
+ this.specificationVersion = "v3";
1602
1603
  }
1603
1604
  get maxImagesPerCall() {
1604
1605
  var _a;
@@ -1782,39 +1783,62 @@ var imageGeneration = (args = {}) => {
1782
1783
  return imageGenerationToolFactory(args);
1783
1784
  };
1784
1785
 
1785
- // src/tool/web-search.ts
1786
+ // src/tool/local-shell.ts
1786
1787
  var import_provider_utils10 = require("@ai-sdk/provider-utils");
1787
1788
  var import_v412 = require("zod/v4");
1788
- var webSearchArgsSchema = import_v412.z.object({
1789
- filters: import_v412.z.object({
1790
- allowedDomains: import_v412.z.array(import_v412.z.string()).optional()
1789
+ var localShellInputSchema = import_v412.z.object({
1790
+ action: import_v412.z.object({
1791
+ type: import_v412.z.literal("exec"),
1792
+ command: import_v412.z.array(import_v412.z.string()),
1793
+ timeoutMs: import_v412.z.number().optional(),
1794
+ user: import_v412.z.string().optional(),
1795
+ workingDirectory: import_v412.z.string().optional(),
1796
+ env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
1797
+ })
1798
+ });
1799
+ var localShellOutputSchema = import_v412.z.object({
1800
+ output: import_v412.z.string()
1801
+ });
1802
+ var localShell = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
1803
+ id: "openai.local_shell",
1804
+ name: "local_shell",
1805
+ inputSchema: localShellInputSchema,
1806
+ outputSchema: localShellOutputSchema
1807
+ });
1808
+
1809
+ // src/tool/web-search.ts
1810
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1811
+ var import_v413 = require("zod/v4");
1812
+ var webSearchArgsSchema = import_v413.z.object({
1813
+ filters: import_v413.z.object({
1814
+ allowedDomains: import_v413.z.array(import_v413.z.string()).optional()
1791
1815
  }).optional(),
1792
- searchContextSize: import_v412.z.enum(["low", "medium", "high"]).optional(),
1793
- userLocation: import_v412.z.object({
1794
- type: import_v412.z.literal("approximate"),
1795
- country: import_v412.z.string().optional(),
1796
- city: import_v412.z.string().optional(),
1797
- region: import_v412.z.string().optional(),
1798
- timezone: import_v412.z.string().optional()
1816
+ searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
1817
+ userLocation: import_v413.z.object({
1818
+ type: import_v413.z.literal("approximate"),
1819
+ country: import_v413.z.string().optional(),
1820
+ city: import_v413.z.string().optional(),
1821
+ region: import_v413.z.string().optional(),
1822
+ timezone: import_v413.z.string().optional()
1799
1823
  }).optional()
1800
1824
  });
1801
- var webSearchToolFactory = (0, import_provider_utils10.createProviderDefinedToolFactory)({
1825
+ var webSearchToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1802
1826
  id: "openai.web_search",
1803
1827
  name: "web_search",
1804
- inputSchema: import_v412.z.object({
1805
- action: import_v412.z.discriminatedUnion("type", [
1806
- import_v412.z.object({
1807
- type: import_v412.z.literal("search"),
1808
- query: import_v412.z.string().nullish()
1828
+ inputSchema: import_v413.z.object({
1829
+ action: import_v413.z.discriminatedUnion("type", [
1830
+ import_v413.z.object({
1831
+ type: import_v413.z.literal("search"),
1832
+ query: import_v413.z.string().nullish()
1809
1833
  }),
1810
- import_v412.z.object({
1811
- type: import_v412.z.literal("open_page"),
1812
- url: import_v412.z.string()
1834
+ import_v413.z.object({
1835
+ type: import_v413.z.literal("open_page"),
1836
+ url: import_v413.z.string()
1813
1837
  }),
1814
- import_v412.z.object({
1815
- type: import_v412.z.literal("find"),
1816
- url: import_v412.z.string(),
1817
- pattern: import_v412.z.string()
1838
+ import_v413.z.object({
1839
+ type: import_v413.z.literal("find"),
1840
+ url: import_v413.z.string(),
1841
+ pattern: import_v413.z.string()
1818
1842
  })
1819
1843
  ]).nullish()
1820
1844
  })
@@ -1824,59 +1848,59 @@ var webSearch = (args = {}) => {
1824
1848
  };
1825
1849
 
1826
1850
  // src/tool/web-search-preview.ts
1827
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1828
- var import_v413 = require("zod/v4");
1829
- var webSearchPreviewArgsSchema = import_v413.z.object({
1851
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1852
+ var import_v414 = require("zod/v4");
1853
+ var webSearchPreviewArgsSchema = import_v414.z.object({
1830
1854
  /**
1831
1855
  * Search context size to use for the web search.
1832
1856
  * - high: Most comprehensive context, highest cost, slower response
1833
1857
  * - medium: Balanced context, cost, and latency (default)
1834
1858
  * - low: Least context, lowest cost, fastest response
1835
1859
  */
1836
- searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
1860
+ searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
1837
1861
  /**
1838
1862
  * User location information to provide geographically relevant search results.
1839
1863
  */
1840
- userLocation: import_v413.z.object({
1864
+ userLocation: import_v414.z.object({
1841
1865
  /**
1842
1866
  * Type of location (always 'approximate')
1843
1867
  */
1844
- type: import_v413.z.literal("approximate"),
1868
+ type: import_v414.z.literal("approximate"),
1845
1869
  /**
1846
1870
  * Two-letter ISO country code (e.g., 'US', 'GB')
1847
1871
  */
1848
- country: import_v413.z.string().optional(),
1872
+ country: import_v414.z.string().optional(),
1849
1873
  /**
1850
1874
  * City name (free text, e.g., 'Minneapolis')
1851
1875
  */
1852
- city: import_v413.z.string().optional(),
1876
+ city: import_v414.z.string().optional(),
1853
1877
  /**
1854
1878
  * Region name (free text, e.g., 'Minnesota')
1855
1879
  */
1856
- region: import_v413.z.string().optional(),
1880
+ region: import_v414.z.string().optional(),
1857
1881
  /**
1858
1882
  * IANA timezone (e.g., 'America/Chicago')
1859
1883
  */
1860
- timezone: import_v413.z.string().optional()
1884
+ timezone: import_v414.z.string().optional()
1861
1885
  }).optional()
1862
1886
  });
1863
- var webSearchPreview = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1887
+ var webSearchPreview = (0, import_provider_utils12.createProviderDefinedToolFactory)({
1864
1888
  id: "openai.web_search_preview",
1865
1889
  name: "web_search_preview",
1866
- inputSchema: import_v413.z.object({
1867
- action: import_v413.z.discriminatedUnion("type", [
1868
- import_v413.z.object({
1869
- type: import_v413.z.literal("search"),
1870
- query: import_v413.z.string().nullish()
1890
+ inputSchema: import_v414.z.object({
1891
+ action: import_v414.z.discriminatedUnion("type", [
1892
+ import_v414.z.object({
1893
+ type: import_v414.z.literal("search"),
1894
+ query: import_v414.z.string().nullish()
1871
1895
  }),
1872
- import_v413.z.object({
1873
- type: import_v413.z.literal("open_page"),
1874
- url: import_v413.z.string()
1896
+ import_v414.z.object({
1897
+ type: import_v414.z.literal("open_page"),
1898
+ url: import_v414.z.string()
1875
1899
  }),
1876
- import_v413.z.object({
1877
- type: import_v413.z.literal("find"),
1878
- url: import_v413.z.string(),
1879
- pattern: import_v413.z.string()
1900
+ import_v414.z.object({
1901
+ type: import_v414.z.literal("find"),
1902
+ url: import_v414.z.string(),
1903
+ pattern: import_v414.z.string()
1880
1904
  })
1881
1905
  ]).nullish()
1882
1906
  })
@@ -1921,6 +1945,15 @@ var openaiTools = {
1921
1945
  * @param background - Transparent or opaque
1922
1946
  */
1923
1947
  imageGeneration,
1948
+ /**
1949
+ * Local shell is a tool that allows agents to run shell commands locally
1950
+ * on a machine you or the user provides.
1951
+ *
1952
+ * Supported models: `gpt-5-codex` and `codex-mini-latest`
1953
+ *
1954
+ * Must have name `local_shell`.
1955
+ */
1956
+ localShell,
1924
1957
  /**
1925
1958
  * Web search allows models to access up-to-date information from the internet
1926
1959
  * and provide answers with sourced citations.
@@ -1948,13 +1981,13 @@ var openaiTools = {
1948
1981
 
1949
1982
  // src/responses/openai-responses-language-model.ts
1950
1983
  var import_provider8 = require("@ai-sdk/provider");
1951
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1952
- var import_v415 = require("zod/v4");
1984
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
1985
+ var import_v416 = require("zod/v4");
1953
1986
 
1954
1987
  // src/responses/convert-to-openai-responses-input.ts
1955
1988
  var import_provider6 = require("@ai-sdk/provider");
1956
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1957
- var import_v414 = require("zod/v4");
1989
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1990
+ var import_v415 = require("zod/v4");
1958
1991
  function isFileId(data, prefixes) {
1959
1992
  if (!prefixes) return false;
1960
1993
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -1963,9 +1996,10 @@ async function convertToOpenAIResponsesInput({
1963
1996
  prompt,
1964
1997
  systemMessageMode,
1965
1998
  fileIdPrefixes,
1966
- store
1999
+ store,
2000
+ hasLocalShellTool = false
1967
2001
  }) {
1968
- var _a, _b, _c, _d, _e, _f;
2002
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1969
2003
  const input = [];
1970
2004
  const warnings = [];
1971
2005
  for (const { role, content } of prompt) {
@@ -2011,7 +2045,7 @@ async function convertToOpenAIResponsesInput({
2011
2045
  return {
2012
2046
  type: "input_image",
2013
2047
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2014
- image_url: `data:${mediaType};base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
2048
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils13.convertToBase64)(part.data)}`
2015
2049
  },
2016
2050
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
2017
2051
  };
@@ -2026,7 +2060,7 @@ async function convertToOpenAIResponsesInput({
2026
2060
  type: "input_file",
2027
2061
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2028
2062
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2029
- file_data: `data:application/pdf;base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
2063
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils13.convertToBase64)(part.data)}`
2030
2064
  }
2031
2065
  };
2032
2066
  } else {
@@ -2058,15 +2092,33 @@ async function convertToOpenAIResponsesInput({
2058
2092
  if (part.providerExecuted) {
2059
2093
  break;
2060
2094
  }
2095
+ if (hasLocalShellTool && part.toolName === "local_shell") {
2096
+ const parsedInput = localShellInputSchema.parse(part.input);
2097
+ input.push({
2098
+ type: "local_shell_call",
2099
+ call_id: part.toolCallId,
2100
+ id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2101
+ action: {
2102
+ type: "exec",
2103
+ command: parsedInput.action.command,
2104
+ timeout_ms: parsedInput.action.timeoutMs,
2105
+ user: parsedInput.action.user,
2106
+ working_directory: parsedInput.action.workingDirectory,
2107
+ env: parsedInput.action.env
2108
+ }
2109
+ });
2110
+ break;
2111
+ }
2061
2112
  input.push({
2062
2113
  type: "function_call",
2063
2114
  call_id: part.toolCallId,
2064
2115
  name: part.toolName,
2065
2116
  arguments: JSON.stringify(part.input),
2066
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0
2117
+ id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2067
2118
  });
2068
2119
  break;
2069
2120
  }
2121
+ // assistant tool result parts are from provider-executed tools:
2070
2122
  case "tool-result": {
2071
2123
  if (store) {
2072
2124
  input.push({ type: "item_reference", id: part.toolCallId });
@@ -2079,33 +2131,47 @@ async function convertToOpenAIResponsesInput({
2079
2131
  break;
2080
2132
  }
2081
2133
  case "reasoning": {
2082
- const providerOptions = await (0, import_provider_utils12.parseProviderOptions)({
2134
+ const providerOptions = await (0, import_provider_utils13.parseProviderOptions)({
2083
2135
  provider: "openai",
2084
2136
  providerOptions: part.providerOptions,
2085
2137
  schema: openaiResponsesReasoningProviderOptionsSchema
2086
2138
  });
2087
2139
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2088
2140
  if (reasoningId != null) {
2089
- const existingReasoningMessage = reasoningMessages[reasoningId];
2090
- const summaryParts = [];
2091
- if (part.text.length > 0) {
2092
- summaryParts.push({ type: "summary_text", text: part.text });
2093
- } else if (existingReasoningMessage !== void 0) {
2094
- warnings.push({
2095
- type: "other",
2096
- message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2097
- });
2098
- }
2099
- if (existingReasoningMessage === void 0) {
2100
- reasoningMessages[reasoningId] = {
2101
- type: "reasoning",
2102
- id: reasoningId,
2103
- encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2104
- summary: summaryParts
2105
- };
2106
- input.push(reasoningMessages[reasoningId]);
2141
+ const reasoningMessage = reasoningMessages[reasoningId];
2142
+ if (store) {
2143
+ if (reasoningMessage === void 0) {
2144
+ input.push({ type: "item_reference", id: reasoningId });
2145
+ reasoningMessages[reasoningId] = {
2146
+ type: "reasoning",
2147
+ id: reasoningId,
2148
+ summary: []
2149
+ };
2150
+ }
2107
2151
  } else {
2108
- existingReasoningMessage.summary.push(...summaryParts);
2152
+ const summaryParts = [];
2153
+ if (part.text.length > 0) {
2154
+ summaryParts.push({
2155
+ type: "summary_text",
2156
+ text: part.text
2157
+ });
2158
+ } else if (reasoningMessage !== void 0) {
2159
+ warnings.push({
2160
+ type: "other",
2161
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2162
+ });
2163
+ }
2164
+ if (reasoningMessage === void 0) {
2165
+ reasoningMessages[reasoningId] = {
2166
+ type: "reasoning",
2167
+ id: reasoningId,
2168
+ encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2169
+ summary: summaryParts
2170
+ };
2171
+ input.push(reasoningMessages[reasoningId]);
2172
+ } else {
2173
+ reasoningMessage.summary.push(...summaryParts);
2174
+ }
2109
2175
  }
2110
2176
  } else {
2111
2177
  warnings.push({
@@ -2122,6 +2188,14 @@ async function convertToOpenAIResponsesInput({
2122
2188
  case "tool": {
2123
2189
  for (const part of content) {
2124
2190
  const output = part.output;
2191
+ if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2192
+ input.push({
2193
+ type: "local_shell_call_output",
2194
+ call_id: part.toolCallId,
2195
+ output: localShellOutputSchema.parse(output.value).output
2196
+ });
2197
+ break;
2198
+ }
2125
2199
  let contentValue;
2126
2200
  switch (output.type) {
2127
2201
  case "text":
@@ -2150,9 +2224,9 @@ async function convertToOpenAIResponsesInput({
2150
2224
  }
2151
2225
  return { input, warnings };
2152
2226
  }
2153
- var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2154
- itemId: import_v414.z.string().nullish(),
2155
- reasoningEncryptedContent: import_v414.z.string().nullish()
2227
+ var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
2228
+ itemId: import_v415.z.string().nullish(),
2229
+ reasoningEncryptedContent: import_v415.z.string().nullish()
2156
2230
  });
2157
2231
 
2158
2232
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2213,6 +2287,12 @@ function prepareResponsesTools({
2213
2287
  });
2214
2288
  break;
2215
2289
  }
2290
+ case "openai.local_shell": {
2291
+ openaiTools2.push({
2292
+ type: "local_shell"
2293
+ });
2294
+ break;
2295
+ }
2216
2296
  case "openai.web_search_preview": {
2217
2297
  const args = webSearchPreviewArgsSchema.parse(tool.args);
2218
2298
  openaiTools2.push({
@@ -2292,73 +2372,86 @@ function prepareResponsesTools({
2292
2372
  }
2293
2373
 
2294
2374
  // src/responses/openai-responses-language-model.ts
2295
- var webSearchCallItem = import_v415.z.object({
2296
- type: import_v415.z.literal("web_search_call"),
2297
- id: import_v415.z.string(),
2298
- status: import_v415.z.string(),
2299
- action: import_v415.z.discriminatedUnion("type", [
2300
- import_v415.z.object({
2301
- type: import_v415.z.literal("search"),
2302
- query: import_v415.z.string().nullish()
2375
+ var webSearchCallItem = import_v416.z.object({
2376
+ type: import_v416.z.literal("web_search_call"),
2377
+ id: import_v416.z.string(),
2378
+ status: import_v416.z.string(),
2379
+ action: import_v416.z.discriminatedUnion("type", [
2380
+ import_v416.z.object({
2381
+ type: import_v416.z.literal("search"),
2382
+ query: import_v416.z.string().nullish()
2303
2383
  }),
2304
- import_v415.z.object({
2305
- type: import_v415.z.literal("open_page"),
2306
- url: import_v415.z.string()
2384
+ import_v416.z.object({
2385
+ type: import_v416.z.literal("open_page"),
2386
+ url: import_v416.z.string()
2307
2387
  }),
2308
- import_v415.z.object({
2309
- type: import_v415.z.literal("find"),
2310
- url: import_v415.z.string(),
2311
- pattern: import_v415.z.string()
2388
+ import_v416.z.object({
2389
+ type: import_v416.z.literal("find"),
2390
+ url: import_v416.z.string(),
2391
+ pattern: import_v416.z.string()
2312
2392
  })
2313
2393
  ]).nullish()
2314
2394
  });
2315
- var fileSearchCallItem = import_v415.z.object({
2316
- type: import_v415.z.literal("file_search_call"),
2317
- id: import_v415.z.string(),
2318
- queries: import_v415.z.array(import_v415.z.string()),
2319
- results: import_v415.z.array(
2320
- import_v415.z.object({
2321
- attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
2322
- file_id: import_v415.z.string(),
2323
- filename: import_v415.z.string(),
2324
- score: import_v415.z.number(),
2325
- text: import_v415.z.string()
2395
+ var fileSearchCallItem = import_v416.z.object({
2396
+ type: import_v416.z.literal("file_search_call"),
2397
+ id: import_v416.z.string(),
2398
+ queries: import_v416.z.array(import_v416.z.string()),
2399
+ results: import_v416.z.array(
2400
+ import_v416.z.object({
2401
+ attributes: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()),
2402
+ file_id: import_v416.z.string(),
2403
+ filename: import_v416.z.string(),
2404
+ score: import_v416.z.number(),
2405
+ text: import_v416.z.string()
2326
2406
  })
2327
2407
  ).nullish()
2328
2408
  });
2329
- var codeInterpreterCallItem = import_v415.z.object({
2330
- type: import_v415.z.literal("code_interpreter_call"),
2331
- id: import_v415.z.string(),
2332
- code: import_v415.z.string().nullable(),
2333
- container_id: import_v415.z.string(),
2334
- outputs: import_v415.z.array(
2335
- import_v415.z.discriminatedUnion("type", [
2336
- import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
2337
- import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
2409
+ var codeInterpreterCallItem = import_v416.z.object({
2410
+ type: import_v416.z.literal("code_interpreter_call"),
2411
+ id: import_v416.z.string(),
2412
+ code: import_v416.z.string().nullable(),
2413
+ container_id: import_v416.z.string(),
2414
+ outputs: import_v416.z.array(
2415
+ import_v416.z.discriminatedUnion("type", [
2416
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
2417
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2338
2418
  ])
2339
2419
  ).nullable()
2340
2420
  });
2341
- var imageGenerationCallItem = import_v415.z.object({
2342
- type: import_v415.z.literal("image_generation_call"),
2343
- id: import_v415.z.string(),
2344
- result: import_v415.z.string()
2421
+ var localShellCallItem = import_v416.z.object({
2422
+ type: import_v416.z.literal("local_shell_call"),
2423
+ id: import_v416.z.string(),
2424
+ call_id: import_v416.z.string(),
2425
+ action: import_v416.z.object({
2426
+ type: import_v416.z.literal("exec"),
2427
+ command: import_v416.z.array(import_v416.z.string()),
2428
+ timeout_ms: import_v416.z.number().optional(),
2429
+ user: import_v416.z.string().optional(),
2430
+ working_directory: import_v416.z.string().optional(),
2431
+ env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
2432
+ })
2433
+ });
2434
+ var imageGenerationCallItem = import_v416.z.object({
2435
+ type: import_v416.z.literal("image_generation_call"),
2436
+ id: import_v416.z.string(),
2437
+ result: import_v416.z.string()
2345
2438
  });
2346
2439
  var TOP_LOGPROBS_MAX = 20;
2347
- var LOGPROBS_SCHEMA = import_v415.z.array(
2348
- import_v415.z.object({
2349
- token: import_v415.z.string(),
2350
- logprob: import_v415.z.number(),
2351
- top_logprobs: import_v415.z.array(
2352
- import_v415.z.object({
2353
- token: import_v415.z.string(),
2354
- logprob: import_v415.z.number()
2440
+ var LOGPROBS_SCHEMA = import_v416.z.array(
2441
+ import_v416.z.object({
2442
+ token: import_v416.z.string(),
2443
+ logprob: import_v416.z.number(),
2444
+ top_logprobs: import_v416.z.array(
2445
+ import_v416.z.object({
2446
+ token: import_v416.z.string(),
2447
+ logprob: import_v416.z.number()
2355
2448
  })
2356
2449
  )
2357
2450
  })
2358
2451
  );
2359
2452
  var OpenAIResponsesLanguageModel = class {
2360
2453
  constructor(modelId, config) {
2361
- this.specificationVersion = "v2";
2454
+ this.specificationVersion = "v3";
2362
2455
  this.supportedUrls = {
2363
2456
  "image/*": [/^https?:\/\/.*$/],
2364
2457
  "application/pdf": [/^https?:\/\/.*$/]
@@ -2408,7 +2501,7 @@ var OpenAIResponsesLanguageModel = class {
2408
2501
  if (stopSequences != null) {
2409
2502
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2410
2503
  }
2411
- const openaiOptions = await (0, import_provider_utils13.parseProviderOptions)({
2504
+ const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
2412
2505
  provider: "openai",
2413
2506
  providerOptions,
2414
2507
  schema: openaiResponsesProviderOptionsSchema
@@ -2417,7 +2510,8 @@ var OpenAIResponsesLanguageModel = class {
2417
2510
  prompt,
2418
2511
  systemMessageMode: modelConfig.systemMessageMode,
2419
2512
  fileIdPrefixes: this.config.fileIdPrefixes,
2420
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2513
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
2514
+ hasLocalShellTool: hasOpenAITool("openai.local_shell")
2421
2515
  });
2422
2516
  warnings.push(...inputWarnings);
2423
2517
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -2576,51 +2670,51 @@ var OpenAIResponsesLanguageModel = class {
2576
2670
  responseHeaders,
2577
2671
  value: response,
2578
2672
  rawValue: rawResponse
2579
- } = await (0, import_provider_utils13.postJsonToApi)({
2673
+ } = await (0, import_provider_utils14.postJsonToApi)({
2580
2674
  url,
2581
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2675
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2582
2676
  body,
2583
2677
  failedResponseHandler: openaiFailedResponseHandler,
2584
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
2585
- import_v415.z.object({
2586
- id: import_v415.z.string(),
2587
- created_at: import_v415.z.number(),
2588
- error: import_v415.z.object({
2589
- code: import_v415.z.string(),
2590
- message: import_v415.z.string()
2678
+ successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
2679
+ import_v416.z.object({
2680
+ id: import_v416.z.string(),
2681
+ created_at: import_v416.z.number(),
2682
+ error: import_v416.z.object({
2683
+ code: import_v416.z.string(),
2684
+ message: import_v416.z.string()
2591
2685
  }).nullish(),
2592
- model: import_v415.z.string(),
2593
- output: import_v415.z.array(
2594
- import_v415.z.discriminatedUnion("type", [
2595
- import_v415.z.object({
2596
- type: import_v415.z.literal("message"),
2597
- role: import_v415.z.literal("assistant"),
2598
- id: import_v415.z.string(),
2599
- content: import_v415.z.array(
2600
- import_v415.z.object({
2601
- type: import_v415.z.literal("output_text"),
2602
- text: import_v415.z.string(),
2686
+ model: import_v416.z.string(),
2687
+ output: import_v416.z.array(
2688
+ import_v416.z.discriminatedUnion("type", [
2689
+ import_v416.z.object({
2690
+ type: import_v416.z.literal("message"),
2691
+ role: import_v416.z.literal("assistant"),
2692
+ id: import_v416.z.string(),
2693
+ content: import_v416.z.array(
2694
+ import_v416.z.object({
2695
+ type: import_v416.z.literal("output_text"),
2696
+ text: import_v416.z.string(),
2603
2697
  logprobs: LOGPROBS_SCHEMA.nullish(),
2604
- annotations: import_v415.z.array(
2605
- import_v415.z.discriminatedUnion("type", [
2606
- import_v415.z.object({
2607
- type: import_v415.z.literal("url_citation"),
2608
- start_index: import_v415.z.number(),
2609
- end_index: import_v415.z.number(),
2610
- url: import_v415.z.string(),
2611
- title: import_v415.z.string()
2698
+ annotations: import_v416.z.array(
2699
+ import_v416.z.discriminatedUnion("type", [
2700
+ import_v416.z.object({
2701
+ type: import_v416.z.literal("url_citation"),
2702
+ start_index: import_v416.z.number(),
2703
+ end_index: import_v416.z.number(),
2704
+ url: import_v416.z.string(),
2705
+ title: import_v416.z.string()
2612
2706
  }),
2613
- import_v415.z.object({
2614
- type: import_v415.z.literal("file_citation"),
2615
- file_id: import_v415.z.string(),
2616
- filename: import_v415.z.string().nullish(),
2617
- index: import_v415.z.number().nullish(),
2618
- start_index: import_v415.z.number().nullish(),
2619
- end_index: import_v415.z.number().nullish(),
2620
- quote: import_v415.z.string().nullish()
2707
+ import_v416.z.object({
2708
+ type: import_v416.z.literal("file_citation"),
2709
+ file_id: import_v416.z.string(),
2710
+ filename: import_v416.z.string().nullish(),
2711
+ index: import_v416.z.number().nullish(),
2712
+ start_index: import_v416.z.number().nullish(),
2713
+ end_index: import_v416.z.number().nullish(),
2714
+ quote: import_v416.z.string().nullish()
2621
2715
  }),
2622
- import_v415.z.object({
2623
- type: import_v415.z.literal("container_file_citation")
2716
+ import_v416.z.object({
2717
+ type: import_v416.z.literal("container_file_citation")
2624
2718
  })
2625
2719
  ])
2626
2720
  )
@@ -2631,33 +2725,34 @@ var OpenAIResponsesLanguageModel = class {
2631
2725
  fileSearchCallItem,
2632
2726
  codeInterpreterCallItem,
2633
2727
  imageGenerationCallItem,
2634
- import_v415.z.object({
2635
- type: import_v415.z.literal("function_call"),
2636
- call_id: import_v415.z.string(),
2637
- name: import_v415.z.string(),
2638
- arguments: import_v415.z.string(),
2639
- id: import_v415.z.string()
2728
+ localShellCallItem,
2729
+ import_v416.z.object({
2730
+ type: import_v416.z.literal("function_call"),
2731
+ call_id: import_v416.z.string(),
2732
+ name: import_v416.z.string(),
2733
+ arguments: import_v416.z.string(),
2734
+ id: import_v416.z.string()
2640
2735
  }),
2641
- import_v415.z.object({
2642
- type: import_v415.z.literal("computer_call"),
2643
- id: import_v415.z.string(),
2644
- status: import_v415.z.string().optional()
2736
+ import_v416.z.object({
2737
+ type: import_v416.z.literal("computer_call"),
2738
+ id: import_v416.z.string(),
2739
+ status: import_v416.z.string().optional()
2645
2740
  }),
2646
- import_v415.z.object({
2647
- type: import_v415.z.literal("reasoning"),
2648
- id: import_v415.z.string(),
2649
- encrypted_content: import_v415.z.string().nullish(),
2650
- summary: import_v415.z.array(
2651
- import_v415.z.object({
2652
- type: import_v415.z.literal("summary_text"),
2653
- text: import_v415.z.string()
2741
+ import_v416.z.object({
2742
+ type: import_v416.z.literal("reasoning"),
2743
+ id: import_v416.z.string(),
2744
+ encrypted_content: import_v416.z.string().nullish(),
2745
+ summary: import_v416.z.array(
2746
+ import_v416.z.object({
2747
+ type: import_v416.z.literal("summary_text"),
2748
+ text: import_v416.z.string()
2654
2749
  })
2655
2750
  )
2656
2751
  })
2657
2752
  ])
2658
2753
  ),
2659
- service_tier: import_v415.z.string().nullish(),
2660
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullable(),
2754
+ service_tier: import_v416.z.string().nullish(),
2755
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
2661
2756
  usage: usageSchema2
2662
2757
  })
2663
2758
  ),
@@ -2717,6 +2812,20 @@ var OpenAIResponsesLanguageModel = class {
2717
2812
  });
2718
2813
  break;
2719
2814
  }
2815
+ case "local_shell_call": {
2816
+ content.push({
2817
+ type: "tool-call",
2818
+ toolCallId: part.call_id,
2819
+ toolName: "local_shell",
2820
+ input: JSON.stringify({ action: part.action }),
2821
+ providerMetadata: {
2822
+ openai: {
2823
+ itemId: part.id
2824
+ }
2825
+ }
2826
+ });
2827
+ break;
2828
+ }
2720
2829
  case "message": {
2721
2830
  for (const contentPart of part.content) {
2722
2831
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -2736,7 +2845,7 @@ var OpenAIResponsesLanguageModel = class {
2736
2845
  content.push({
2737
2846
  type: "source",
2738
2847
  sourceType: "url",
2739
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils13.generateId)(),
2848
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils14.generateId)(),
2740
2849
  url: annotation.url,
2741
2850
  title: annotation.title
2742
2851
  });
@@ -2744,7 +2853,7 @@ var OpenAIResponsesLanguageModel = class {
2744
2853
  content.push({
2745
2854
  type: "source",
2746
2855
  sourceType: "document",
2747
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils13.generateId)(),
2856
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils14.generateId)(),
2748
2857
  mediaType: "text/plain",
2749
2858
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2750
2859
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2896,18 +3005,18 @@ var OpenAIResponsesLanguageModel = class {
2896
3005
  warnings,
2897
3006
  webSearchToolName
2898
3007
  } = await this.getArgs(options);
2899
- const { responseHeaders, value: response } = await (0, import_provider_utils13.postJsonToApi)({
3008
+ const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
2900
3009
  url: this.config.url({
2901
3010
  path: "/responses",
2902
3011
  modelId: this.modelId
2903
3012
  }),
2904
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
3013
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2905
3014
  body: {
2906
3015
  ...body,
2907
3016
  stream: true
2908
3017
  },
2909
3018
  failedResponseHandler: openaiFailedResponseHandler,
2910
- successfulResponseHandler: (0, import_provider_utils13.createEventSourceResponseHandler)(
3019
+ successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
2911
3020
  openaiResponsesChunkSchema
2912
3021
  ),
2913
3022
  abortSignal: options.abortSignal,
@@ -2974,6 +3083,24 @@ var OpenAIResponsesLanguageModel = class {
2974
3083
  id: value.item.id,
2975
3084
  toolName: "computer_use"
2976
3085
  });
3086
+ } else if (value.item.type === "code_interpreter_call") {
3087
+ ongoingToolCalls[value.output_index] = {
3088
+ toolName: "code_interpreter",
3089
+ toolCallId: value.item.id,
3090
+ codeInterpreter: {
3091
+ containerId: value.item.container_id
3092
+ }
3093
+ };
3094
+ controller.enqueue({
3095
+ type: "tool-input-start",
3096
+ id: value.item.id,
3097
+ toolName: "code_interpreter"
3098
+ });
3099
+ controller.enqueue({
3100
+ type: "tool-input-delta",
3101
+ id: value.item.id,
3102
+ delta: `{"containerId":"${value.item.container_id}","code":"`
3103
+ });
2977
3104
  } else if (value.item.type === "file_search_call") {
2978
3105
  controller.enqueue({
2979
3106
  type: "tool-call",
@@ -3097,16 +3224,7 @@ var OpenAIResponsesLanguageModel = class {
3097
3224
  providerExecuted: true
3098
3225
  });
3099
3226
  } else if (value.item.type === "code_interpreter_call") {
3100
- controller.enqueue({
3101
- type: "tool-call",
3102
- toolCallId: value.item.id,
3103
- toolName: "code_interpreter",
3104
- input: JSON.stringify({
3105
- code: value.item.code,
3106
- containerId: value.item.container_id
3107
- }),
3108
- providerExecuted: true
3109
- });
3227
+ ongoingToolCalls[value.output_index] = void 0;
3110
3228
  controller.enqueue({
3111
3229
  type: "tool-result",
3112
3230
  toolCallId: value.item.id,
@@ -3126,6 +3244,26 @@ var OpenAIResponsesLanguageModel = class {
3126
3244
  },
3127
3245
  providerExecuted: true
3128
3246
  });
3247
+ } else if (value.item.type === "local_shell_call") {
3248
+ ongoingToolCalls[value.output_index] = void 0;
3249
+ controller.enqueue({
3250
+ type: "tool-call",
3251
+ toolCallId: value.item.call_id,
3252
+ toolName: "local_shell",
3253
+ input: JSON.stringify({
3254
+ action: {
3255
+ type: "exec",
3256
+ command: value.item.action.command,
3257
+ timeoutMs: value.item.action.timeout_ms,
3258
+ user: value.item.action.user,
3259
+ workingDirectory: value.item.action.working_directory,
3260
+ env: value.item.action.env
3261
+ }
3262
+ }),
3263
+ providerMetadata: {
3264
+ openai: { itemId: value.item.id }
3265
+ }
3266
+ });
3129
3267
  } else if (value.item.type === "message") {
3130
3268
  controller.enqueue({
3131
3269
  type: "text-end",
@@ -3156,6 +3294,40 @@ var OpenAIResponsesLanguageModel = class {
3156
3294
  delta: value.delta
3157
3295
  });
3158
3296
  }
3297
+ } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3298
+ const toolCall = ongoingToolCalls[value.output_index];
3299
+ if (toolCall != null) {
3300
+ controller.enqueue({
3301
+ type: "tool-input-delta",
3302
+ id: toolCall.toolCallId,
3303
+ // The delta is code, which is embedding in a JSON string.
3304
+ // To escape it, we use JSON.stringify and slice to remove the outer quotes.
3305
+ delta: JSON.stringify(value.delta).slice(1, -1)
3306
+ });
3307
+ }
3308
+ } else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
3309
+ const toolCall = ongoingToolCalls[value.output_index];
3310
+ if (toolCall != null) {
3311
+ controller.enqueue({
3312
+ type: "tool-input-delta",
3313
+ id: toolCall.toolCallId,
3314
+ delta: '"}'
3315
+ });
3316
+ controller.enqueue({
3317
+ type: "tool-input-end",
3318
+ id: toolCall.toolCallId
3319
+ });
3320
+ controller.enqueue({
3321
+ type: "tool-call",
3322
+ toolCallId: toolCall.toolCallId,
3323
+ toolName: "code_interpreter",
3324
+ input: JSON.stringify({
3325
+ code: value.code,
3326
+ containerId: toolCall.codeInterpreter.containerId
3327
+ }),
3328
+ providerExecuted: true
3329
+ });
3330
+ }
3159
3331
  } else if (isResponseCreatedChunk(value)) {
3160
3332
  responseId = value.response.id;
3161
3333
  controller.enqueue({
@@ -3218,7 +3390,7 @@ var OpenAIResponsesLanguageModel = class {
3218
3390
  controller.enqueue({
3219
3391
  type: "source",
3220
3392
  sourceType: "url",
3221
- id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils13.generateId)(),
3393
+ id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils14.generateId)(),
3222
3394
  url: value.annotation.url,
3223
3395
  title: value.annotation.title
3224
3396
  });
@@ -3226,7 +3398,7 @@ var OpenAIResponsesLanguageModel = class {
3226
3398
  controller.enqueue({
3227
3399
  type: "source",
3228
3400
  sourceType: "document",
3229
- id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils13.generateId)(),
3401
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils14.generateId)(),
3230
3402
  mediaType: "text/plain",
3231
3403
  title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
3232
3404
  filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
@@ -3262,166 +3434,194 @@ var OpenAIResponsesLanguageModel = class {
3262
3434
  };
3263
3435
  }
3264
3436
  };
3265
- var usageSchema2 = import_v415.z.object({
3266
- input_tokens: import_v415.z.number(),
3267
- input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
3268
- output_tokens: import_v415.z.number(),
3269
- output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
3437
+ var usageSchema2 = import_v416.z.object({
3438
+ input_tokens: import_v416.z.number(),
3439
+ input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
3440
+ output_tokens: import_v416.z.number(),
3441
+ output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
3270
3442
  });
3271
- var textDeltaChunkSchema = import_v415.z.object({
3272
- type: import_v415.z.literal("response.output_text.delta"),
3273
- item_id: import_v415.z.string(),
3274
- delta: import_v415.z.string(),
3443
+ var textDeltaChunkSchema = import_v416.z.object({
3444
+ type: import_v416.z.literal("response.output_text.delta"),
3445
+ item_id: import_v416.z.string(),
3446
+ delta: import_v416.z.string(),
3275
3447
  logprobs: LOGPROBS_SCHEMA.nullish()
3276
3448
  });
3277
- var errorChunkSchema = import_v415.z.object({
3278
- type: import_v415.z.literal("error"),
3279
- code: import_v415.z.string(),
3280
- message: import_v415.z.string(),
3281
- param: import_v415.z.string().nullish(),
3282
- sequence_number: import_v415.z.number()
3449
+ var errorChunkSchema = import_v416.z.object({
3450
+ type: import_v416.z.literal("error"),
3451
+ code: import_v416.z.string(),
3452
+ message: import_v416.z.string(),
3453
+ param: import_v416.z.string().nullish(),
3454
+ sequence_number: import_v416.z.number()
3283
3455
  });
3284
- var responseFinishedChunkSchema = import_v415.z.object({
3285
- type: import_v415.z.enum(["response.completed", "response.incomplete"]),
3286
- response: import_v415.z.object({
3287
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
3456
+ var responseFinishedChunkSchema = import_v416.z.object({
3457
+ type: import_v416.z.enum(["response.completed", "response.incomplete"]),
3458
+ response: import_v416.z.object({
3459
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3288
3460
  usage: usageSchema2,
3289
- service_tier: import_v415.z.string().nullish()
3461
+ service_tier: import_v416.z.string().nullish()
3290
3462
  })
3291
3463
  });
3292
- var responseCreatedChunkSchema = import_v415.z.object({
3293
- type: import_v415.z.literal("response.created"),
3294
- response: import_v415.z.object({
3295
- id: import_v415.z.string(),
3296
- created_at: import_v415.z.number(),
3297
- model: import_v415.z.string(),
3298
- service_tier: import_v415.z.string().nullish()
3464
+ var responseCreatedChunkSchema = import_v416.z.object({
3465
+ type: import_v416.z.literal("response.created"),
3466
+ response: import_v416.z.object({
3467
+ id: import_v416.z.string(),
3468
+ created_at: import_v416.z.number(),
3469
+ model: import_v416.z.string(),
3470
+ service_tier: import_v416.z.string().nullish()
3299
3471
  })
3300
3472
  });
3301
- var responseOutputItemAddedSchema = import_v415.z.object({
3302
- type: import_v415.z.literal("response.output_item.added"),
3303
- output_index: import_v415.z.number(),
3304
- item: import_v415.z.discriminatedUnion("type", [
3305
- import_v415.z.object({
3306
- type: import_v415.z.literal("message"),
3307
- id: import_v415.z.string()
3473
+ var responseOutputItemAddedSchema = import_v416.z.object({
3474
+ type: import_v416.z.literal("response.output_item.added"),
3475
+ output_index: import_v416.z.number(),
3476
+ item: import_v416.z.discriminatedUnion("type", [
3477
+ import_v416.z.object({
3478
+ type: import_v416.z.literal("message"),
3479
+ id: import_v416.z.string()
3308
3480
  }),
3309
- import_v415.z.object({
3310
- type: import_v415.z.literal("reasoning"),
3311
- id: import_v415.z.string(),
3312
- encrypted_content: import_v415.z.string().nullish()
3481
+ import_v416.z.object({
3482
+ type: import_v416.z.literal("reasoning"),
3483
+ id: import_v416.z.string(),
3484
+ encrypted_content: import_v416.z.string().nullish()
3313
3485
  }),
3314
- import_v415.z.object({
3315
- type: import_v415.z.literal("function_call"),
3316
- id: import_v415.z.string(),
3317
- call_id: import_v415.z.string(),
3318
- name: import_v415.z.string(),
3319
- arguments: import_v415.z.string()
3486
+ import_v416.z.object({
3487
+ type: import_v416.z.literal("function_call"),
3488
+ id: import_v416.z.string(),
3489
+ call_id: import_v416.z.string(),
3490
+ name: import_v416.z.string(),
3491
+ arguments: import_v416.z.string()
3320
3492
  }),
3321
- import_v415.z.object({
3322
- type: import_v415.z.literal("web_search_call"),
3323
- id: import_v415.z.string(),
3324
- status: import_v415.z.string(),
3325
- action: import_v415.z.object({
3326
- type: import_v415.z.literal("search"),
3327
- query: import_v415.z.string().optional()
3493
+ import_v416.z.object({
3494
+ type: import_v416.z.literal("web_search_call"),
3495
+ id: import_v416.z.string(),
3496
+ status: import_v416.z.string(),
3497
+ action: import_v416.z.object({
3498
+ type: import_v416.z.literal("search"),
3499
+ query: import_v416.z.string().optional()
3328
3500
  }).nullish()
3329
3501
  }),
3330
- import_v415.z.object({
3331
- type: import_v415.z.literal("computer_call"),
3332
- id: import_v415.z.string(),
3333
- status: import_v415.z.string()
3502
+ import_v416.z.object({
3503
+ type: import_v416.z.literal("computer_call"),
3504
+ id: import_v416.z.string(),
3505
+ status: import_v416.z.string()
3506
+ }),
3507
+ import_v416.z.object({
3508
+ type: import_v416.z.literal("file_search_call"),
3509
+ id: import_v416.z.string()
3334
3510
  }),
3335
- import_v415.z.object({
3336
- type: import_v415.z.literal("file_search_call"),
3337
- id: import_v415.z.string()
3511
+ import_v416.z.object({
3512
+ type: import_v416.z.literal("image_generation_call"),
3513
+ id: import_v416.z.string()
3338
3514
  }),
3339
- import_v415.z.object({
3340
- type: import_v415.z.literal("image_generation_call"),
3341
- id: import_v415.z.string()
3515
+ import_v416.z.object({
3516
+ type: import_v416.z.literal("code_interpreter_call"),
3517
+ id: import_v416.z.string(),
3518
+ container_id: import_v416.z.string(),
3519
+ code: import_v416.z.string().nullable(),
3520
+ outputs: import_v416.z.array(
3521
+ import_v416.z.discriminatedUnion("type", [
3522
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3523
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3524
+ ])
3525
+ ).nullable(),
3526
+ status: import_v416.z.string()
3342
3527
  })
3343
3528
  ])
3344
3529
  });
3345
- var responseOutputItemDoneSchema = import_v415.z.object({
3346
- type: import_v415.z.literal("response.output_item.done"),
3347
- output_index: import_v415.z.number(),
3348
- item: import_v415.z.discriminatedUnion("type", [
3349
- import_v415.z.object({
3350
- type: import_v415.z.literal("message"),
3351
- id: import_v415.z.string()
3530
+ var responseOutputItemDoneSchema = import_v416.z.object({
3531
+ type: import_v416.z.literal("response.output_item.done"),
3532
+ output_index: import_v416.z.number(),
3533
+ item: import_v416.z.discriminatedUnion("type", [
3534
+ import_v416.z.object({
3535
+ type: import_v416.z.literal("message"),
3536
+ id: import_v416.z.string()
3352
3537
  }),
3353
- import_v415.z.object({
3354
- type: import_v415.z.literal("reasoning"),
3355
- id: import_v415.z.string(),
3356
- encrypted_content: import_v415.z.string().nullish()
3538
+ import_v416.z.object({
3539
+ type: import_v416.z.literal("reasoning"),
3540
+ id: import_v416.z.string(),
3541
+ encrypted_content: import_v416.z.string().nullish()
3357
3542
  }),
3358
- import_v415.z.object({
3359
- type: import_v415.z.literal("function_call"),
3360
- id: import_v415.z.string(),
3361
- call_id: import_v415.z.string(),
3362
- name: import_v415.z.string(),
3363
- arguments: import_v415.z.string(),
3364
- status: import_v415.z.literal("completed")
3543
+ import_v416.z.object({
3544
+ type: import_v416.z.literal("function_call"),
3545
+ id: import_v416.z.string(),
3546
+ call_id: import_v416.z.string(),
3547
+ name: import_v416.z.string(),
3548
+ arguments: import_v416.z.string(),
3549
+ status: import_v416.z.literal("completed")
3365
3550
  }),
3366
3551
  codeInterpreterCallItem,
3367
3552
  imageGenerationCallItem,
3368
3553
  webSearchCallItem,
3369
3554
  fileSearchCallItem,
3370
- import_v415.z.object({
3371
- type: import_v415.z.literal("computer_call"),
3372
- id: import_v415.z.string(),
3373
- status: import_v415.z.literal("completed")
3555
+ localShellCallItem,
3556
+ import_v416.z.object({
3557
+ type: import_v416.z.literal("computer_call"),
3558
+ id: import_v416.z.string(),
3559
+ status: import_v416.z.literal("completed")
3374
3560
  })
3375
3561
  ])
3376
3562
  });
3377
- var responseFunctionCallArgumentsDeltaSchema = import_v415.z.object({
3378
- type: import_v415.z.literal("response.function_call_arguments.delta"),
3379
- item_id: import_v415.z.string(),
3380
- output_index: import_v415.z.number(),
3381
- delta: import_v415.z.string()
3563
+ var responseFunctionCallArgumentsDeltaSchema = import_v416.z.object({
3564
+ type: import_v416.z.literal("response.function_call_arguments.delta"),
3565
+ item_id: import_v416.z.string(),
3566
+ output_index: import_v416.z.number(),
3567
+ delta: import_v416.z.string()
3568
+ });
3569
+ var responseCodeInterpreterCallCodeDeltaSchema = import_v416.z.object({
3570
+ type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
3571
+ item_id: import_v416.z.string(),
3572
+ output_index: import_v416.z.number(),
3573
+ delta: import_v416.z.string()
3382
3574
  });
3383
- var responseAnnotationAddedSchema = import_v415.z.object({
3384
- type: import_v415.z.literal("response.output_text.annotation.added"),
3385
- annotation: import_v415.z.discriminatedUnion("type", [
3386
- import_v415.z.object({
3387
- type: import_v415.z.literal("url_citation"),
3388
- url: import_v415.z.string(),
3389
- title: import_v415.z.string()
3575
+ var responseCodeInterpreterCallCodeDoneSchema = import_v416.z.object({
3576
+ type: import_v416.z.literal("response.code_interpreter_call_code.done"),
3577
+ item_id: import_v416.z.string(),
3578
+ output_index: import_v416.z.number(),
3579
+ code: import_v416.z.string()
3580
+ });
3581
+ var responseAnnotationAddedSchema = import_v416.z.object({
3582
+ type: import_v416.z.literal("response.output_text.annotation.added"),
3583
+ annotation: import_v416.z.discriminatedUnion("type", [
3584
+ import_v416.z.object({
3585
+ type: import_v416.z.literal("url_citation"),
3586
+ url: import_v416.z.string(),
3587
+ title: import_v416.z.string()
3390
3588
  }),
3391
- import_v415.z.object({
3392
- type: import_v415.z.literal("file_citation"),
3393
- file_id: import_v415.z.string(),
3394
- filename: import_v415.z.string().nullish(),
3395
- index: import_v415.z.number().nullish(),
3396
- start_index: import_v415.z.number().nullish(),
3397
- end_index: import_v415.z.number().nullish(),
3398
- quote: import_v415.z.string().nullish()
3589
+ import_v416.z.object({
3590
+ type: import_v416.z.literal("file_citation"),
3591
+ file_id: import_v416.z.string(),
3592
+ filename: import_v416.z.string().nullish(),
3593
+ index: import_v416.z.number().nullish(),
3594
+ start_index: import_v416.z.number().nullish(),
3595
+ end_index: import_v416.z.number().nullish(),
3596
+ quote: import_v416.z.string().nullish()
3399
3597
  })
3400
3598
  ])
3401
3599
  });
3402
- var responseReasoningSummaryPartAddedSchema = import_v415.z.object({
3403
- type: import_v415.z.literal("response.reasoning_summary_part.added"),
3404
- item_id: import_v415.z.string(),
3405
- summary_index: import_v415.z.number()
3600
+ var responseReasoningSummaryPartAddedSchema = import_v416.z.object({
3601
+ type: import_v416.z.literal("response.reasoning_summary_part.added"),
3602
+ item_id: import_v416.z.string(),
3603
+ summary_index: import_v416.z.number()
3406
3604
  });
3407
- var responseReasoningSummaryTextDeltaSchema = import_v415.z.object({
3408
- type: import_v415.z.literal("response.reasoning_summary_text.delta"),
3409
- item_id: import_v415.z.string(),
3410
- summary_index: import_v415.z.number(),
3411
- delta: import_v415.z.string()
3605
+ var responseReasoningSummaryTextDeltaSchema = import_v416.z.object({
3606
+ type: import_v416.z.literal("response.reasoning_summary_text.delta"),
3607
+ item_id: import_v416.z.string(),
3608
+ summary_index: import_v416.z.number(),
3609
+ delta: import_v416.z.string()
3412
3610
  });
3413
- var openaiResponsesChunkSchema = import_v415.z.union([
3611
+ var openaiResponsesChunkSchema = import_v416.z.union([
3414
3612
  textDeltaChunkSchema,
3415
3613
  responseFinishedChunkSchema,
3416
3614
  responseCreatedChunkSchema,
3417
3615
  responseOutputItemAddedSchema,
3418
3616
  responseOutputItemDoneSchema,
3419
3617
  responseFunctionCallArgumentsDeltaSchema,
3618
+ responseCodeInterpreterCallCodeDeltaSchema,
3619
+ responseCodeInterpreterCallCodeDoneSchema,
3420
3620
  responseAnnotationAddedSchema,
3421
3621
  responseReasoningSummaryPartAddedSchema,
3422
3622
  responseReasoningSummaryTextDeltaSchema,
3423
3623
  errorChunkSchema,
3424
- import_v415.z.object({ type: import_v415.z.string() }).loose()
3624
+ import_v416.z.object({ type: import_v416.z.string() }).loose()
3425
3625
  // fallback for unknown chunks
3426
3626
  ]);
3427
3627
  function isTextDeltaChunk(chunk) {
@@ -3442,6 +3642,12 @@ function isResponseCreatedChunk(chunk) {
3442
3642
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3443
3643
  return chunk.type === "response.function_call_arguments.delta";
3444
3644
  }
3645
+ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3646
+ return chunk.type === "response.code_interpreter_call_code.delta";
3647
+ }
3648
+ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
3649
+ return chunk.type === "response.code_interpreter_call_code.done";
3650
+ }
3445
3651
  function isResponseOutputItemAddedChunk(chunk) {
3446
3652
  return chunk.type === "response.output_item.added";
3447
3653
  }
@@ -3494,15 +3700,15 @@ function getResponsesModelConfig(modelId) {
3494
3700
  isReasoningModel: false
3495
3701
  };
3496
3702
  }
3497
- var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3498
- include: import_v415.z.array(
3499
- import_v415.z.enum([
3703
+ var openaiResponsesProviderOptionsSchema = import_v416.z.object({
3704
+ include: import_v416.z.array(
3705
+ import_v416.z.enum([
3500
3706
  "reasoning.encrypted_content",
3501
3707
  "file_search_call.results",
3502
3708
  "message.output_text.logprobs"
3503
3709
  ])
3504
3710
  ).nullish(),
3505
- instructions: import_v415.z.string().nullish(),
3711
+ instructions: import_v416.z.string().nullish(),
3506
3712
  /**
3507
3713
  * Return the log probabilities of the tokens.
3508
3714
  *
@@ -3515,33 +3721,33 @@ var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3515
3721
  * @see https://platform.openai.com/docs/api-reference/responses/create
3516
3722
  * @see https://cookbook.openai.com/examples/using_logprobs
3517
3723
  */
3518
- logprobs: import_v415.z.union([import_v415.z.boolean(), import_v415.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3724
+ logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3519
3725
  /**
3520
3726
  * The maximum number of total calls to built-in tools that can be processed in a response.
3521
3727
  * This maximum number applies across all built-in tool calls, not per individual tool.
3522
3728
  * Any further attempts to call a tool by the model will be ignored.
3523
3729
  */
3524
- maxToolCalls: import_v415.z.number().nullish(),
3525
- metadata: import_v415.z.any().nullish(),
3526
- parallelToolCalls: import_v415.z.boolean().nullish(),
3527
- previousResponseId: import_v415.z.string().nullish(),
3528
- promptCacheKey: import_v415.z.string().nullish(),
3529
- reasoningEffort: import_v415.z.string().nullish(),
3530
- reasoningSummary: import_v415.z.string().nullish(),
3531
- safetyIdentifier: import_v415.z.string().nullish(),
3532
- serviceTier: import_v415.z.enum(["auto", "flex", "priority"]).nullish(),
3533
- store: import_v415.z.boolean().nullish(),
3534
- strictJsonSchema: import_v415.z.boolean().nullish(),
3535
- textVerbosity: import_v415.z.enum(["low", "medium", "high"]).nullish(),
3536
- user: import_v415.z.string().nullish()
3730
+ maxToolCalls: import_v416.z.number().nullish(),
3731
+ metadata: import_v416.z.any().nullish(),
3732
+ parallelToolCalls: import_v416.z.boolean().nullish(),
3733
+ previousResponseId: import_v416.z.string().nullish(),
3734
+ promptCacheKey: import_v416.z.string().nullish(),
3735
+ reasoningEffort: import_v416.z.string().nullish(),
3736
+ reasoningSummary: import_v416.z.string().nullish(),
3737
+ safetyIdentifier: import_v416.z.string().nullish(),
3738
+ serviceTier: import_v416.z.enum(["auto", "flex", "priority"]).nullish(),
3739
+ store: import_v416.z.boolean().nullish(),
3740
+ strictJsonSchema: import_v416.z.boolean().nullish(),
3741
+ textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
3742
+ user: import_v416.z.string().nullish()
3537
3743
  });
3538
3744
 
3539
3745
  // src/speech/openai-speech-model.ts
3540
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3541
- var import_v416 = require("zod/v4");
3542
- var OpenAIProviderOptionsSchema = import_v416.z.object({
3543
- instructions: import_v416.z.string().nullish(),
3544
- speed: import_v416.z.number().min(0.25).max(4).default(1).nullish()
3746
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3747
+ var import_v417 = require("zod/v4");
3748
+ var OpenAIProviderOptionsSchema = import_v417.z.object({
3749
+ instructions: import_v417.z.string().nullish(),
3750
+ speed: import_v417.z.number().min(0.25).max(4).default(1).nullish()
3545
3751
  });
3546
3752
  var OpenAISpeechModel = class {
3547
3753
  constructor(modelId, config) {
@@ -3562,7 +3768,7 @@ var OpenAISpeechModel = class {
3562
3768
  providerOptions
3563
3769
  }) {
3564
3770
  const warnings = [];
3565
- const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3771
+ const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3566
3772
  provider: "openai",
3567
3773
  providerOptions,
3568
3774
  schema: OpenAIProviderOptionsSchema
@@ -3615,15 +3821,15 @@ var OpenAISpeechModel = class {
3615
3821
  value: audio,
3616
3822
  responseHeaders,
3617
3823
  rawValue: rawResponse
3618
- } = await (0, import_provider_utils14.postJsonToApi)({
3824
+ } = await (0, import_provider_utils15.postJsonToApi)({
3619
3825
  url: this.config.url({
3620
3826
  path: "/audio/speech",
3621
3827
  modelId: this.modelId
3622
3828
  }),
3623
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3829
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
3624
3830
  body: requestBody,
3625
3831
  failedResponseHandler: openaiFailedResponseHandler,
3626
- successfulResponseHandler: (0, import_provider_utils14.createBinaryResponseHandler)(),
3832
+ successfulResponseHandler: (0, import_provider_utils15.createBinaryResponseHandler)(),
3627
3833
  abortSignal: options.abortSignal,
3628
3834
  fetch: this.config.fetch
3629
3835
  });
@@ -3644,34 +3850,34 @@ var OpenAISpeechModel = class {
3644
3850
  };
3645
3851
 
3646
3852
  // src/transcription/openai-transcription-model.ts
3647
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3648
- var import_v418 = require("zod/v4");
3853
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
3854
+ var import_v419 = require("zod/v4");
3649
3855
 
3650
3856
  // src/transcription/openai-transcription-options.ts
3651
- var import_v417 = require("zod/v4");
3652
- var openAITranscriptionProviderOptions = import_v417.z.object({
3857
+ var import_v418 = require("zod/v4");
3858
+ var openAITranscriptionProviderOptions = import_v418.z.object({
3653
3859
  /**
3654
3860
  * Additional information to include in the transcription response.
3655
3861
  */
3656
- include: import_v417.z.array(import_v417.z.string()).optional(),
3862
+ include: import_v418.z.array(import_v418.z.string()).optional(),
3657
3863
  /**
3658
3864
  * The language of the input audio in ISO-639-1 format.
3659
3865
  */
3660
- language: import_v417.z.string().optional(),
3866
+ language: import_v418.z.string().optional(),
3661
3867
  /**
3662
3868
  * An optional text to guide the model's style or continue a previous audio segment.
3663
3869
  */
3664
- prompt: import_v417.z.string().optional(),
3870
+ prompt: import_v418.z.string().optional(),
3665
3871
  /**
3666
3872
  * The sampling temperature, between 0 and 1.
3667
3873
  * @default 0
3668
3874
  */
3669
- temperature: import_v417.z.number().min(0).max(1).default(0).optional(),
3875
+ temperature: import_v418.z.number().min(0).max(1).default(0).optional(),
3670
3876
  /**
3671
3877
  * The timestamp granularities to populate for this transcription.
3672
3878
  * @default ['segment']
3673
3879
  */
3674
- timestampGranularities: import_v417.z.array(import_v417.z.enum(["word", "segment"])).default(["segment"]).optional()
3880
+ timestampGranularities: import_v418.z.array(import_v418.z.enum(["word", "segment"])).default(["segment"]).optional()
3675
3881
  });
3676
3882
 
3677
3883
  // src/transcription/openai-transcription-model.ts
@@ -3749,15 +3955,15 @@ var OpenAITranscriptionModel = class {
3749
3955
  providerOptions
3750
3956
  }) {
3751
3957
  const warnings = [];
3752
- const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3958
+ const openAIOptions = await (0, import_provider_utils16.parseProviderOptions)({
3753
3959
  provider: "openai",
3754
3960
  providerOptions,
3755
3961
  schema: openAITranscriptionProviderOptions
3756
3962
  });
3757
3963
  const formData = new FormData();
3758
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils15.convertBase64ToUint8Array)(audio)]);
3964
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils16.convertBase64ToUint8Array)(audio)]);
3759
3965
  formData.append("model", this.modelId);
3760
- const fileExtension = (0, import_provider_utils15.mediaTypeToExtension)(mediaType);
3966
+ const fileExtension = (0, import_provider_utils16.mediaTypeToExtension)(mediaType);
3761
3967
  formData.append(
3762
3968
  "file",
3763
3969
  new File([blob], "audio", { type: mediaType }),
@@ -3802,15 +4008,15 @@ var OpenAITranscriptionModel = class {
3802
4008
  value: response,
3803
4009
  responseHeaders,
3804
4010
  rawValue: rawResponse
3805
- } = await (0, import_provider_utils15.postFormDataToApi)({
4011
+ } = await (0, import_provider_utils16.postFormDataToApi)({
3806
4012
  url: this.config.url({
3807
4013
  path: "/audio/transcriptions",
3808
4014
  modelId: this.modelId
3809
4015
  }),
3810
- headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
4016
+ headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
3811
4017
  formData,
3812
4018
  failedResponseHandler: openaiFailedResponseHandler,
3813
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
4019
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3814
4020
  openaiTranscriptionResponseSchema
3815
4021
  ),
3816
4022
  abortSignal: options.abortSignal,
@@ -3840,48 +4046,59 @@ var OpenAITranscriptionModel = class {
3840
4046
  };
3841
4047
  }
3842
4048
  };
3843
- var openaiTranscriptionResponseSchema = import_v418.z.object({
3844
- text: import_v418.z.string(),
3845
- language: import_v418.z.string().nullish(),
3846
- duration: import_v418.z.number().nullish(),
3847
- words: import_v418.z.array(
3848
- import_v418.z.object({
3849
- word: import_v418.z.string(),
3850
- start: import_v418.z.number(),
3851
- end: import_v418.z.number()
4049
+ var openaiTranscriptionResponseSchema = import_v419.z.object({
4050
+ text: import_v419.z.string(),
4051
+ language: import_v419.z.string().nullish(),
4052
+ duration: import_v419.z.number().nullish(),
4053
+ words: import_v419.z.array(
4054
+ import_v419.z.object({
4055
+ word: import_v419.z.string(),
4056
+ start: import_v419.z.number(),
4057
+ end: import_v419.z.number()
3852
4058
  })
3853
4059
  ).nullish(),
3854
- segments: import_v418.z.array(
3855
- import_v418.z.object({
3856
- id: import_v418.z.number(),
3857
- seek: import_v418.z.number(),
3858
- start: import_v418.z.number(),
3859
- end: import_v418.z.number(),
3860
- text: import_v418.z.string(),
3861
- tokens: import_v418.z.array(import_v418.z.number()),
3862
- temperature: import_v418.z.number(),
3863
- avg_logprob: import_v418.z.number(),
3864
- compression_ratio: import_v418.z.number(),
3865
- no_speech_prob: import_v418.z.number()
4060
+ segments: import_v419.z.array(
4061
+ import_v419.z.object({
4062
+ id: import_v419.z.number(),
4063
+ seek: import_v419.z.number(),
4064
+ start: import_v419.z.number(),
4065
+ end: import_v419.z.number(),
4066
+ text: import_v419.z.string(),
4067
+ tokens: import_v419.z.array(import_v419.z.number()),
4068
+ temperature: import_v419.z.number(),
4069
+ avg_logprob: import_v419.z.number(),
4070
+ compression_ratio: import_v419.z.number(),
4071
+ no_speech_prob: import_v419.z.number()
3866
4072
  })
3867
4073
  ).nullish()
3868
4074
  });
3869
4075
 
4076
+ // src/version.ts
4077
+ var VERSION = true ? "2.1.0-beta.10" : "0.0.0-test";
4078
+
3870
4079
  // src/openai-provider.ts
3871
4080
  function createOpenAI(options = {}) {
3872
4081
  var _a, _b;
3873
- const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
4082
+ const baseURL = (_a = (0, import_provider_utils17.withoutTrailingSlash)(
4083
+ (0, import_provider_utils17.loadOptionalSetting)({
4084
+ settingValue: options.baseURL,
4085
+ environmentVariableName: "OPENAI_BASE_URL"
4086
+ })
4087
+ )) != null ? _a : "https://api.openai.com/v1";
3874
4088
  const providerName = (_b = options.name) != null ? _b : "openai";
3875
- const getHeaders = () => ({
3876
- Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
3877
- apiKey: options.apiKey,
3878
- environmentVariableName: "OPENAI_API_KEY",
3879
- description: "OpenAI"
3880
- })}`,
3881
- "OpenAI-Organization": options.organization,
3882
- "OpenAI-Project": options.project,
3883
- ...options.headers
3884
- });
4089
+ const getHeaders = () => (0, import_provider_utils17.withUserAgentSuffix)(
4090
+ {
4091
+ Authorization: `Bearer ${(0, import_provider_utils17.loadApiKey)({
4092
+ apiKey: options.apiKey,
4093
+ environmentVariableName: "OPENAI_API_KEY",
4094
+ description: "OpenAI"
4095
+ })}`,
4096
+ "OpenAI-Organization": options.organization,
4097
+ "OpenAI-Project": options.project,
4098
+ ...options.headers
4099
+ },
4100
+ `ai-sdk/openai/${VERSION}`
4101
+ );
3885
4102
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
3886
4103
  provider: `${providerName}.chat`,
3887
4104
  url: ({ path }) => `${baseURL}${path}`,
@@ -3957,6 +4174,7 @@ function createOpenAI(options = {}) {
3957
4174
  var openai = createOpenAI();
3958
4175
  // Annotate the CommonJS export names for ESM import in node:
3959
4176
  0 && (module.exports = {
4177
+ VERSION,
3960
4178
  createOpenAI,
3961
4179
  openai
3962
4180
  });