@ai-sdk/openai 2.1.0-beta.1 → 2.1.0-beta.11

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;
@@ -1766,6 +1767,7 @@ var imageGenerationArgsSchema = import_v411.z.object({
1766
1767
  moderation: import_v411.z.enum(["auto"]).optional(),
1767
1768
  outputCompression: import_v411.z.number().int().min(0).max(100).optional(),
1768
1769
  outputFormat: import_v411.z.enum(["png", "jpeg", "webp"]).optional(),
1770
+ partialImages: import_v411.z.number().int().min(0).max(3).optional(),
1769
1771
  quality: import_v411.z.enum(["auto", "low", "medium", "high"]).optional(),
1770
1772
  size: import_v411.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
1771
1773
  }).strict();
@@ -1782,39 +1784,62 @@ var imageGeneration = (args = {}) => {
1782
1784
  return imageGenerationToolFactory(args);
1783
1785
  };
1784
1786
 
1785
- // src/tool/web-search.ts
1787
+ // src/tool/local-shell.ts
1786
1788
  var import_provider_utils10 = require("@ai-sdk/provider-utils");
1787
1789
  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()
1790
+ var localShellInputSchema = import_v412.z.object({
1791
+ action: import_v412.z.object({
1792
+ type: import_v412.z.literal("exec"),
1793
+ command: import_v412.z.array(import_v412.z.string()),
1794
+ timeoutMs: import_v412.z.number().optional(),
1795
+ user: import_v412.z.string().optional(),
1796
+ workingDirectory: import_v412.z.string().optional(),
1797
+ env: import_v412.z.record(import_v412.z.string(), import_v412.z.string()).optional()
1798
+ })
1799
+ });
1800
+ var localShellOutputSchema = import_v412.z.object({
1801
+ output: import_v412.z.string()
1802
+ });
1803
+ var localShell = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
1804
+ id: "openai.local_shell",
1805
+ name: "local_shell",
1806
+ inputSchema: localShellInputSchema,
1807
+ outputSchema: localShellOutputSchema
1808
+ });
1809
+
1810
+ // src/tool/web-search.ts
1811
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1812
+ var import_v413 = require("zod/v4");
1813
+ var webSearchArgsSchema = import_v413.z.object({
1814
+ filters: import_v413.z.object({
1815
+ allowedDomains: import_v413.z.array(import_v413.z.string()).optional()
1791
1816
  }).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()
1817
+ searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
1818
+ userLocation: import_v413.z.object({
1819
+ type: import_v413.z.literal("approximate"),
1820
+ country: import_v413.z.string().optional(),
1821
+ city: import_v413.z.string().optional(),
1822
+ region: import_v413.z.string().optional(),
1823
+ timezone: import_v413.z.string().optional()
1799
1824
  }).optional()
1800
1825
  });
1801
- var webSearchToolFactory = (0, import_provider_utils10.createProviderDefinedToolFactory)({
1826
+ var webSearchToolFactory = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1802
1827
  id: "openai.web_search",
1803
1828
  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()
1829
+ inputSchema: import_v413.z.object({
1830
+ action: import_v413.z.discriminatedUnion("type", [
1831
+ import_v413.z.object({
1832
+ type: import_v413.z.literal("search"),
1833
+ query: import_v413.z.string().nullish()
1809
1834
  }),
1810
- import_v412.z.object({
1811
- type: import_v412.z.literal("open_page"),
1812
- url: import_v412.z.string()
1835
+ import_v413.z.object({
1836
+ type: import_v413.z.literal("open_page"),
1837
+ url: import_v413.z.string()
1813
1838
  }),
1814
- import_v412.z.object({
1815
- type: import_v412.z.literal("find"),
1816
- url: import_v412.z.string(),
1817
- pattern: import_v412.z.string()
1839
+ import_v413.z.object({
1840
+ type: import_v413.z.literal("find"),
1841
+ url: import_v413.z.string(),
1842
+ pattern: import_v413.z.string()
1818
1843
  })
1819
1844
  ]).nullish()
1820
1845
  })
@@ -1824,59 +1849,59 @@ var webSearch = (args = {}) => {
1824
1849
  };
1825
1850
 
1826
1851
  // 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({
1852
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1853
+ var import_v414 = require("zod/v4");
1854
+ var webSearchPreviewArgsSchema = import_v414.z.object({
1830
1855
  /**
1831
1856
  * Search context size to use for the web search.
1832
1857
  * - high: Most comprehensive context, highest cost, slower response
1833
1858
  * - medium: Balanced context, cost, and latency (default)
1834
1859
  * - low: Least context, lowest cost, fastest response
1835
1860
  */
1836
- searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
1861
+ searchContextSize: import_v414.z.enum(["low", "medium", "high"]).optional(),
1837
1862
  /**
1838
1863
  * User location information to provide geographically relevant search results.
1839
1864
  */
1840
- userLocation: import_v413.z.object({
1865
+ userLocation: import_v414.z.object({
1841
1866
  /**
1842
1867
  * Type of location (always 'approximate')
1843
1868
  */
1844
- type: import_v413.z.literal("approximate"),
1869
+ type: import_v414.z.literal("approximate"),
1845
1870
  /**
1846
1871
  * Two-letter ISO country code (e.g., 'US', 'GB')
1847
1872
  */
1848
- country: import_v413.z.string().optional(),
1873
+ country: import_v414.z.string().optional(),
1849
1874
  /**
1850
1875
  * City name (free text, e.g., 'Minneapolis')
1851
1876
  */
1852
- city: import_v413.z.string().optional(),
1877
+ city: import_v414.z.string().optional(),
1853
1878
  /**
1854
1879
  * Region name (free text, e.g., 'Minnesota')
1855
1880
  */
1856
- region: import_v413.z.string().optional(),
1881
+ region: import_v414.z.string().optional(),
1857
1882
  /**
1858
1883
  * IANA timezone (e.g., 'America/Chicago')
1859
1884
  */
1860
- timezone: import_v413.z.string().optional()
1885
+ timezone: import_v414.z.string().optional()
1861
1886
  }).optional()
1862
1887
  });
1863
- var webSearchPreview = (0, import_provider_utils11.createProviderDefinedToolFactory)({
1888
+ var webSearchPreview = (0, import_provider_utils12.createProviderDefinedToolFactory)({
1864
1889
  id: "openai.web_search_preview",
1865
1890
  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()
1891
+ inputSchema: import_v414.z.object({
1892
+ action: import_v414.z.discriminatedUnion("type", [
1893
+ import_v414.z.object({
1894
+ type: import_v414.z.literal("search"),
1895
+ query: import_v414.z.string().nullish()
1871
1896
  }),
1872
- import_v413.z.object({
1873
- type: import_v413.z.literal("open_page"),
1874
- url: import_v413.z.string()
1897
+ import_v414.z.object({
1898
+ type: import_v414.z.literal("open_page"),
1899
+ url: import_v414.z.string()
1875
1900
  }),
1876
- import_v413.z.object({
1877
- type: import_v413.z.literal("find"),
1878
- url: import_v413.z.string(),
1879
- pattern: import_v413.z.string()
1901
+ import_v414.z.object({
1902
+ type: import_v414.z.literal("find"),
1903
+ url: import_v414.z.string(),
1904
+ pattern: import_v414.z.string()
1880
1905
  })
1881
1906
  ]).nullish()
1882
1907
  })
@@ -1914,13 +1939,27 @@ var openaiTools = {
1914
1939
  *
1915
1940
  * Must have name `image_generation`.
1916
1941
  *
1917
- * @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
1918
- * @param quality - Rendering quality (e.g. low, medium, high)
1919
- * @param format - File output format
1920
- * @param compression - Compression level (0-100%) for JPEG and WebP formats
1921
- * @param background - Transparent or opaque
1942
+ * @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
1943
+ * @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
1944
+ * @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
1945
+ * @param model - The image generation model to use. Default: gpt-image-1.
1946
+ * @param moderation - Moderation level for the generated image. Default: 'auto'.
1947
+ * @param outputCompression - Compression level for the output image (0-100).
1948
+ * @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
1949
+ * @param partialImages - Number of partial images to generate in streaming mode (0-3).
1950
+ * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
1951
+ * @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
1922
1952
  */
1923
1953
  imageGeneration,
1954
+ /**
1955
+ * Local shell is a tool that allows agents to run shell commands locally
1956
+ * on a machine you or the user provides.
1957
+ *
1958
+ * Supported models: `gpt-5-codex` and `codex-mini-latest`
1959
+ *
1960
+ * Must have name `local_shell`.
1961
+ */
1962
+ localShell,
1924
1963
  /**
1925
1964
  * Web search allows models to access up-to-date information from the internet
1926
1965
  * and provide answers with sourced citations.
@@ -1948,13 +1987,13 @@ var openaiTools = {
1948
1987
 
1949
1988
  // src/responses/openai-responses-language-model.ts
1950
1989
  var import_provider8 = require("@ai-sdk/provider");
1951
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1952
- var import_v415 = require("zod/v4");
1990
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
1991
+ var import_v416 = require("zod/v4");
1953
1992
 
1954
1993
  // src/responses/convert-to-openai-responses-input.ts
1955
1994
  var import_provider6 = require("@ai-sdk/provider");
1956
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1957
- var import_v414 = require("zod/v4");
1995
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1996
+ var import_v415 = require("zod/v4");
1958
1997
  function isFileId(data, prefixes) {
1959
1998
  if (!prefixes) return false;
1960
1999
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -1963,9 +2002,10 @@ async function convertToOpenAIResponsesInput({
1963
2002
  prompt,
1964
2003
  systemMessageMode,
1965
2004
  fileIdPrefixes,
1966
- store
2005
+ store,
2006
+ hasLocalShellTool = false
1967
2007
  }) {
1968
- var _a, _b, _c, _d, _e, _f;
2008
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1969
2009
  const input = [];
1970
2010
  const warnings = [];
1971
2011
  for (const { role, content } of prompt) {
@@ -2011,7 +2051,7 @@ async function convertToOpenAIResponsesInput({
2011
2051
  return {
2012
2052
  type: "input_image",
2013
2053
  ...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)}`
2054
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils13.convertToBase64)(part.data)}`
2015
2055
  },
2016
2056
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
2017
2057
  };
@@ -2026,7 +2066,7 @@ async function convertToOpenAIResponsesInput({
2026
2066
  type: "input_file",
2027
2067
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2028
2068
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2029
- file_data: `data:application/pdf;base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
2069
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils13.convertToBase64)(part.data)}`
2030
2070
  }
2031
2071
  };
2032
2072
  } else {
@@ -2058,12 +2098,29 @@ async function convertToOpenAIResponsesInput({
2058
2098
  if (part.providerExecuted) {
2059
2099
  break;
2060
2100
  }
2101
+ if (hasLocalShellTool && part.toolName === "local_shell") {
2102
+ const parsedInput = localShellInputSchema.parse(part.input);
2103
+ input.push({
2104
+ type: "local_shell_call",
2105
+ call_id: part.toolCallId,
2106
+ id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2107
+ action: {
2108
+ type: "exec",
2109
+ command: parsedInput.action.command,
2110
+ timeout_ms: parsedInput.action.timeoutMs,
2111
+ user: parsedInput.action.user,
2112
+ working_directory: parsedInput.action.workingDirectory,
2113
+ env: parsedInput.action.env
2114
+ }
2115
+ });
2116
+ break;
2117
+ }
2061
2118
  input.push({
2062
2119
  type: "function_call",
2063
2120
  call_id: part.toolCallId,
2064
2121
  name: part.toolName,
2065
2122
  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
2123
+ id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2067
2124
  });
2068
2125
  break;
2069
2126
  }
@@ -2080,33 +2137,47 @@ async function convertToOpenAIResponsesInput({
2080
2137
  break;
2081
2138
  }
2082
2139
  case "reasoning": {
2083
- const providerOptions = await (0, import_provider_utils12.parseProviderOptions)({
2140
+ const providerOptions = await (0, import_provider_utils13.parseProviderOptions)({
2084
2141
  provider: "openai",
2085
2142
  providerOptions: part.providerOptions,
2086
2143
  schema: openaiResponsesReasoningProviderOptionsSchema
2087
2144
  });
2088
2145
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2089
2146
  if (reasoningId != null) {
2090
- const existingReasoningMessage = reasoningMessages[reasoningId];
2091
- const summaryParts = [];
2092
- if (part.text.length > 0) {
2093
- summaryParts.push({ type: "summary_text", text: part.text });
2094
- } else if (existingReasoningMessage !== void 0) {
2095
- warnings.push({
2096
- type: "other",
2097
- message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2098
- });
2099
- }
2100
- if (existingReasoningMessage === void 0) {
2101
- reasoningMessages[reasoningId] = {
2102
- type: "reasoning",
2103
- id: reasoningId,
2104
- encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2105
- summary: summaryParts
2106
- };
2107
- input.push(reasoningMessages[reasoningId]);
2147
+ const reasoningMessage = reasoningMessages[reasoningId];
2148
+ if (store) {
2149
+ if (reasoningMessage === void 0) {
2150
+ input.push({ type: "item_reference", id: reasoningId });
2151
+ reasoningMessages[reasoningId] = {
2152
+ type: "reasoning",
2153
+ id: reasoningId,
2154
+ summary: []
2155
+ };
2156
+ }
2108
2157
  } else {
2109
- existingReasoningMessage.summary.push(...summaryParts);
2158
+ const summaryParts = [];
2159
+ if (part.text.length > 0) {
2160
+ summaryParts.push({
2161
+ type: "summary_text",
2162
+ text: part.text
2163
+ });
2164
+ } else if (reasoningMessage !== void 0) {
2165
+ warnings.push({
2166
+ type: "other",
2167
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2168
+ });
2169
+ }
2170
+ if (reasoningMessage === void 0) {
2171
+ reasoningMessages[reasoningId] = {
2172
+ type: "reasoning",
2173
+ id: reasoningId,
2174
+ encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2175
+ summary: summaryParts
2176
+ };
2177
+ input.push(reasoningMessages[reasoningId]);
2178
+ } else {
2179
+ reasoningMessage.summary.push(...summaryParts);
2180
+ }
2110
2181
  }
2111
2182
  } else {
2112
2183
  warnings.push({
@@ -2123,6 +2194,14 @@ async function convertToOpenAIResponsesInput({
2123
2194
  case "tool": {
2124
2195
  for (const part of content) {
2125
2196
  const output = part.output;
2197
+ if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2198
+ input.push({
2199
+ type: "local_shell_call_output",
2200
+ call_id: part.toolCallId,
2201
+ output: localShellOutputSchema.parse(output.value).output
2202
+ });
2203
+ break;
2204
+ }
2126
2205
  let contentValue;
2127
2206
  switch (output.type) {
2128
2207
  case "text":
@@ -2151,9 +2230,9 @@ async function convertToOpenAIResponsesInput({
2151
2230
  }
2152
2231
  return { input, warnings };
2153
2232
  }
2154
- var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2155
- itemId: import_v414.z.string().nullish(),
2156
- reasoningEncryptedContent: import_v414.z.string().nullish()
2233
+ var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
2234
+ itemId: import_v415.z.string().nullish(),
2235
+ reasoningEncryptedContent: import_v415.z.string().nullish()
2157
2236
  });
2158
2237
 
2159
2238
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2214,6 +2293,12 @@ function prepareResponsesTools({
2214
2293
  });
2215
2294
  break;
2216
2295
  }
2296
+ case "openai.local_shell": {
2297
+ openaiTools2.push({
2298
+ type: "local_shell"
2299
+ });
2300
+ break;
2301
+ }
2217
2302
  case "openai.web_search_preview": {
2218
2303
  const args = webSearchPreviewArgsSchema.parse(tool.args);
2219
2304
  openaiTools2.push({
@@ -2252,11 +2337,12 @@ function prepareResponsesTools({
2252
2337
  image_url: args.inputImageMask.imageUrl
2253
2338
  } : void 0,
2254
2339
  model: args.model,
2255
- size: args.size,
2256
- quality: args.quality,
2257
2340
  moderation: args.moderation,
2341
+ partial_images: args.partialImages,
2342
+ quality: args.quality,
2343
+ output_compression: args.outputCompression,
2258
2344
  output_format: args.outputFormat,
2259
- output_compression: args.outputCompression
2345
+ size: args.size
2260
2346
  });
2261
2347
  break;
2262
2348
  }
@@ -2293,73 +2379,86 @@ function prepareResponsesTools({
2293
2379
  }
2294
2380
 
2295
2381
  // src/responses/openai-responses-language-model.ts
2296
- var webSearchCallItem = import_v415.z.object({
2297
- type: import_v415.z.literal("web_search_call"),
2298
- id: import_v415.z.string(),
2299
- status: import_v415.z.string(),
2300
- action: import_v415.z.discriminatedUnion("type", [
2301
- import_v415.z.object({
2302
- type: import_v415.z.literal("search"),
2303
- query: import_v415.z.string().nullish()
2382
+ var webSearchCallItem = import_v416.z.object({
2383
+ type: import_v416.z.literal("web_search_call"),
2384
+ id: import_v416.z.string(),
2385
+ status: import_v416.z.string(),
2386
+ action: import_v416.z.discriminatedUnion("type", [
2387
+ import_v416.z.object({
2388
+ type: import_v416.z.literal("search"),
2389
+ query: import_v416.z.string().nullish()
2304
2390
  }),
2305
- import_v415.z.object({
2306
- type: import_v415.z.literal("open_page"),
2307
- url: import_v415.z.string()
2391
+ import_v416.z.object({
2392
+ type: import_v416.z.literal("open_page"),
2393
+ url: import_v416.z.string()
2308
2394
  }),
2309
- import_v415.z.object({
2310
- type: import_v415.z.literal("find"),
2311
- url: import_v415.z.string(),
2312
- pattern: import_v415.z.string()
2395
+ import_v416.z.object({
2396
+ type: import_v416.z.literal("find"),
2397
+ url: import_v416.z.string(),
2398
+ pattern: import_v416.z.string()
2313
2399
  })
2314
2400
  ]).nullish()
2315
2401
  });
2316
- var fileSearchCallItem = import_v415.z.object({
2317
- type: import_v415.z.literal("file_search_call"),
2318
- id: import_v415.z.string(),
2319
- queries: import_v415.z.array(import_v415.z.string()),
2320
- results: import_v415.z.array(
2321
- import_v415.z.object({
2322
- attributes: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()),
2323
- file_id: import_v415.z.string(),
2324
- filename: import_v415.z.string(),
2325
- score: import_v415.z.number(),
2326
- text: import_v415.z.string()
2402
+ var fileSearchCallItem = import_v416.z.object({
2403
+ type: import_v416.z.literal("file_search_call"),
2404
+ id: import_v416.z.string(),
2405
+ queries: import_v416.z.array(import_v416.z.string()),
2406
+ results: import_v416.z.array(
2407
+ import_v416.z.object({
2408
+ attributes: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()),
2409
+ file_id: import_v416.z.string(),
2410
+ filename: import_v416.z.string(),
2411
+ score: import_v416.z.number(),
2412
+ text: import_v416.z.string()
2327
2413
  })
2328
2414
  ).nullish()
2329
2415
  });
2330
- var codeInterpreterCallItem = import_v415.z.object({
2331
- type: import_v415.z.literal("code_interpreter_call"),
2332
- id: import_v415.z.string(),
2333
- code: import_v415.z.string().nullable(),
2334
- container_id: import_v415.z.string(),
2335
- outputs: import_v415.z.array(
2336
- import_v415.z.discriminatedUnion("type", [
2337
- import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
2338
- import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
2416
+ var codeInterpreterCallItem = import_v416.z.object({
2417
+ type: import_v416.z.literal("code_interpreter_call"),
2418
+ id: import_v416.z.string(),
2419
+ code: import_v416.z.string().nullable(),
2420
+ container_id: import_v416.z.string(),
2421
+ outputs: import_v416.z.array(
2422
+ import_v416.z.discriminatedUnion("type", [
2423
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
2424
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2339
2425
  ])
2340
2426
  ).nullable()
2341
2427
  });
2342
- var imageGenerationCallItem = import_v415.z.object({
2343
- type: import_v415.z.literal("image_generation_call"),
2344
- id: import_v415.z.string(),
2345
- result: import_v415.z.string()
2428
+ var localShellCallItem = import_v416.z.object({
2429
+ type: import_v416.z.literal("local_shell_call"),
2430
+ id: import_v416.z.string(),
2431
+ call_id: import_v416.z.string(),
2432
+ action: import_v416.z.object({
2433
+ type: import_v416.z.literal("exec"),
2434
+ command: import_v416.z.array(import_v416.z.string()),
2435
+ timeout_ms: import_v416.z.number().optional(),
2436
+ user: import_v416.z.string().optional(),
2437
+ working_directory: import_v416.z.string().optional(),
2438
+ env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
2439
+ })
2440
+ });
2441
+ var imageGenerationCallItem = import_v416.z.object({
2442
+ type: import_v416.z.literal("image_generation_call"),
2443
+ id: import_v416.z.string(),
2444
+ result: import_v416.z.string()
2346
2445
  });
2347
2446
  var TOP_LOGPROBS_MAX = 20;
2348
- var LOGPROBS_SCHEMA = import_v415.z.array(
2349
- import_v415.z.object({
2350
- token: import_v415.z.string(),
2351
- logprob: import_v415.z.number(),
2352
- top_logprobs: import_v415.z.array(
2353
- import_v415.z.object({
2354
- token: import_v415.z.string(),
2355
- logprob: import_v415.z.number()
2447
+ var LOGPROBS_SCHEMA = import_v416.z.array(
2448
+ import_v416.z.object({
2449
+ token: import_v416.z.string(),
2450
+ logprob: import_v416.z.number(),
2451
+ top_logprobs: import_v416.z.array(
2452
+ import_v416.z.object({
2453
+ token: import_v416.z.string(),
2454
+ logprob: import_v416.z.number()
2356
2455
  })
2357
2456
  )
2358
2457
  })
2359
2458
  );
2360
2459
  var OpenAIResponsesLanguageModel = class {
2361
2460
  constructor(modelId, config) {
2362
- this.specificationVersion = "v2";
2461
+ this.specificationVersion = "v3";
2363
2462
  this.supportedUrls = {
2364
2463
  "image/*": [/^https?:\/\/.*$/],
2365
2464
  "application/pdf": [/^https?:\/\/.*$/]
@@ -2409,7 +2508,7 @@ var OpenAIResponsesLanguageModel = class {
2409
2508
  if (stopSequences != null) {
2410
2509
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2411
2510
  }
2412
- const openaiOptions = await (0, import_provider_utils13.parseProviderOptions)({
2511
+ const openaiOptions = await (0, import_provider_utils14.parseProviderOptions)({
2413
2512
  provider: "openai",
2414
2513
  providerOptions,
2415
2514
  schema: openaiResponsesProviderOptionsSchema
@@ -2418,7 +2517,8 @@ var OpenAIResponsesLanguageModel = class {
2418
2517
  prompt,
2419
2518
  systemMessageMode: modelConfig.systemMessageMode,
2420
2519
  fileIdPrefixes: this.config.fileIdPrefixes,
2421
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
2520
+ store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
2521
+ hasLocalShellTool: hasOpenAITool("openai.local_shell")
2422
2522
  });
2423
2523
  warnings.push(...inputWarnings);
2424
2524
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
@@ -2577,51 +2677,51 @@ var OpenAIResponsesLanguageModel = class {
2577
2677
  responseHeaders,
2578
2678
  value: response,
2579
2679
  rawValue: rawResponse
2580
- } = await (0, import_provider_utils13.postJsonToApi)({
2680
+ } = await (0, import_provider_utils14.postJsonToApi)({
2581
2681
  url,
2582
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2682
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2583
2683
  body,
2584
2684
  failedResponseHandler: openaiFailedResponseHandler,
2585
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
2586
- import_v415.z.object({
2587
- id: import_v415.z.string(),
2588
- created_at: import_v415.z.number(),
2589
- error: import_v415.z.object({
2590
- code: import_v415.z.string(),
2591
- message: import_v415.z.string()
2685
+ successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
2686
+ import_v416.z.object({
2687
+ id: import_v416.z.string(),
2688
+ created_at: import_v416.z.number(),
2689
+ error: import_v416.z.object({
2690
+ code: import_v416.z.string(),
2691
+ message: import_v416.z.string()
2592
2692
  }).nullish(),
2593
- model: import_v415.z.string(),
2594
- output: import_v415.z.array(
2595
- import_v415.z.discriminatedUnion("type", [
2596
- import_v415.z.object({
2597
- type: import_v415.z.literal("message"),
2598
- role: import_v415.z.literal("assistant"),
2599
- id: import_v415.z.string(),
2600
- content: import_v415.z.array(
2601
- import_v415.z.object({
2602
- type: import_v415.z.literal("output_text"),
2603
- text: import_v415.z.string(),
2693
+ model: import_v416.z.string(),
2694
+ output: import_v416.z.array(
2695
+ import_v416.z.discriminatedUnion("type", [
2696
+ import_v416.z.object({
2697
+ type: import_v416.z.literal("message"),
2698
+ role: import_v416.z.literal("assistant"),
2699
+ id: import_v416.z.string(),
2700
+ content: import_v416.z.array(
2701
+ import_v416.z.object({
2702
+ type: import_v416.z.literal("output_text"),
2703
+ text: import_v416.z.string(),
2604
2704
  logprobs: LOGPROBS_SCHEMA.nullish(),
2605
- annotations: import_v415.z.array(
2606
- import_v415.z.discriminatedUnion("type", [
2607
- import_v415.z.object({
2608
- type: import_v415.z.literal("url_citation"),
2609
- start_index: import_v415.z.number(),
2610
- end_index: import_v415.z.number(),
2611
- url: import_v415.z.string(),
2612
- title: import_v415.z.string()
2705
+ annotations: import_v416.z.array(
2706
+ import_v416.z.discriminatedUnion("type", [
2707
+ import_v416.z.object({
2708
+ type: import_v416.z.literal("url_citation"),
2709
+ start_index: import_v416.z.number(),
2710
+ end_index: import_v416.z.number(),
2711
+ url: import_v416.z.string(),
2712
+ title: import_v416.z.string()
2613
2713
  }),
2614
- import_v415.z.object({
2615
- type: import_v415.z.literal("file_citation"),
2616
- file_id: import_v415.z.string(),
2617
- filename: import_v415.z.string().nullish(),
2618
- index: import_v415.z.number().nullish(),
2619
- start_index: import_v415.z.number().nullish(),
2620
- end_index: import_v415.z.number().nullish(),
2621
- quote: import_v415.z.string().nullish()
2714
+ import_v416.z.object({
2715
+ type: import_v416.z.literal("file_citation"),
2716
+ file_id: import_v416.z.string(),
2717
+ filename: import_v416.z.string().nullish(),
2718
+ index: import_v416.z.number().nullish(),
2719
+ start_index: import_v416.z.number().nullish(),
2720
+ end_index: import_v416.z.number().nullish(),
2721
+ quote: import_v416.z.string().nullish()
2622
2722
  }),
2623
- import_v415.z.object({
2624
- type: import_v415.z.literal("container_file_citation")
2723
+ import_v416.z.object({
2724
+ type: import_v416.z.literal("container_file_citation")
2625
2725
  })
2626
2726
  ])
2627
2727
  )
@@ -2632,33 +2732,34 @@ var OpenAIResponsesLanguageModel = class {
2632
2732
  fileSearchCallItem,
2633
2733
  codeInterpreterCallItem,
2634
2734
  imageGenerationCallItem,
2635
- import_v415.z.object({
2636
- type: import_v415.z.literal("function_call"),
2637
- call_id: import_v415.z.string(),
2638
- name: import_v415.z.string(),
2639
- arguments: import_v415.z.string(),
2640
- id: import_v415.z.string()
2735
+ localShellCallItem,
2736
+ import_v416.z.object({
2737
+ type: import_v416.z.literal("function_call"),
2738
+ call_id: import_v416.z.string(),
2739
+ name: import_v416.z.string(),
2740
+ arguments: import_v416.z.string(),
2741
+ id: import_v416.z.string()
2641
2742
  }),
2642
- import_v415.z.object({
2643
- type: import_v415.z.literal("computer_call"),
2644
- id: import_v415.z.string(),
2645
- status: import_v415.z.string().optional()
2743
+ import_v416.z.object({
2744
+ type: import_v416.z.literal("computer_call"),
2745
+ id: import_v416.z.string(),
2746
+ status: import_v416.z.string().optional()
2646
2747
  }),
2647
- import_v415.z.object({
2648
- type: import_v415.z.literal("reasoning"),
2649
- id: import_v415.z.string(),
2650
- encrypted_content: import_v415.z.string().nullish(),
2651
- summary: import_v415.z.array(
2652
- import_v415.z.object({
2653
- type: import_v415.z.literal("summary_text"),
2654
- text: import_v415.z.string()
2748
+ import_v416.z.object({
2749
+ type: import_v416.z.literal("reasoning"),
2750
+ id: import_v416.z.string(),
2751
+ encrypted_content: import_v416.z.string().nullish(),
2752
+ summary: import_v416.z.array(
2753
+ import_v416.z.object({
2754
+ type: import_v416.z.literal("summary_text"),
2755
+ text: import_v416.z.string()
2655
2756
  })
2656
2757
  )
2657
2758
  })
2658
2759
  ])
2659
2760
  ),
2660
- service_tier: import_v415.z.string().nullish(),
2661
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullable(),
2761
+ service_tier: import_v416.z.string().nullish(),
2762
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
2662
2763
  usage: usageSchema2
2663
2764
  })
2664
2765
  ),
@@ -2718,6 +2819,20 @@ var OpenAIResponsesLanguageModel = class {
2718
2819
  });
2719
2820
  break;
2720
2821
  }
2822
+ case "local_shell_call": {
2823
+ content.push({
2824
+ type: "tool-call",
2825
+ toolCallId: part.call_id,
2826
+ toolName: "local_shell",
2827
+ input: JSON.stringify({ action: part.action }),
2828
+ providerMetadata: {
2829
+ openai: {
2830
+ itemId: part.id
2831
+ }
2832
+ }
2833
+ });
2834
+ break;
2835
+ }
2721
2836
  case "message": {
2722
2837
  for (const contentPart of part.content) {
2723
2838
  if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -2737,7 +2852,7 @@ var OpenAIResponsesLanguageModel = class {
2737
2852
  content.push({
2738
2853
  type: "source",
2739
2854
  sourceType: "url",
2740
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils13.generateId)(),
2855
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils14.generateId)(),
2741
2856
  url: annotation.url,
2742
2857
  title: annotation.title
2743
2858
  });
@@ -2745,7 +2860,7 @@ var OpenAIResponsesLanguageModel = class {
2745
2860
  content.push({
2746
2861
  type: "source",
2747
2862
  sourceType: "document",
2748
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils13.generateId)(),
2863
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils14.generateId)(),
2749
2864
  mediaType: "text/plain",
2750
2865
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2751
2866
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2897,18 +3012,18 @@ var OpenAIResponsesLanguageModel = class {
2897
3012
  warnings,
2898
3013
  webSearchToolName
2899
3014
  } = await this.getArgs(options);
2900
- const { responseHeaders, value: response } = await (0, import_provider_utils13.postJsonToApi)({
3015
+ const { responseHeaders, value: response } = await (0, import_provider_utils14.postJsonToApi)({
2901
3016
  url: this.config.url({
2902
3017
  path: "/responses",
2903
3018
  modelId: this.modelId
2904
3019
  }),
2905
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
3020
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
2906
3021
  body: {
2907
3022
  ...body,
2908
3023
  stream: true
2909
3024
  },
2910
3025
  failedResponseHandler: openaiFailedResponseHandler,
2911
- successfulResponseHandler: (0, import_provider_utils13.createEventSourceResponseHandler)(
3026
+ successfulResponseHandler: (0, import_provider_utils14.createEventSourceResponseHandler)(
2912
3027
  openaiResponsesChunkSchema
2913
3028
  ),
2914
3029
  abortSignal: options.abortSignal,
@@ -2975,6 +3090,24 @@ var OpenAIResponsesLanguageModel = class {
2975
3090
  id: value.item.id,
2976
3091
  toolName: "computer_use"
2977
3092
  });
3093
+ } else if (value.item.type === "code_interpreter_call") {
3094
+ ongoingToolCalls[value.output_index] = {
3095
+ toolName: "code_interpreter",
3096
+ toolCallId: value.item.id,
3097
+ codeInterpreter: {
3098
+ containerId: value.item.container_id
3099
+ }
3100
+ };
3101
+ controller.enqueue({
3102
+ type: "tool-input-start",
3103
+ id: value.item.id,
3104
+ toolName: "code_interpreter"
3105
+ });
3106
+ controller.enqueue({
3107
+ type: "tool-input-delta",
3108
+ id: value.item.id,
3109
+ delta: `{"containerId":"${value.item.container_id}","code":"`
3110
+ });
2978
3111
  } else if (value.item.type === "file_search_call") {
2979
3112
  controller.enqueue({
2980
3113
  type: "tool-call",
@@ -3098,16 +3231,7 @@ var OpenAIResponsesLanguageModel = class {
3098
3231
  providerExecuted: true
3099
3232
  });
3100
3233
  } else if (value.item.type === "code_interpreter_call") {
3101
- controller.enqueue({
3102
- type: "tool-call",
3103
- toolCallId: value.item.id,
3104
- toolName: "code_interpreter",
3105
- input: JSON.stringify({
3106
- code: value.item.code,
3107
- containerId: value.item.container_id
3108
- }),
3109
- providerExecuted: true
3110
- });
3234
+ ongoingToolCalls[value.output_index] = void 0;
3111
3235
  controller.enqueue({
3112
3236
  type: "tool-result",
3113
3237
  toolCallId: value.item.id,
@@ -3127,6 +3251,26 @@ var OpenAIResponsesLanguageModel = class {
3127
3251
  },
3128
3252
  providerExecuted: true
3129
3253
  });
3254
+ } else if (value.item.type === "local_shell_call") {
3255
+ ongoingToolCalls[value.output_index] = void 0;
3256
+ controller.enqueue({
3257
+ type: "tool-call",
3258
+ toolCallId: value.item.call_id,
3259
+ toolName: "local_shell",
3260
+ input: JSON.stringify({
3261
+ action: {
3262
+ type: "exec",
3263
+ command: value.item.action.command,
3264
+ timeoutMs: value.item.action.timeout_ms,
3265
+ user: value.item.action.user,
3266
+ workingDirectory: value.item.action.working_directory,
3267
+ env: value.item.action.env
3268
+ }
3269
+ }),
3270
+ providerMetadata: {
3271
+ openai: { itemId: value.item.id }
3272
+ }
3273
+ });
3130
3274
  } else if (value.item.type === "message") {
3131
3275
  controller.enqueue({
3132
3276
  type: "text-end",
@@ -3157,6 +3301,51 @@ var OpenAIResponsesLanguageModel = class {
3157
3301
  delta: value.delta
3158
3302
  });
3159
3303
  }
3304
+ } else if (isResponseImageGenerationCallPartialImageChunk(value)) {
3305
+ controller.enqueue({
3306
+ type: "tool-result",
3307
+ toolCallId: value.item_id,
3308
+ toolName: "image_generation",
3309
+ result: {
3310
+ result: value.partial_image_b64
3311
+ },
3312
+ providerExecuted: true,
3313
+ preliminary: true
3314
+ });
3315
+ } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3316
+ const toolCall = ongoingToolCalls[value.output_index];
3317
+ if (toolCall != null) {
3318
+ controller.enqueue({
3319
+ type: "tool-input-delta",
3320
+ id: toolCall.toolCallId,
3321
+ // The delta is code, which is embedding in a JSON string.
3322
+ // To escape it, we use JSON.stringify and slice to remove the outer quotes.
3323
+ delta: JSON.stringify(value.delta).slice(1, -1)
3324
+ });
3325
+ }
3326
+ } else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
3327
+ const toolCall = ongoingToolCalls[value.output_index];
3328
+ if (toolCall != null) {
3329
+ controller.enqueue({
3330
+ type: "tool-input-delta",
3331
+ id: toolCall.toolCallId,
3332
+ delta: '"}'
3333
+ });
3334
+ controller.enqueue({
3335
+ type: "tool-input-end",
3336
+ id: toolCall.toolCallId
3337
+ });
3338
+ controller.enqueue({
3339
+ type: "tool-call",
3340
+ toolCallId: toolCall.toolCallId,
3341
+ toolName: "code_interpreter",
3342
+ input: JSON.stringify({
3343
+ code: value.code,
3344
+ containerId: toolCall.codeInterpreter.containerId
3345
+ }),
3346
+ providerExecuted: true
3347
+ });
3348
+ }
3160
3349
  } else if (isResponseCreatedChunk(value)) {
3161
3350
  responseId = value.response.id;
3162
3351
  controller.enqueue({
@@ -3219,7 +3408,7 @@ var OpenAIResponsesLanguageModel = class {
3219
3408
  controller.enqueue({
3220
3409
  type: "source",
3221
3410
  sourceType: "url",
3222
- id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils13.generateId)(),
3411
+ id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : (0, import_provider_utils14.generateId)(),
3223
3412
  url: value.annotation.url,
3224
3413
  title: value.annotation.title
3225
3414
  });
@@ -3227,7 +3416,7 @@ var OpenAIResponsesLanguageModel = class {
3227
3416
  controller.enqueue({
3228
3417
  type: "source",
3229
3418
  sourceType: "document",
3230
- id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils13.generateId)(),
3419
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : (0, import_provider_utils14.generateId)(),
3231
3420
  mediaType: "text/plain",
3232
3421
  title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
3233
3422
  filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
@@ -3263,166 +3452,201 @@ var OpenAIResponsesLanguageModel = class {
3263
3452
  };
3264
3453
  }
3265
3454
  };
3266
- var usageSchema2 = import_v415.z.object({
3267
- input_tokens: import_v415.z.number(),
3268
- input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
3269
- output_tokens: import_v415.z.number(),
3270
- output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
3455
+ var usageSchema2 = import_v416.z.object({
3456
+ input_tokens: import_v416.z.number(),
3457
+ input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
3458
+ output_tokens: import_v416.z.number(),
3459
+ output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
3271
3460
  });
3272
- var textDeltaChunkSchema = import_v415.z.object({
3273
- type: import_v415.z.literal("response.output_text.delta"),
3274
- item_id: import_v415.z.string(),
3275
- delta: import_v415.z.string(),
3461
+ var textDeltaChunkSchema = import_v416.z.object({
3462
+ type: import_v416.z.literal("response.output_text.delta"),
3463
+ item_id: import_v416.z.string(),
3464
+ delta: import_v416.z.string(),
3276
3465
  logprobs: LOGPROBS_SCHEMA.nullish()
3277
3466
  });
3278
- var errorChunkSchema = import_v415.z.object({
3279
- type: import_v415.z.literal("error"),
3280
- code: import_v415.z.string(),
3281
- message: import_v415.z.string(),
3282
- param: import_v415.z.string().nullish(),
3283
- sequence_number: import_v415.z.number()
3467
+ var errorChunkSchema = import_v416.z.object({
3468
+ type: import_v416.z.literal("error"),
3469
+ code: import_v416.z.string(),
3470
+ message: import_v416.z.string(),
3471
+ param: import_v416.z.string().nullish(),
3472
+ sequence_number: import_v416.z.number()
3284
3473
  });
3285
- var responseFinishedChunkSchema = import_v415.z.object({
3286
- type: import_v415.z.enum(["response.completed", "response.incomplete"]),
3287
- response: import_v415.z.object({
3288
- incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
3474
+ var responseFinishedChunkSchema = import_v416.z.object({
3475
+ type: import_v416.z.enum(["response.completed", "response.incomplete"]),
3476
+ response: import_v416.z.object({
3477
+ incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
3289
3478
  usage: usageSchema2,
3290
- service_tier: import_v415.z.string().nullish()
3479
+ service_tier: import_v416.z.string().nullish()
3291
3480
  })
3292
3481
  });
3293
- var responseCreatedChunkSchema = import_v415.z.object({
3294
- type: import_v415.z.literal("response.created"),
3295
- response: import_v415.z.object({
3296
- id: import_v415.z.string(),
3297
- created_at: import_v415.z.number(),
3298
- model: import_v415.z.string(),
3299
- service_tier: import_v415.z.string().nullish()
3482
+ var responseCreatedChunkSchema = import_v416.z.object({
3483
+ type: import_v416.z.literal("response.created"),
3484
+ response: import_v416.z.object({
3485
+ id: import_v416.z.string(),
3486
+ created_at: import_v416.z.number(),
3487
+ model: import_v416.z.string(),
3488
+ service_tier: import_v416.z.string().nullish()
3300
3489
  })
3301
3490
  });
3302
- var responseOutputItemAddedSchema = import_v415.z.object({
3303
- type: import_v415.z.literal("response.output_item.added"),
3304
- output_index: import_v415.z.number(),
3305
- item: import_v415.z.discriminatedUnion("type", [
3306
- import_v415.z.object({
3307
- type: import_v415.z.literal("message"),
3308
- id: import_v415.z.string()
3491
+ var responseOutputItemAddedSchema = import_v416.z.object({
3492
+ type: import_v416.z.literal("response.output_item.added"),
3493
+ output_index: import_v416.z.number(),
3494
+ item: import_v416.z.discriminatedUnion("type", [
3495
+ import_v416.z.object({
3496
+ type: import_v416.z.literal("message"),
3497
+ id: import_v416.z.string()
3309
3498
  }),
3310
- import_v415.z.object({
3311
- type: import_v415.z.literal("reasoning"),
3312
- id: import_v415.z.string(),
3313
- encrypted_content: import_v415.z.string().nullish()
3499
+ import_v416.z.object({
3500
+ type: import_v416.z.literal("reasoning"),
3501
+ id: import_v416.z.string(),
3502
+ encrypted_content: import_v416.z.string().nullish()
3314
3503
  }),
3315
- import_v415.z.object({
3316
- type: import_v415.z.literal("function_call"),
3317
- id: import_v415.z.string(),
3318
- call_id: import_v415.z.string(),
3319
- name: import_v415.z.string(),
3320
- arguments: import_v415.z.string()
3504
+ import_v416.z.object({
3505
+ type: import_v416.z.literal("function_call"),
3506
+ id: import_v416.z.string(),
3507
+ call_id: import_v416.z.string(),
3508
+ name: import_v416.z.string(),
3509
+ arguments: import_v416.z.string()
3321
3510
  }),
3322
- import_v415.z.object({
3323
- type: import_v415.z.literal("web_search_call"),
3324
- id: import_v415.z.string(),
3325
- status: import_v415.z.string(),
3326
- action: import_v415.z.object({
3327
- type: import_v415.z.literal("search"),
3328
- query: import_v415.z.string().optional()
3511
+ import_v416.z.object({
3512
+ type: import_v416.z.literal("web_search_call"),
3513
+ id: import_v416.z.string(),
3514
+ status: import_v416.z.string(),
3515
+ action: import_v416.z.object({
3516
+ type: import_v416.z.literal("search"),
3517
+ query: import_v416.z.string().optional()
3329
3518
  }).nullish()
3330
3519
  }),
3331
- import_v415.z.object({
3332
- type: import_v415.z.literal("computer_call"),
3333
- id: import_v415.z.string(),
3334
- status: import_v415.z.string()
3520
+ import_v416.z.object({
3521
+ type: import_v416.z.literal("computer_call"),
3522
+ id: import_v416.z.string(),
3523
+ status: import_v416.z.string()
3335
3524
  }),
3336
- import_v415.z.object({
3337
- type: import_v415.z.literal("file_search_call"),
3338
- id: import_v415.z.string()
3525
+ import_v416.z.object({
3526
+ type: import_v416.z.literal("file_search_call"),
3527
+ id: import_v416.z.string()
3339
3528
  }),
3340
- import_v415.z.object({
3341
- type: import_v415.z.literal("image_generation_call"),
3342
- id: import_v415.z.string()
3529
+ import_v416.z.object({
3530
+ type: import_v416.z.literal("image_generation_call"),
3531
+ id: import_v416.z.string()
3532
+ }),
3533
+ import_v416.z.object({
3534
+ type: import_v416.z.literal("code_interpreter_call"),
3535
+ id: import_v416.z.string(),
3536
+ container_id: import_v416.z.string(),
3537
+ code: import_v416.z.string().nullable(),
3538
+ outputs: import_v416.z.array(
3539
+ import_v416.z.discriminatedUnion("type", [
3540
+ import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
3541
+ import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
3542
+ ])
3543
+ ).nullable(),
3544
+ status: import_v416.z.string()
3343
3545
  })
3344
3546
  ])
3345
3547
  });
3346
- var responseOutputItemDoneSchema = import_v415.z.object({
3347
- type: import_v415.z.literal("response.output_item.done"),
3348
- output_index: import_v415.z.number(),
3349
- item: import_v415.z.discriminatedUnion("type", [
3350
- import_v415.z.object({
3351
- type: import_v415.z.literal("message"),
3352
- id: import_v415.z.string()
3548
+ var responseOutputItemDoneSchema = import_v416.z.object({
3549
+ type: import_v416.z.literal("response.output_item.done"),
3550
+ output_index: import_v416.z.number(),
3551
+ item: import_v416.z.discriminatedUnion("type", [
3552
+ import_v416.z.object({
3553
+ type: import_v416.z.literal("message"),
3554
+ id: import_v416.z.string()
3353
3555
  }),
3354
- import_v415.z.object({
3355
- type: import_v415.z.literal("reasoning"),
3356
- id: import_v415.z.string(),
3357
- encrypted_content: import_v415.z.string().nullish()
3556
+ import_v416.z.object({
3557
+ type: import_v416.z.literal("reasoning"),
3558
+ id: import_v416.z.string(),
3559
+ encrypted_content: import_v416.z.string().nullish()
3358
3560
  }),
3359
- import_v415.z.object({
3360
- type: import_v415.z.literal("function_call"),
3361
- id: import_v415.z.string(),
3362
- call_id: import_v415.z.string(),
3363
- name: import_v415.z.string(),
3364
- arguments: import_v415.z.string(),
3365
- status: import_v415.z.literal("completed")
3561
+ import_v416.z.object({
3562
+ type: import_v416.z.literal("function_call"),
3563
+ id: import_v416.z.string(),
3564
+ call_id: import_v416.z.string(),
3565
+ name: import_v416.z.string(),
3566
+ arguments: import_v416.z.string(),
3567
+ status: import_v416.z.literal("completed")
3366
3568
  }),
3367
3569
  codeInterpreterCallItem,
3368
3570
  imageGenerationCallItem,
3369
3571
  webSearchCallItem,
3370
3572
  fileSearchCallItem,
3371
- import_v415.z.object({
3372
- type: import_v415.z.literal("computer_call"),
3373
- id: import_v415.z.string(),
3374
- status: import_v415.z.literal("completed")
3573
+ localShellCallItem,
3574
+ import_v416.z.object({
3575
+ type: import_v416.z.literal("computer_call"),
3576
+ id: import_v416.z.string(),
3577
+ status: import_v416.z.literal("completed")
3375
3578
  })
3376
3579
  ])
3377
3580
  });
3378
- var responseFunctionCallArgumentsDeltaSchema = import_v415.z.object({
3379
- type: import_v415.z.literal("response.function_call_arguments.delta"),
3380
- item_id: import_v415.z.string(),
3381
- output_index: import_v415.z.number(),
3382
- delta: import_v415.z.string()
3581
+ var responseFunctionCallArgumentsDeltaSchema = import_v416.z.object({
3582
+ type: import_v416.z.literal("response.function_call_arguments.delta"),
3583
+ item_id: import_v416.z.string(),
3584
+ output_index: import_v416.z.number(),
3585
+ delta: import_v416.z.string()
3586
+ });
3587
+ var responseImageGenerationCallPartialImageSchema = import_v416.z.object({
3588
+ type: import_v416.z.literal("response.image_generation_call.partial_image"),
3589
+ item_id: import_v416.z.string(),
3590
+ output_index: import_v416.z.number(),
3591
+ partial_image_b64: import_v416.z.string()
3592
+ });
3593
+ var responseCodeInterpreterCallCodeDeltaSchema = import_v416.z.object({
3594
+ type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
3595
+ item_id: import_v416.z.string(),
3596
+ output_index: import_v416.z.number(),
3597
+ delta: import_v416.z.string()
3383
3598
  });
3384
- var responseAnnotationAddedSchema = import_v415.z.object({
3385
- type: import_v415.z.literal("response.output_text.annotation.added"),
3386
- annotation: import_v415.z.discriminatedUnion("type", [
3387
- import_v415.z.object({
3388
- type: import_v415.z.literal("url_citation"),
3389
- url: import_v415.z.string(),
3390
- title: import_v415.z.string()
3599
+ var responseCodeInterpreterCallCodeDoneSchema = import_v416.z.object({
3600
+ type: import_v416.z.literal("response.code_interpreter_call_code.done"),
3601
+ item_id: import_v416.z.string(),
3602
+ output_index: import_v416.z.number(),
3603
+ code: import_v416.z.string()
3604
+ });
3605
+ var responseAnnotationAddedSchema = import_v416.z.object({
3606
+ type: import_v416.z.literal("response.output_text.annotation.added"),
3607
+ annotation: import_v416.z.discriminatedUnion("type", [
3608
+ import_v416.z.object({
3609
+ type: import_v416.z.literal("url_citation"),
3610
+ url: import_v416.z.string(),
3611
+ title: import_v416.z.string()
3391
3612
  }),
3392
- import_v415.z.object({
3393
- type: import_v415.z.literal("file_citation"),
3394
- file_id: import_v415.z.string(),
3395
- filename: import_v415.z.string().nullish(),
3396
- index: import_v415.z.number().nullish(),
3397
- start_index: import_v415.z.number().nullish(),
3398
- end_index: import_v415.z.number().nullish(),
3399
- quote: import_v415.z.string().nullish()
3613
+ import_v416.z.object({
3614
+ type: import_v416.z.literal("file_citation"),
3615
+ file_id: import_v416.z.string(),
3616
+ filename: import_v416.z.string().nullish(),
3617
+ index: import_v416.z.number().nullish(),
3618
+ start_index: import_v416.z.number().nullish(),
3619
+ end_index: import_v416.z.number().nullish(),
3620
+ quote: import_v416.z.string().nullish()
3400
3621
  })
3401
3622
  ])
3402
3623
  });
3403
- var responseReasoningSummaryPartAddedSchema = import_v415.z.object({
3404
- type: import_v415.z.literal("response.reasoning_summary_part.added"),
3405
- item_id: import_v415.z.string(),
3406
- summary_index: import_v415.z.number()
3624
+ var responseReasoningSummaryPartAddedSchema = import_v416.z.object({
3625
+ type: import_v416.z.literal("response.reasoning_summary_part.added"),
3626
+ item_id: import_v416.z.string(),
3627
+ summary_index: import_v416.z.number()
3407
3628
  });
3408
- var responseReasoningSummaryTextDeltaSchema = import_v415.z.object({
3409
- type: import_v415.z.literal("response.reasoning_summary_text.delta"),
3410
- item_id: import_v415.z.string(),
3411
- summary_index: import_v415.z.number(),
3412
- delta: import_v415.z.string()
3629
+ var responseReasoningSummaryTextDeltaSchema = import_v416.z.object({
3630
+ type: import_v416.z.literal("response.reasoning_summary_text.delta"),
3631
+ item_id: import_v416.z.string(),
3632
+ summary_index: import_v416.z.number(),
3633
+ delta: import_v416.z.string()
3413
3634
  });
3414
- var openaiResponsesChunkSchema = import_v415.z.union([
3635
+ var openaiResponsesChunkSchema = import_v416.z.union([
3415
3636
  textDeltaChunkSchema,
3416
3637
  responseFinishedChunkSchema,
3417
3638
  responseCreatedChunkSchema,
3418
3639
  responseOutputItemAddedSchema,
3419
3640
  responseOutputItemDoneSchema,
3420
3641
  responseFunctionCallArgumentsDeltaSchema,
3642
+ responseImageGenerationCallPartialImageSchema,
3643
+ responseCodeInterpreterCallCodeDeltaSchema,
3644
+ responseCodeInterpreterCallCodeDoneSchema,
3421
3645
  responseAnnotationAddedSchema,
3422
3646
  responseReasoningSummaryPartAddedSchema,
3423
3647
  responseReasoningSummaryTextDeltaSchema,
3424
3648
  errorChunkSchema,
3425
- import_v415.z.object({ type: import_v415.z.string() }).loose()
3649
+ import_v416.z.object({ type: import_v416.z.string() }).loose()
3426
3650
  // fallback for unknown chunks
3427
3651
  ]);
3428
3652
  function isTextDeltaChunk(chunk) {
@@ -3443,6 +3667,15 @@ function isResponseCreatedChunk(chunk) {
3443
3667
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3444
3668
  return chunk.type === "response.function_call_arguments.delta";
3445
3669
  }
3670
+ function isResponseImageGenerationCallPartialImageChunk(chunk) {
3671
+ return chunk.type === "response.image_generation_call.partial_image";
3672
+ }
3673
+ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3674
+ return chunk.type === "response.code_interpreter_call_code.delta";
3675
+ }
3676
+ function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
3677
+ return chunk.type === "response.code_interpreter_call_code.done";
3678
+ }
3446
3679
  function isResponseOutputItemAddedChunk(chunk) {
3447
3680
  return chunk.type === "response.output_item.added";
3448
3681
  }
@@ -3495,15 +3728,15 @@ function getResponsesModelConfig(modelId) {
3495
3728
  isReasoningModel: false
3496
3729
  };
3497
3730
  }
3498
- var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3499
- include: import_v415.z.array(
3500
- import_v415.z.enum([
3731
+ var openaiResponsesProviderOptionsSchema = import_v416.z.object({
3732
+ include: import_v416.z.array(
3733
+ import_v416.z.enum([
3501
3734
  "reasoning.encrypted_content",
3502
3735
  "file_search_call.results",
3503
3736
  "message.output_text.logprobs"
3504
3737
  ])
3505
3738
  ).nullish(),
3506
- instructions: import_v415.z.string().nullish(),
3739
+ instructions: import_v416.z.string().nullish(),
3507
3740
  /**
3508
3741
  * Return the log probabilities of the tokens.
3509
3742
  *
@@ -3516,33 +3749,33 @@ var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3516
3749
  * @see https://platform.openai.com/docs/api-reference/responses/create
3517
3750
  * @see https://cookbook.openai.com/examples/using_logprobs
3518
3751
  */
3519
- logprobs: import_v415.z.union([import_v415.z.boolean(), import_v415.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3752
+ logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3520
3753
  /**
3521
3754
  * The maximum number of total calls to built-in tools that can be processed in a response.
3522
3755
  * This maximum number applies across all built-in tool calls, not per individual tool.
3523
3756
  * Any further attempts to call a tool by the model will be ignored.
3524
3757
  */
3525
- maxToolCalls: import_v415.z.number().nullish(),
3526
- metadata: import_v415.z.any().nullish(),
3527
- parallelToolCalls: import_v415.z.boolean().nullish(),
3528
- previousResponseId: import_v415.z.string().nullish(),
3529
- promptCacheKey: import_v415.z.string().nullish(),
3530
- reasoningEffort: import_v415.z.string().nullish(),
3531
- reasoningSummary: import_v415.z.string().nullish(),
3532
- safetyIdentifier: import_v415.z.string().nullish(),
3533
- serviceTier: import_v415.z.enum(["auto", "flex", "priority"]).nullish(),
3534
- store: import_v415.z.boolean().nullish(),
3535
- strictJsonSchema: import_v415.z.boolean().nullish(),
3536
- textVerbosity: import_v415.z.enum(["low", "medium", "high"]).nullish(),
3537
- user: import_v415.z.string().nullish()
3758
+ maxToolCalls: import_v416.z.number().nullish(),
3759
+ metadata: import_v416.z.any().nullish(),
3760
+ parallelToolCalls: import_v416.z.boolean().nullish(),
3761
+ previousResponseId: import_v416.z.string().nullish(),
3762
+ promptCacheKey: import_v416.z.string().nullish(),
3763
+ reasoningEffort: import_v416.z.string().nullish(),
3764
+ reasoningSummary: import_v416.z.string().nullish(),
3765
+ safetyIdentifier: import_v416.z.string().nullish(),
3766
+ serviceTier: import_v416.z.enum(["auto", "flex", "priority"]).nullish(),
3767
+ store: import_v416.z.boolean().nullish(),
3768
+ strictJsonSchema: import_v416.z.boolean().nullish(),
3769
+ textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
3770
+ user: import_v416.z.string().nullish()
3538
3771
  });
3539
3772
 
3540
3773
  // src/speech/openai-speech-model.ts
3541
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3542
- var import_v416 = require("zod/v4");
3543
- var OpenAIProviderOptionsSchema = import_v416.z.object({
3544
- instructions: import_v416.z.string().nullish(),
3545
- speed: import_v416.z.number().min(0.25).max(4).default(1).nullish()
3774
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3775
+ var import_v417 = require("zod/v4");
3776
+ var OpenAIProviderOptionsSchema = import_v417.z.object({
3777
+ instructions: import_v417.z.string().nullish(),
3778
+ speed: import_v417.z.number().min(0.25).max(4).default(1).nullish()
3546
3779
  });
3547
3780
  var OpenAISpeechModel = class {
3548
3781
  constructor(modelId, config) {
@@ -3563,7 +3796,7 @@ var OpenAISpeechModel = class {
3563
3796
  providerOptions
3564
3797
  }) {
3565
3798
  const warnings = [];
3566
- const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3799
+ const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3567
3800
  provider: "openai",
3568
3801
  providerOptions,
3569
3802
  schema: OpenAIProviderOptionsSchema
@@ -3616,15 +3849,15 @@ var OpenAISpeechModel = class {
3616
3849
  value: audio,
3617
3850
  responseHeaders,
3618
3851
  rawValue: rawResponse
3619
- } = await (0, import_provider_utils14.postJsonToApi)({
3852
+ } = await (0, import_provider_utils15.postJsonToApi)({
3620
3853
  url: this.config.url({
3621
3854
  path: "/audio/speech",
3622
3855
  modelId: this.modelId
3623
3856
  }),
3624
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3857
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
3625
3858
  body: requestBody,
3626
3859
  failedResponseHandler: openaiFailedResponseHandler,
3627
- successfulResponseHandler: (0, import_provider_utils14.createBinaryResponseHandler)(),
3860
+ successfulResponseHandler: (0, import_provider_utils15.createBinaryResponseHandler)(),
3628
3861
  abortSignal: options.abortSignal,
3629
3862
  fetch: this.config.fetch
3630
3863
  });
@@ -3645,34 +3878,34 @@ var OpenAISpeechModel = class {
3645
3878
  };
3646
3879
 
3647
3880
  // src/transcription/openai-transcription-model.ts
3648
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3649
- var import_v418 = require("zod/v4");
3881
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
3882
+ var import_v419 = require("zod/v4");
3650
3883
 
3651
3884
  // src/transcription/openai-transcription-options.ts
3652
- var import_v417 = require("zod/v4");
3653
- var openAITranscriptionProviderOptions = import_v417.z.object({
3885
+ var import_v418 = require("zod/v4");
3886
+ var openAITranscriptionProviderOptions = import_v418.z.object({
3654
3887
  /**
3655
3888
  * Additional information to include in the transcription response.
3656
3889
  */
3657
- include: import_v417.z.array(import_v417.z.string()).optional(),
3890
+ include: import_v418.z.array(import_v418.z.string()).optional(),
3658
3891
  /**
3659
3892
  * The language of the input audio in ISO-639-1 format.
3660
3893
  */
3661
- language: import_v417.z.string().optional(),
3894
+ language: import_v418.z.string().optional(),
3662
3895
  /**
3663
3896
  * An optional text to guide the model's style or continue a previous audio segment.
3664
3897
  */
3665
- prompt: import_v417.z.string().optional(),
3898
+ prompt: import_v418.z.string().optional(),
3666
3899
  /**
3667
3900
  * The sampling temperature, between 0 and 1.
3668
3901
  * @default 0
3669
3902
  */
3670
- temperature: import_v417.z.number().min(0).max(1).default(0).optional(),
3903
+ temperature: import_v418.z.number().min(0).max(1).default(0).optional(),
3671
3904
  /**
3672
3905
  * The timestamp granularities to populate for this transcription.
3673
3906
  * @default ['segment']
3674
3907
  */
3675
- timestampGranularities: import_v417.z.array(import_v417.z.enum(["word", "segment"])).default(["segment"]).optional()
3908
+ timestampGranularities: import_v418.z.array(import_v418.z.enum(["word", "segment"])).default(["segment"]).optional()
3676
3909
  });
3677
3910
 
3678
3911
  // src/transcription/openai-transcription-model.ts
@@ -3750,15 +3983,15 @@ var OpenAITranscriptionModel = class {
3750
3983
  providerOptions
3751
3984
  }) {
3752
3985
  const warnings = [];
3753
- const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3986
+ const openAIOptions = await (0, import_provider_utils16.parseProviderOptions)({
3754
3987
  provider: "openai",
3755
3988
  providerOptions,
3756
3989
  schema: openAITranscriptionProviderOptions
3757
3990
  });
3758
3991
  const formData = new FormData();
3759
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils15.convertBase64ToUint8Array)(audio)]);
3992
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils16.convertBase64ToUint8Array)(audio)]);
3760
3993
  formData.append("model", this.modelId);
3761
- const fileExtension = (0, import_provider_utils15.mediaTypeToExtension)(mediaType);
3994
+ const fileExtension = (0, import_provider_utils16.mediaTypeToExtension)(mediaType);
3762
3995
  formData.append(
3763
3996
  "file",
3764
3997
  new File([blob], "audio", { type: mediaType }),
@@ -3803,15 +4036,15 @@ var OpenAITranscriptionModel = class {
3803
4036
  value: response,
3804
4037
  responseHeaders,
3805
4038
  rawValue: rawResponse
3806
- } = await (0, import_provider_utils15.postFormDataToApi)({
4039
+ } = await (0, import_provider_utils16.postFormDataToApi)({
3807
4040
  url: this.config.url({
3808
4041
  path: "/audio/transcriptions",
3809
4042
  modelId: this.modelId
3810
4043
  }),
3811
- headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
4044
+ headers: (0, import_provider_utils16.combineHeaders)(this.config.headers(), options.headers),
3812
4045
  formData,
3813
4046
  failedResponseHandler: openaiFailedResponseHandler,
3814
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
4047
+ successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
3815
4048
  openaiTranscriptionResponseSchema
3816
4049
  ),
3817
4050
  abortSignal: options.abortSignal,
@@ -3841,48 +4074,59 @@ var OpenAITranscriptionModel = class {
3841
4074
  };
3842
4075
  }
3843
4076
  };
3844
- var openaiTranscriptionResponseSchema = import_v418.z.object({
3845
- text: import_v418.z.string(),
3846
- language: import_v418.z.string().nullish(),
3847
- duration: import_v418.z.number().nullish(),
3848
- words: import_v418.z.array(
3849
- import_v418.z.object({
3850
- word: import_v418.z.string(),
3851
- start: import_v418.z.number(),
3852
- end: import_v418.z.number()
4077
+ var openaiTranscriptionResponseSchema = import_v419.z.object({
4078
+ text: import_v419.z.string(),
4079
+ language: import_v419.z.string().nullish(),
4080
+ duration: import_v419.z.number().nullish(),
4081
+ words: import_v419.z.array(
4082
+ import_v419.z.object({
4083
+ word: import_v419.z.string(),
4084
+ start: import_v419.z.number(),
4085
+ end: import_v419.z.number()
3853
4086
  })
3854
4087
  ).nullish(),
3855
- segments: import_v418.z.array(
3856
- import_v418.z.object({
3857
- id: import_v418.z.number(),
3858
- seek: import_v418.z.number(),
3859
- start: import_v418.z.number(),
3860
- end: import_v418.z.number(),
3861
- text: import_v418.z.string(),
3862
- tokens: import_v418.z.array(import_v418.z.number()),
3863
- temperature: import_v418.z.number(),
3864
- avg_logprob: import_v418.z.number(),
3865
- compression_ratio: import_v418.z.number(),
3866
- no_speech_prob: import_v418.z.number()
4088
+ segments: import_v419.z.array(
4089
+ import_v419.z.object({
4090
+ id: import_v419.z.number(),
4091
+ seek: import_v419.z.number(),
4092
+ start: import_v419.z.number(),
4093
+ end: import_v419.z.number(),
4094
+ text: import_v419.z.string(),
4095
+ tokens: import_v419.z.array(import_v419.z.number()),
4096
+ temperature: import_v419.z.number(),
4097
+ avg_logprob: import_v419.z.number(),
4098
+ compression_ratio: import_v419.z.number(),
4099
+ no_speech_prob: import_v419.z.number()
3867
4100
  })
3868
4101
  ).nullish()
3869
4102
  });
3870
4103
 
4104
+ // src/version.ts
4105
+ var VERSION = true ? "2.1.0-beta.11" : "0.0.0-test";
4106
+
3871
4107
  // src/openai-provider.ts
3872
4108
  function createOpenAI(options = {}) {
3873
4109
  var _a, _b;
3874
- const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
4110
+ const baseURL = (_a = (0, import_provider_utils17.withoutTrailingSlash)(
4111
+ (0, import_provider_utils17.loadOptionalSetting)({
4112
+ settingValue: options.baseURL,
4113
+ environmentVariableName: "OPENAI_BASE_URL"
4114
+ })
4115
+ )) != null ? _a : "https://api.openai.com/v1";
3875
4116
  const providerName = (_b = options.name) != null ? _b : "openai";
3876
- const getHeaders = () => ({
3877
- Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
3878
- apiKey: options.apiKey,
3879
- environmentVariableName: "OPENAI_API_KEY",
3880
- description: "OpenAI"
3881
- })}`,
3882
- "OpenAI-Organization": options.organization,
3883
- "OpenAI-Project": options.project,
3884
- ...options.headers
3885
- });
4117
+ const getHeaders = () => (0, import_provider_utils17.withUserAgentSuffix)(
4118
+ {
4119
+ Authorization: `Bearer ${(0, import_provider_utils17.loadApiKey)({
4120
+ apiKey: options.apiKey,
4121
+ environmentVariableName: "OPENAI_API_KEY",
4122
+ description: "OpenAI"
4123
+ })}`,
4124
+ "OpenAI-Organization": options.organization,
4125
+ "OpenAI-Project": options.project,
4126
+ ...options.headers
4127
+ },
4128
+ `ai-sdk/openai/${VERSION}`
4129
+ );
3886
4130
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
3887
4131
  provider: `${providerName}.chat`,
3888
4132
  url: ({ path }) => `${baseURL}${path}`,
@@ -3958,6 +4202,7 @@ function createOpenAI(options = {}) {
3958
4202
  var openai = createOpenAI();
3959
4203
  // Annotate the CommonJS export names for ESM import in node:
3960
4204
  0 && (module.exports = {
4205
+ VERSION,
3961
4206
  createOpenAI,
3962
4207
  openai
3963
4208
  });