@ai-sdk/openai 2.0.28 → 2.0.30

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0294b58]
8
+ - @ai-sdk/provider-utils@3.0.9
9
+
10
+ ## 2.0.29
11
+
12
+ ### Patch Changes
13
+
14
+ - 4235eb3: feat(provider/openai): code interpreter tool calls and results
15
+
3
16
  ## 2.0.28
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -57,17 +57,6 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
57
57
  };
58
58
  }>;
59
59
 
60
- declare const codeInterpreterToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
61
- /**
62
- * The code interpreter container.
63
- * Can be a container ID
64
- * or an object that specifies uploaded file IDs to make available to your code.
65
- */
66
- container?: string | {
67
- fileIds?: string[];
68
- };
69
- }>;
70
-
71
60
  declare const openaiTools: {
72
61
  /**
73
62
  * The Code Interpreter tool allows models to write and run Python code in a
@@ -78,7 +67,22 @@ declare const openaiTools: {
78
67
  *
79
68
  * Must have name `code_interpreter`.
80
69
  */
81
- codeInterpreter: (args?: Parameters<typeof codeInterpreterToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
70
+ codeInterpreter: (args?: {
71
+ container?: string | {
72
+ fileIds?: string[];
73
+ };
74
+ }) => _ai_sdk_provider_utils.Tool<{
75
+ code?: string | null;
76
+ containerId: string;
77
+ }, {
78
+ outputs?: Array<{
79
+ type: "logs";
80
+ logs: string;
81
+ } | {
82
+ type: "image";
83
+ url: string;
84
+ }> | null;
85
+ }>;
82
86
  /**
83
87
  * File search is a tool available in the Responses API. It enables models to
84
88
  * retrieve information in a knowledge base of previously uploaded files through
package/dist/index.d.ts CHANGED
@@ -57,17 +57,6 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
57
57
  };
58
58
  }>;
59
59
 
60
- declare const codeInterpreterToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
61
- /**
62
- * The code interpreter container.
63
- * Can be a container ID
64
- * or an object that specifies uploaded file IDs to make available to your code.
65
- */
66
- container?: string | {
67
- fileIds?: string[];
68
- };
69
- }>;
70
-
71
60
  declare const openaiTools: {
72
61
  /**
73
62
  * The Code Interpreter tool allows models to write and run Python code in a
@@ -78,7 +67,22 @@ declare const openaiTools: {
78
67
  *
79
68
  * Must have name `code_interpreter`.
80
69
  */
81
- codeInterpreter: (args?: Parameters<typeof codeInterpreterToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, unknown>;
70
+ codeInterpreter: (args?: {
71
+ container?: string | {
72
+ fileIds?: string[];
73
+ };
74
+ }) => _ai_sdk_provider_utils.Tool<{
75
+ code?: string | null;
76
+ containerId: string;
77
+ }, {
78
+ outputs?: Array<{
79
+ type: "logs";
80
+ logs: string;
81
+ } | {
82
+ type: "image";
83
+ url: string;
84
+ }> | null;
85
+ }>;
82
86
  /**
83
87
  * File search is a tool available in the Responses API. It enables models to
84
88
  * retrieve information in a knowledge base of previously uploaded files through
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ __export(src_exports, {
26
26
  module.exports = __toCommonJS(src_exports);
27
27
 
28
28
  // src/openai-provider.ts
29
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
29
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
30
30
 
31
31
  // src/chat/openai-chat-language-model.ts
32
32
  var import_provider3 = require("@ai-sdk/provider");
@@ -1799,6 +1799,18 @@ var openaiImageResponseSchema = import_v410.z.object({
1799
1799
  // src/tool/code-interpreter.ts
1800
1800
  var import_provider_utils9 = require("@ai-sdk/provider-utils");
1801
1801
  var import_v411 = require("zod/v4");
1802
+ var codeInterpreterInputSchema = import_v411.z.object({
1803
+ code: import_v411.z.string().nullish(),
1804
+ containerId: import_v411.z.string()
1805
+ });
1806
+ var codeInterpreterOutputSchema = import_v411.z.object({
1807
+ outputs: import_v411.z.array(
1808
+ import_v411.z.discriminatedUnion("type", [
1809
+ import_v411.z.object({ type: import_v411.z.literal("logs"), logs: import_v411.z.string() }),
1810
+ import_v411.z.object({ type: import_v411.z.literal("image"), url: import_v411.z.string() })
1811
+ ])
1812
+ ).nullish()
1813
+ });
1802
1814
  var codeInterpreterArgsSchema = import_v411.z.object({
1803
1815
  container: import_v411.z.union([
1804
1816
  import_v411.z.string(),
@@ -1807,10 +1819,11 @@ var codeInterpreterArgsSchema = import_v411.z.object({
1807
1819
  })
1808
1820
  ]).optional()
1809
1821
  });
1810
- var codeInterpreterToolFactory = (0, import_provider_utils9.createProviderDefinedToolFactory)({
1822
+ var codeInterpreterToolFactory = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1811
1823
  id: "openai.code_interpreter",
1812
1824
  name: "code_interpreter",
1813
- inputSchema: import_v411.z.object({})
1825
+ inputSchema: codeInterpreterInputSchema,
1826
+ outputSchema: codeInterpreterOutputSchema
1814
1827
  });
1815
1828
  var codeInterpreter = (args = {}) => {
1816
1829
  return codeInterpreterToolFactory(args);
@@ -1909,36 +1922,35 @@ var openaiTools = {
1909
1922
 
1910
1923
  // src/responses/openai-responses-language-model.ts
1911
1924
  var import_provider8 = require("@ai-sdk/provider");
1912
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
1925
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1913
1926
  var import_v414 = require("zod/v4");
1914
1927
 
1915
- // src/responses/convert-to-openai-responses-messages.ts
1928
+ // src/responses/convert-to-openai-responses-input.ts
1916
1929
  var import_provider6 = require("@ai-sdk/provider");
1917
1930
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
1918
1931
  var import_v413 = require("zod/v4");
1919
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1920
1932
  function isFileId(data, prefixes) {
1921
1933
  if (!prefixes) return false;
1922
1934
  return prefixes.some((prefix) => data.startsWith(prefix));
1923
1935
  }
1924
- async function convertToOpenAIResponsesMessages({
1936
+ async function convertToOpenAIResponsesInput({
1925
1937
  prompt,
1926
1938
  systemMessageMode,
1927
1939
  fileIdPrefixes
1928
1940
  }) {
1929
1941
  var _a, _b, _c, _d, _e, _f;
1930
- const messages = [];
1942
+ const input = [];
1931
1943
  const warnings = [];
1932
1944
  for (const { role, content } of prompt) {
1933
1945
  switch (role) {
1934
1946
  case "system": {
1935
1947
  switch (systemMessageMode) {
1936
1948
  case "system": {
1937
- messages.push({ role: "system", content });
1949
+ input.push({ role: "system", content });
1938
1950
  break;
1939
1951
  }
1940
1952
  case "developer": {
1941
- messages.push({ role: "developer", content });
1953
+ input.push({ role: "developer", content });
1942
1954
  break;
1943
1955
  }
1944
1956
  case "remove": {
@@ -1958,7 +1970,7 @@ async function convertToOpenAIResponsesMessages({
1958
1970
  break;
1959
1971
  }
1960
1972
  case "user": {
1961
- messages.push({
1973
+ input.push({
1962
1974
  role: "user",
1963
1975
  content: content.map((part, index) => {
1964
1976
  var _a2, _b2, _c2;
@@ -1972,7 +1984,7 @@ async function convertToOpenAIResponsesMessages({
1972
1984
  return {
1973
1985
  type: "input_image",
1974
1986
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
1975
- image_url: `data:${mediaType};base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
1987
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils11.convertToBase64)(part.data)}`
1976
1988
  },
1977
1989
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
1978
1990
  };
@@ -1987,7 +1999,7 @@ async function convertToOpenAIResponsesMessages({
1987
1999
  type: "input_file",
1988
2000
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
1989
2001
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
1990
- file_data: `data:application/pdf;base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
2002
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils11.convertToBase64)(part.data)}`
1991
2003
  }
1992
2004
  };
1993
2005
  } else {
@@ -2003,10 +2015,11 @@ async function convertToOpenAIResponsesMessages({
2003
2015
  }
2004
2016
  case "assistant": {
2005
2017
  const reasoningMessages = {};
2018
+ const toolCallParts = {};
2006
2019
  for (const part of content) {
2007
2020
  switch (part.type) {
2008
2021
  case "text": {
2009
- messages.push({
2022
+ input.push({
2010
2023
  role: "assistant",
2011
2024
  content: [{ type: "output_text", text: part.text }],
2012
2025
  id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
@@ -2014,10 +2027,11 @@ async function convertToOpenAIResponsesMessages({
2014
2027
  break;
2015
2028
  }
2016
2029
  case "tool-call": {
2030
+ toolCallParts[part.toolCallId] = part;
2017
2031
  if (part.providerExecuted) {
2018
2032
  break;
2019
2033
  }
2020
- messages.push({
2034
+ input.push({
2021
2035
  type: "function_call",
2022
2036
  call_id: part.toolCallId,
2023
2037
  name: part.toolName,
@@ -2058,7 +2072,7 @@ async function convertToOpenAIResponsesMessages({
2058
2072
  encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2059
2073
  summary: summaryParts
2060
2074
  };
2061
- messages.push(reasoningMessages[reasoningId]);
2075
+ input.push(reasoningMessages[reasoningId]);
2062
2076
  } else {
2063
2077
  existingReasoningMessage.summary.push(...summaryParts);
2064
2078
  }
@@ -2089,7 +2103,7 @@ async function convertToOpenAIResponsesMessages({
2089
2103
  contentValue = JSON.stringify(output.value);
2090
2104
  break;
2091
2105
  }
2092
- messages.push({
2106
+ input.push({
2093
2107
  type: "function_call_output",
2094
2108
  call_id: part.toolCallId,
2095
2109
  output: contentValue
@@ -2103,7 +2117,7 @@ async function convertToOpenAIResponsesMessages({
2103
2117
  }
2104
2118
  }
2105
2119
  }
2106
- return { messages, warnings };
2120
+ return { input, warnings };
2107
2121
  }
2108
2122
  var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
2109
2123
  itemId: import_v413.z.string().nullish(),
@@ -2249,6 +2263,18 @@ var webSearchCallItem = import_v414.z.object({
2249
2263
  })
2250
2264
  ]).nullish()
2251
2265
  });
2266
+ var codeInterpreterCallItem = import_v414.z.object({
2267
+ type: import_v414.z.literal("code_interpreter_call"),
2268
+ id: import_v414.z.string(),
2269
+ code: import_v414.z.string().nullable(),
2270
+ container_id: import_v414.z.string(),
2271
+ outputs: import_v414.z.array(
2272
+ import_v414.z.discriminatedUnion("type", [
2273
+ import_v414.z.object({ type: import_v414.z.literal("logs"), logs: import_v414.z.string() }),
2274
+ import_v414.z.object({ type: import_v414.z.literal("image"), url: import_v414.z.string() })
2275
+ ])
2276
+ ).nullable()
2277
+ });
2252
2278
  var TOP_LOGPROBS_MAX = 20;
2253
2279
  var LOGPROBS_SCHEMA = import_v414.z.array(
2254
2280
  import_v414.z.object({
@@ -2290,7 +2316,7 @@ var OpenAIResponsesLanguageModel = class {
2290
2316
  toolChoice,
2291
2317
  responseFormat
2292
2318
  }) {
2293
- var _a, _b, _c;
2319
+ var _a, _b, _c, _d;
2294
2320
  const warnings = [];
2295
2321
  const modelConfig = getResponsesModelConfig(this.modelId);
2296
2322
  if (topK != null) {
@@ -2314,13 +2340,13 @@ var OpenAIResponsesLanguageModel = class {
2314
2340
  if (stopSequences != null) {
2315
2341
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2316
2342
  }
2317
- const { messages, warnings: messageWarnings } = await convertToOpenAIResponsesMessages({
2343
+ const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
2318
2344
  prompt,
2319
2345
  systemMessageMode: modelConfig.systemMessageMode,
2320
2346
  fileIdPrefixes: this.config.fileIdPrefixes
2321
2347
  });
2322
- warnings.push(...messageWarnings);
2323
- const openaiOptions = await (0, import_provider_utils13.parseProviderOptions)({
2348
+ warnings.push(...inputWarnings);
2349
+ const openaiOptions = await (0, import_provider_utils12.parseProviderOptions)({
2324
2350
  provider: "openai",
2325
2351
  providerOptions,
2326
2352
  schema: openaiResponsesProviderOptionsSchema
@@ -2333,9 +2359,13 @@ var OpenAIResponsesLanguageModel = class {
2333
2359
  (tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
2334
2360
  )) == null ? void 0 : _b.name;
2335
2361
  include = webSearchToolName ? Array.isArray(include) ? [...include, "web_search_call.action.sources"] : ["web_search_call.action.sources"] : include;
2362
+ const codeInterpreterToolName = (_c = tools == null ? void 0 : tools.find(
2363
+ (tool) => tool.type === "provider-defined" && tool.id === "openai.code_interpreter"
2364
+ )) == null ? void 0 : _c.name;
2365
+ include = codeInterpreterToolName ? Array.isArray(include) ? [...include, "code_interpreter_call.outputs"] : ["code_interpreter_call.outputs"] : include;
2336
2366
  const baseArgs = {
2337
2367
  model: this.modelId,
2338
- input: messages,
2368
+ input,
2339
2369
  temperature,
2340
2370
  top_p: topP,
2341
2371
  max_output_tokens: maxOutputTokens,
@@ -2345,7 +2375,7 @@ var OpenAIResponsesLanguageModel = class {
2345
2375
  format: responseFormat.schema != null ? {
2346
2376
  type: "json_schema",
2347
2377
  strict: strictJsonSchema,
2348
- name: (_c = responseFormat.name) != null ? _c : "response",
2378
+ name: (_d = responseFormat.name) != null ? _d : "response",
2349
2379
  description: responseFormat.description,
2350
2380
  schema: responseFormat.schema
2351
2381
  } : { type: "json_object" }
@@ -2465,12 +2495,12 @@ var OpenAIResponsesLanguageModel = class {
2465
2495
  responseHeaders,
2466
2496
  value: response,
2467
2497
  rawValue: rawResponse
2468
- } = await (0, import_provider_utils13.postJsonToApi)({
2498
+ } = await (0, import_provider_utils12.postJsonToApi)({
2469
2499
  url,
2470
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2500
+ headers: (0, import_provider_utils12.combineHeaders)(this.config.headers(), options.headers),
2471
2501
  body,
2472
2502
  failedResponseHandler: openaiFailedResponseHandler,
2473
- successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
2503
+ successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
2474
2504
  import_v414.z.object({
2475
2505
  id: import_v414.z.string(),
2476
2506
  created_at: import_v414.z.number(),
@@ -2516,9 +2546,7 @@ var OpenAIResponsesLanguageModel = class {
2516
2546
  })
2517
2547
  )
2518
2548
  }),
2519
- import_v414.z.object({
2520
- type: import_v414.z.literal("code_interpreter_call")
2521
- }),
2549
+ codeInterpreterCallItem,
2522
2550
  import_v414.z.object({
2523
2551
  type: import_v414.z.literal("function_call"),
2524
2552
  call_id: import_v414.z.string(),
@@ -2622,7 +2650,7 @@ var OpenAIResponsesLanguageModel = class {
2622
2650
  content.push({
2623
2651
  type: "source",
2624
2652
  sourceType: "url",
2625
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils13.generateId)(),
2653
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils12.generateId)(),
2626
2654
  url: annotation.url,
2627
2655
  title: annotation.title
2628
2656
  });
@@ -2630,7 +2658,7 @@ var OpenAIResponsesLanguageModel = class {
2630
2658
  content.push({
2631
2659
  type: "source",
2632
2660
  sourceType: "document",
2633
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils13.generateId)(),
2661
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils12.generateId)(),
2634
2662
  mediaType: "text/plain",
2635
2663
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2636
2664
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2714,6 +2742,28 @@ var OpenAIResponsesLanguageModel = class {
2714
2742
  });
2715
2743
  break;
2716
2744
  }
2745
+ case "code_interpreter_call": {
2746
+ content.push({
2747
+ type: "tool-call",
2748
+ toolCallId: part.id,
2749
+ toolName: "code_interpreter",
2750
+ input: JSON.stringify({
2751
+ code: part.code,
2752
+ containerId: part.container_id
2753
+ }),
2754
+ providerExecuted: true
2755
+ });
2756
+ content.push({
2757
+ type: "tool-result",
2758
+ toolCallId: part.id,
2759
+ toolName: "code_interpreter",
2760
+ result: {
2761
+ outputs: part.outputs
2762
+ },
2763
+ providerExecuted: true
2764
+ });
2765
+ break;
2766
+ }
2717
2767
  }
2718
2768
  }
2719
2769
  const providerMetadata = {
@@ -2756,18 +2806,18 @@ var OpenAIResponsesLanguageModel = class {
2756
2806
  warnings,
2757
2807
  webSearchToolName
2758
2808
  } = await this.getArgs(options);
2759
- const { responseHeaders, value: response } = await (0, import_provider_utils13.postJsonToApi)({
2809
+ const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
2760
2810
  url: this.config.url({
2761
2811
  path: "/responses",
2762
2812
  modelId: this.modelId
2763
2813
  }),
2764
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2814
+ headers: (0, import_provider_utils12.combineHeaders)(this.config.headers(), options.headers),
2765
2815
  body: {
2766
2816
  ...body,
2767
2817
  stream: true
2768
2818
  },
2769
2819
  failedResponseHandler: openaiFailedResponseHandler,
2770
- successfulResponseHandler: (0, import_provider_utils13.createEventSourceResponseHandler)(
2820
+ successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
2771
2821
  openaiResponsesChunkSchema
2772
2822
  ),
2773
2823
  abortSignal: options.abortSignal,
@@ -2957,6 +3007,26 @@ var OpenAIResponsesLanguageModel = class {
2957
3007
  },
2958
3008
  providerExecuted: true
2959
3009
  });
3010
+ } else if (value.item.type === "code_interpreter_call") {
3011
+ controller.enqueue({
3012
+ type: "tool-call",
3013
+ toolCallId: value.item.id,
3014
+ toolName: "code_interpreter",
3015
+ input: JSON.stringify({
3016
+ code: value.item.code,
3017
+ containerId: value.item.container_id
3018
+ }),
3019
+ providerExecuted: true
3020
+ });
3021
+ controller.enqueue({
3022
+ type: "tool-result",
3023
+ toolCallId: value.item.id,
3024
+ toolName: "code_interpreter",
3025
+ result: {
3026
+ outputs: value.item.outputs
3027
+ },
3028
+ providerExecuted: true
3029
+ });
2960
3030
  } else if (value.item.type === "message") {
2961
3031
  controller.enqueue({
2962
3032
  type: "text-end",
@@ -3049,7 +3119,7 @@ var OpenAIResponsesLanguageModel = class {
3049
3119
  controller.enqueue({
3050
3120
  type: "source",
3051
3121
  sourceType: "url",
3052
- id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils13.generateId)(),
3122
+ id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils12.generateId)(),
3053
3123
  url: value.annotation.url,
3054
3124
  title: value.annotation.title
3055
3125
  });
@@ -3057,7 +3127,7 @@ var OpenAIResponsesLanguageModel = class {
3057
3127
  controller.enqueue({
3058
3128
  type: "source",
3059
3129
  sourceType: "document",
3060
- id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils13.generateId)(),
3130
+ id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils12.generateId)(),
3061
3131
  mediaType: "text/plain",
3062
3132
  title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
3063
3133
  filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
@@ -3202,6 +3272,7 @@ var responseOutputItemDoneSchema = import_v414.z.object({
3202
3272
  arguments: import_v414.z.string(),
3203
3273
  status: import_v414.z.literal("completed")
3204
3274
  }),
3275
+ codeInterpreterCallItem,
3205
3276
  webSearchCallItem,
3206
3277
  import_v414.z.object({
3207
3278
  type: import_v414.z.literal("computer_call"),
@@ -3383,7 +3454,7 @@ var openaiResponsesProviderOptionsSchema = import_v414.z.object({
3383
3454
  });
3384
3455
 
3385
3456
  // src/speech/openai-speech-model.ts
3386
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3457
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
3387
3458
  var import_v415 = require("zod/v4");
3388
3459
  var OpenAIProviderOptionsSchema = import_v415.z.object({
3389
3460
  instructions: import_v415.z.string().nullish(),
@@ -3408,7 +3479,7 @@ var OpenAISpeechModel = class {
3408
3479
  providerOptions
3409
3480
  }) {
3410
3481
  const warnings = [];
3411
- const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3482
+ const openAIOptions = await (0, import_provider_utils13.parseProviderOptions)({
3412
3483
  provider: "openai",
3413
3484
  providerOptions,
3414
3485
  schema: OpenAIProviderOptionsSchema
@@ -3461,15 +3532,15 @@ var OpenAISpeechModel = class {
3461
3532
  value: audio,
3462
3533
  responseHeaders,
3463
3534
  rawValue: rawResponse
3464
- } = await (0, import_provider_utils14.postJsonToApi)({
3535
+ } = await (0, import_provider_utils13.postJsonToApi)({
3465
3536
  url: this.config.url({
3466
3537
  path: "/audio/speech",
3467
3538
  modelId: this.modelId
3468
3539
  }),
3469
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3540
+ headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
3470
3541
  body: requestBody,
3471
3542
  failedResponseHandler: openaiFailedResponseHandler,
3472
- successfulResponseHandler: (0, import_provider_utils14.createBinaryResponseHandler)(),
3543
+ successfulResponseHandler: (0, import_provider_utils13.createBinaryResponseHandler)(),
3473
3544
  abortSignal: options.abortSignal,
3474
3545
  fetch: this.config.fetch
3475
3546
  });
@@ -3490,7 +3561,7 @@ var OpenAISpeechModel = class {
3490
3561
  };
3491
3562
 
3492
3563
  // src/transcription/openai-transcription-model.ts
3493
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3564
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
3494
3565
  var import_v417 = require("zod/v4");
3495
3566
 
3496
3567
  // src/transcription/openai-transcription-options.ts
@@ -3595,15 +3666,15 @@ var OpenAITranscriptionModel = class {
3595
3666
  providerOptions
3596
3667
  }) {
3597
3668
  const warnings = [];
3598
- const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3669
+ const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3599
3670
  provider: "openai",
3600
3671
  providerOptions,
3601
3672
  schema: openAITranscriptionProviderOptions
3602
3673
  });
3603
3674
  const formData = new FormData();
3604
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils15.convertBase64ToUint8Array)(audio)]);
3675
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils14.convertBase64ToUint8Array)(audio)]);
3605
3676
  formData.append("model", this.modelId);
3606
- const fileExtension = (0, import_provider_utils15.mediaTypeToExtension)(mediaType);
3677
+ const fileExtension = (0, import_provider_utils14.mediaTypeToExtension)(mediaType);
3607
3678
  formData.append(
3608
3679
  "file",
3609
3680
  new File([blob], "audio", { type: mediaType }),
@@ -3648,15 +3719,15 @@ var OpenAITranscriptionModel = class {
3648
3719
  value: response,
3649
3720
  responseHeaders,
3650
3721
  rawValue: rawResponse
3651
- } = await (0, import_provider_utils15.postFormDataToApi)({
3722
+ } = await (0, import_provider_utils14.postFormDataToApi)({
3652
3723
  url: this.config.url({
3653
3724
  path: "/audio/transcriptions",
3654
3725
  modelId: this.modelId
3655
3726
  }),
3656
- headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
3727
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3657
3728
  formData,
3658
3729
  failedResponseHandler: openaiFailedResponseHandler,
3659
- successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3730
+ successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
3660
3731
  openaiTranscriptionResponseSchema
3661
3732
  ),
3662
3733
  abortSignal: options.abortSignal,
@@ -3716,10 +3787,10 @@ var openaiTranscriptionResponseSchema = import_v417.z.object({
3716
3787
  // src/openai-provider.ts
3717
3788
  function createOpenAI(options = {}) {
3718
3789
  var _a, _b;
3719
- const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3790
+ const baseURL = (_a = (0, import_provider_utils15.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3720
3791
  const providerName = (_b = options.name) != null ? _b : "openai";
3721
3792
  const getHeaders = () => ({
3722
- Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
3793
+ Authorization: `Bearer ${(0, import_provider_utils15.loadApiKey)({
3723
3794
  apiKey: options.apiKey,
3724
3795
  environmentVariableName: "OPENAI_API_KEY",
3725
3796
  description: "OpenAI"