@ai-sdk/openai 2.0.24 → 2.0.26

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
@@ -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_utils15 = require("@ai-sdk/provider-utils");
29
+ var import_provider_utils16 = 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");
@@ -1825,23 +1825,65 @@ var codeInterpreter = (0, import_provider_utils9.createProviderDefinedToolFactor
1825
1825
  inputSchema: import_v411.z.object({})
1826
1826
  });
1827
1827
 
1828
+ // src/tool/web-search.ts
1829
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1830
+ var import_v412 = require("zod/v4");
1831
+ var webSearchArgsSchema = import_v412.z.object({
1832
+ filters: import_v412.z.object({
1833
+ allowedDomains: import_v412.z.array(import_v412.z.string()).optional()
1834
+ }).optional(),
1835
+ searchContextSize: import_v412.z.enum(["low", "medium", "high"]).optional(),
1836
+ userLocation: import_v412.z.object({
1837
+ type: import_v412.z.literal("approximate"),
1838
+ country: import_v412.z.string().optional(),
1839
+ city: import_v412.z.string().optional(),
1840
+ region: import_v412.z.string().optional(),
1841
+ timezone: import_v412.z.string().optional()
1842
+ }).optional()
1843
+ });
1844
+ var factory = (0, import_provider_utils10.createProviderDefinedToolFactory)({
1845
+ id: "openai.web_search",
1846
+ name: "web_search",
1847
+ inputSchema: import_v412.z.object({
1848
+ action: import_v412.z.discriminatedUnion("type", [
1849
+ import_v412.z.object({
1850
+ type: import_v412.z.literal("search"),
1851
+ query: import_v412.z.string().nullish()
1852
+ }),
1853
+ import_v412.z.object({
1854
+ type: import_v412.z.literal("open_page"),
1855
+ url: import_v412.z.string()
1856
+ }),
1857
+ import_v412.z.object({
1858
+ type: import_v412.z.literal("find"),
1859
+ url: import_v412.z.string(),
1860
+ pattern: import_v412.z.string()
1861
+ })
1862
+ ]).nullish()
1863
+ })
1864
+ });
1865
+ var webSearch = (args = {}) => {
1866
+ return factory(args);
1867
+ };
1868
+
1828
1869
  // src/openai-tools.ts
1829
1870
  var openaiTools = {
1830
1871
  codeInterpreter,
1831
1872
  fileSearch,
1832
- webSearchPreview
1873
+ webSearchPreview,
1874
+ webSearch
1833
1875
  };
1834
1876
 
1835
1877
  // src/responses/openai-responses-language-model.ts
1836
1878
  var import_provider8 = require("@ai-sdk/provider");
1837
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
1838
- var import_v413 = require("zod/v4");
1879
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
1880
+ var import_v414 = require("zod/v4");
1839
1881
 
1840
1882
  // src/responses/convert-to-openai-responses-messages.ts
1841
1883
  var import_provider6 = require("@ai-sdk/provider");
1842
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1843
- var import_v412 = require("zod/v4");
1844
1884
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
1885
+ var import_v413 = require("zod/v4");
1886
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1845
1887
  function isFileId(data, prefixes) {
1846
1888
  if (!prefixes) return false;
1847
1889
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -1897,7 +1939,7 @@ async function convertToOpenAIResponsesMessages({
1897
1939
  return {
1898
1940
  type: "input_image",
1899
1941
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
1900
- image_url: `data:${mediaType};base64,${(0, import_provider_utils11.convertToBase64)(part.data)}`
1942
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
1901
1943
  },
1902
1944
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
1903
1945
  };
@@ -1912,7 +1954,7 @@ async function convertToOpenAIResponsesMessages({
1912
1954
  type: "input_file",
1913
1955
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
1914
1956
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
1915
- file_data: `data:application/pdf;base64,${(0, import_provider_utils11.convertToBase64)(part.data)}`
1957
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils12.convertToBase64)(part.data)}`
1916
1958
  }
1917
1959
  };
1918
1960
  } else {
@@ -1959,7 +2001,7 @@ async function convertToOpenAIResponsesMessages({
1959
2001
  break;
1960
2002
  }
1961
2003
  case "reasoning": {
1962
- const providerOptions = await (0, import_provider_utils10.parseProviderOptions)({
2004
+ const providerOptions = await (0, import_provider_utils11.parseProviderOptions)({
1963
2005
  provider: "openai",
1964
2006
  providerOptions: part.providerOptions,
1965
2007
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2030,26 +2072,26 @@ async function convertToOpenAIResponsesMessages({
2030
2072
  }
2031
2073
  return { messages, warnings };
2032
2074
  }
2033
- var openaiResponsesReasoningProviderOptionsSchema = import_v412.z.object({
2034
- itemId: import_v412.z.string().nullish(),
2035
- reasoningEncryptedContent: import_v412.z.string().nullish()
2075
+ var openaiResponsesReasoningProviderOptionsSchema = import_v413.z.object({
2076
+ itemId: import_v413.z.string().nullish(),
2077
+ reasoningEncryptedContent: import_v413.z.string().nullish()
2036
2078
  });
2037
2079
 
2038
2080
  // src/responses/map-openai-responses-finish-reason.ts
2039
2081
  function mapOpenAIResponseFinishReason({
2040
2082
  finishReason,
2041
- hasToolCalls
2083
+ hasFunctionCall
2042
2084
  }) {
2043
2085
  switch (finishReason) {
2044
2086
  case void 0:
2045
2087
  case null:
2046
- return hasToolCalls ? "tool-calls" : "stop";
2088
+ return hasFunctionCall ? "tool-calls" : "stop";
2047
2089
  case "max_output_tokens":
2048
2090
  return "length";
2049
2091
  case "content_filter":
2050
2092
  return "content-filter";
2051
2093
  default:
2052
- return hasToolCalls ? "tool-calls" : "unknown";
2094
+ return hasFunctionCall ? "tool-calls" : "unknown";
2053
2095
  }
2054
2096
  }
2055
2097
 
@@ -2099,6 +2141,16 @@ function prepareResponsesTools({
2099
2141
  });
2100
2142
  break;
2101
2143
  }
2144
+ case "openai.web_search": {
2145
+ const args = webSearchArgsSchema.parse(tool.args);
2146
+ openaiTools2.push({
2147
+ type: "web_search",
2148
+ filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
2149
+ search_context_size: args.searchContextSize,
2150
+ user_location: args.userLocation
2151
+ });
2152
+ break;
2153
+ }
2102
2154
  case "openai.code_interpreter": {
2103
2155
  const args = codeInterpreterArgsSchema.parse(tool.args);
2104
2156
  openaiTools2.push({
@@ -2131,7 +2183,7 @@ function prepareResponsesTools({
2131
2183
  case "tool":
2132
2184
  return {
2133
2185
  tools: openaiTools2,
2134
- toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
2186
+ toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
2135
2187
  toolWarnings
2136
2188
  };
2137
2189
  default: {
@@ -2144,35 +2196,35 @@ function prepareResponsesTools({
2144
2196
  }
2145
2197
 
2146
2198
  // src/responses/openai-responses-language-model.ts
2147
- var webSearchCallItem = import_v413.z.object({
2148
- type: import_v413.z.literal("web_search_call"),
2149
- id: import_v413.z.string(),
2150
- status: import_v413.z.string(),
2151
- action: import_v413.z.discriminatedUnion("type", [
2152
- import_v413.z.object({
2153
- type: import_v413.z.literal("search"),
2154
- query: import_v413.z.string().nullish()
2199
+ var webSearchCallItem = import_v414.z.object({
2200
+ type: import_v414.z.literal("web_search_call"),
2201
+ id: import_v414.z.string(),
2202
+ status: import_v414.z.string(),
2203
+ action: import_v414.z.discriminatedUnion("type", [
2204
+ import_v414.z.object({
2205
+ type: import_v414.z.literal("search"),
2206
+ query: import_v414.z.string().nullish()
2155
2207
  }),
2156
- import_v413.z.object({
2157
- type: import_v413.z.literal("open_page"),
2158
- url: import_v413.z.string()
2208
+ import_v414.z.object({
2209
+ type: import_v414.z.literal("open_page"),
2210
+ url: import_v414.z.string()
2159
2211
  }),
2160
- import_v413.z.object({
2161
- type: import_v413.z.literal("find"),
2162
- url: import_v413.z.string(),
2163
- pattern: import_v413.z.string()
2212
+ import_v414.z.object({
2213
+ type: import_v414.z.literal("find"),
2214
+ url: import_v414.z.string(),
2215
+ pattern: import_v414.z.string()
2164
2216
  })
2165
2217
  ]).nullish()
2166
2218
  });
2167
2219
  var TOP_LOGPROBS_MAX = 20;
2168
- var LOGPROBS_SCHEMA = import_v413.z.array(
2169
- import_v413.z.object({
2170
- token: import_v413.z.string(),
2171
- logprob: import_v413.z.number(),
2172
- top_logprobs: import_v413.z.array(
2173
- import_v413.z.object({
2174
- token: import_v413.z.string(),
2175
- logprob: import_v413.z.number()
2220
+ var LOGPROBS_SCHEMA = import_v414.z.array(
2221
+ import_v414.z.object({
2222
+ token: import_v414.z.string(),
2223
+ logprob: import_v414.z.number(),
2224
+ top_logprobs: import_v414.z.array(
2225
+ import_v414.z.object({
2226
+ token: import_v414.z.string(),
2227
+ logprob: import_v414.z.number()
2176
2228
  })
2177
2229
  )
2178
2230
  })
@@ -2235,7 +2287,7 @@ var OpenAIResponsesLanguageModel = class {
2235
2287
  fileIdPrefixes: this.config.fileIdPrefixes
2236
2288
  });
2237
2289
  warnings.push(...messageWarnings);
2238
- const openaiOptions = await (0, import_provider_utils12.parseProviderOptions)({
2290
+ const openaiOptions = await (0, import_provider_utils13.parseProviderOptions)({
2239
2291
  provider: "openai",
2240
2292
  providerOptions,
2241
2293
  schema: openaiResponsesProviderOptionsSchema
@@ -2370,98 +2422,98 @@ var OpenAIResponsesLanguageModel = class {
2370
2422
  responseHeaders,
2371
2423
  value: response,
2372
2424
  rawValue: rawResponse
2373
- } = await (0, import_provider_utils12.postJsonToApi)({
2425
+ } = await (0, import_provider_utils13.postJsonToApi)({
2374
2426
  url,
2375
- headers: (0, import_provider_utils12.combineHeaders)(this.config.headers(), options.headers),
2427
+ headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2376
2428
  body,
2377
2429
  failedResponseHandler: openaiFailedResponseHandler,
2378
- successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
2379
- import_v413.z.object({
2380
- id: import_v413.z.string(),
2381
- created_at: import_v413.z.number(),
2382
- error: import_v413.z.object({
2383
- code: import_v413.z.string(),
2384
- message: import_v413.z.string()
2430
+ successfulResponseHandler: (0, import_provider_utils13.createJsonResponseHandler)(
2431
+ import_v414.z.object({
2432
+ id: import_v414.z.string(),
2433
+ created_at: import_v414.z.number(),
2434
+ error: import_v414.z.object({
2435
+ code: import_v414.z.string(),
2436
+ message: import_v414.z.string()
2385
2437
  }).nullish(),
2386
- model: import_v413.z.string(),
2387
- output: import_v413.z.array(
2388
- import_v413.z.discriminatedUnion("type", [
2389
- import_v413.z.object({
2390
- type: import_v413.z.literal("message"),
2391
- role: import_v413.z.literal("assistant"),
2392
- id: import_v413.z.string(),
2393
- content: import_v413.z.array(
2394
- import_v413.z.object({
2395
- type: import_v413.z.literal("output_text"),
2396
- text: import_v413.z.string(),
2438
+ model: import_v414.z.string(),
2439
+ output: import_v414.z.array(
2440
+ import_v414.z.discriminatedUnion("type", [
2441
+ import_v414.z.object({
2442
+ type: import_v414.z.literal("message"),
2443
+ role: import_v414.z.literal("assistant"),
2444
+ id: import_v414.z.string(),
2445
+ content: import_v414.z.array(
2446
+ import_v414.z.object({
2447
+ type: import_v414.z.literal("output_text"),
2448
+ text: import_v414.z.string(),
2397
2449
  logprobs: LOGPROBS_SCHEMA.nullish(),
2398
- annotations: import_v413.z.array(
2399
- import_v413.z.discriminatedUnion("type", [
2400
- import_v413.z.object({
2401
- type: import_v413.z.literal("url_citation"),
2402
- start_index: import_v413.z.number(),
2403
- end_index: import_v413.z.number(),
2404
- url: import_v413.z.string(),
2405
- title: import_v413.z.string()
2450
+ annotations: import_v414.z.array(
2451
+ import_v414.z.discriminatedUnion("type", [
2452
+ import_v414.z.object({
2453
+ type: import_v414.z.literal("url_citation"),
2454
+ start_index: import_v414.z.number(),
2455
+ end_index: import_v414.z.number(),
2456
+ url: import_v414.z.string(),
2457
+ title: import_v414.z.string()
2406
2458
  }),
2407
- import_v413.z.object({
2408
- type: import_v413.z.literal("file_citation"),
2409
- file_id: import_v413.z.string(),
2410
- filename: import_v413.z.string().nullish(),
2411
- index: import_v413.z.number().nullish(),
2412
- start_index: import_v413.z.number().nullish(),
2413
- end_index: import_v413.z.number().nullish(),
2414
- quote: import_v413.z.string().nullish()
2459
+ import_v414.z.object({
2460
+ type: import_v414.z.literal("file_citation"),
2461
+ file_id: import_v414.z.string(),
2462
+ filename: import_v414.z.string().nullish(),
2463
+ index: import_v414.z.number().nullish(),
2464
+ start_index: import_v414.z.number().nullish(),
2465
+ end_index: import_v414.z.number().nullish(),
2466
+ quote: import_v414.z.string().nullish()
2415
2467
  })
2416
2468
  ])
2417
2469
  )
2418
2470
  })
2419
2471
  )
2420
2472
  }),
2421
- import_v413.z.object({
2422
- type: import_v413.z.literal("function_call"),
2423
- call_id: import_v413.z.string(),
2424
- name: import_v413.z.string(),
2425
- arguments: import_v413.z.string(),
2426
- id: import_v413.z.string()
2473
+ import_v414.z.object({
2474
+ type: import_v414.z.literal("function_call"),
2475
+ call_id: import_v414.z.string(),
2476
+ name: import_v414.z.string(),
2477
+ arguments: import_v414.z.string(),
2478
+ id: import_v414.z.string()
2427
2479
  }),
2428
2480
  webSearchCallItem,
2429
- import_v413.z.object({
2430
- type: import_v413.z.literal("computer_call"),
2431
- id: import_v413.z.string(),
2432
- status: import_v413.z.string().optional()
2481
+ import_v414.z.object({
2482
+ type: import_v414.z.literal("computer_call"),
2483
+ id: import_v414.z.string(),
2484
+ status: import_v414.z.string().optional()
2433
2485
  }),
2434
- import_v413.z.object({
2435
- type: import_v413.z.literal("file_search_call"),
2436
- id: import_v413.z.string(),
2437
- status: import_v413.z.string().optional(),
2438
- queries: import_v413.z.array(import_v413.z.string()).nullish(),
2439
- results: import_v413.z.array(
2440
- import_v413.z.object({
2441
- attributes: import_v413.z.object({
2442
- file_id: import_v413.z.string(),
2443
- filename: import_v413.z.string(),
2444
- score: import_v413.z.number(),
2445
- text: import_v413.z.string()
2486
+ import_v414.z.object({
2487
+ type: import_v414.z.literal("file_search_call"),
2488
+ id: import_v414.z.string(),
2489
+ status: import_v414.z.string().optional(),
2490
+ queries: import_v414.z.array(import_v414.z.string()).nullish(),
2491
+ results: import_v414.z.array(
2492
+ import_v414.z.object({
2493
+ attributes: import_v414.z.object({
2494
+ file_id: import_v414.z.string(),
2495
+ filename: import_v414.z.string(),
2496
+ score: import_v414.z.number(),
2497
+ text: import_v414.z.string()
2446
2498
  })
2447
2499
  })
2448
2500
  ).nullish()
2449
2501
  }),
2450
- import_v413.z.object({
2451
- type: import_v413.z.literal("reasoning"),
2452
- id: import_v413.z.string(),
2453
- encrypted_content: import_v413.z.string().nullish(),
2454
- summary: import_v413.z.array(
2455
- import_v413.z.object({
2456
- type: import_v413.z.literal("summary_text"),
2457
- text: import_v413.z.string()
2502
+ import_v414.z.object({
2503
+ type: import_v414.z.literal("reasoning"),
2504
+ id: import_v414.z.string(),
2505
+ encrypted_content: import_v414.z.string().nullish(),
2506
+ summary: import_v414.z.array(
2507
+ import_v414.z.object({
2508
+ type: import_v414.z.literal("summary_text"),
2509
+ text: import_v414.z.string()
2458
2510
  })
2459
2511
  )
2460
2512
  })
2461
2513
  ])
2462
2514
  ),
2463
- service_tier: import_v413.z.string().nullish(),
2464
- incomplete_details: import_v413.z.object({ reason: import_v413.z.string() }).nullable(),
2515
+ service_tier: import_v414.z.string().nullish(),
2516
+ incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullable(),
2465
2517
  usage: usageSchema2
2466
2518
  })
2467
2519
  ),
@@ -2481,6 +2533,7 @@ var OpenAIResponsesLanguageModel = class {
2481
2533
  }
2482
2534
  const content = [];
2483
2535
  const logprobs = [];
2536
+ let hasFunctionCall = false;
2484
2537
  for (const part of response.output) {
2485
2538
  switch (part.type) {
2486
2539
  case "reasoning": {
@@ -2520,7 +2573,7 @@ var OpenAIResponsesLanguageModel = class {
2520
2573
  content.push({
2521
2574
  type: "source",
2522
2575
  sourceType: "url",
2523
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils12.generateId)(),
2576
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils13.generateId)(),
2524
2577
  url: annotation.url,
2525
2578
  title: annotation.title
2526
2579
  });
@@ -2528,7 +2581,7 @@ var OpenAIResponsesLanguageModel = class {
2528
2581
  content.push({
2529
2582
  type: "source",
2530
2583
  sourceType: "document",
2531
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils12.generateId)(),
2584
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils13.generateId)(),
2532
2585
  mediaType: "text/plain",
2533
2586
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
2534
2587
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id
@@ -2539,6 +2592,7 @@ var OpenAIResponsesLanguageModel = class {
2539
2592
  break;
2540
2593
  }
2541
2594
  case "function_call": {
2595
+ hasFunctionCall = true;
2542
2596
  content.push({
2543
2597
  type: "tool-call",
2544
2598
  toolCallId: part.call_id,
@@ -2626,7 +2680,7 @@ var OpenAIResponsesLanguageModel = class {
2626
2680
  content,
2627
2681
  finishReason: mapOpenAIResponseFinishReason({
2628
2682
  finishReason: (_m = response.incomplete_details) == null ? void 0 : _m.reason,
2629
- hasToolCalls: content.some((part) => part.type === "tool-call")
2683
+ hasFunctionCall
2630
2684
  }),
2631
2685
  usage: {
2632
2686
  inputTokens: response.usage.input_tokens,
@@ -2649,18 +2703,18 @@ var OpenAIResponsesLanguageModel = class {
2649
2703
  }
2650
2704
  async doStream(options) {
2651
2705
  const { args: body, warnings } = await this.getArgs(options);
2652
- const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
2706
+ const { responseHeaders, value: response } = await (0, import_provider_utils13.postJsonToApi)({
2653
2707
  url: this.config.url({
2654
2708
  path: "/responses",
2655
2709
  modelId: this.modelId
2656
2710
  }),
2657
- headers: (0, import_provider_utils12.combineHeaders)(this.config.headers(), options.headers),
2711
+ headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
2658
2712
  body: {
2659
2713
  ...body,
2660
2714
  stream: true
2661
2715
  },
2662
2716
  failedResponseHandler: openaiFailedResponseHandler,
2663
- successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
2717
+ successfulResponseHandler: (0, import_provider_utils13.createEventSourceResponseHandler)(
2664
2718
  openaiResponsesChunkSchema
2665
2719
  ),
2666
2720
  abortSignal: options.abortSignal,
@@ -2676,7 +2730,7 @@ var OpenAIResponsesLanguageModel = class {
2676
2730
  const logprobs = [];
2677
2731
  let responseId = null;
2678
2732
  const ongoingToolCalls = {};
2679
- let hasToolCalls = false;
2733
+ let hasFunctionCall = false;
2680
2734
  const activeReasoning = {};
2681
2735
  let serviceTier;
2682
2736
  return {
@@ -2766,7 +2820,7 @@ var OpenAIResponsesLanguageModel = class {
2766
2820
  } else if (isResponseOutputItemDoneChunk(value)) {
2767
2821
  if (value.item.type === "function_call") {
2768
2822
  ongoingToolCalls[value.output_index] = void 0;
2769
- hasToolCalls = true;
2823
+ hasFunctionCall = true;
2770
2824
  controller.enqueue({
2771
2825
  type: "tool-input-end",
2772
2826
  id: value.item.call_id
@@ -2784,7 +2838,6 @@ var OpenAIResponsesLanguageModel = class {
2784
2838
  });
2785
2839
  } else if (value.item.type === "web_search_call") {
2786
2840
  ongoingToolCalls[value.output_index] = void 0;
2787
- hasToolCalls = true;
2788
2841
  controller.enqueue({
2789
2842
  type: "tool-input-end",
2790
2843
  id: value.item.id
@@ -2792,20 +2845,19 @@ var OpenAIResponsesLanguageModel = class {
2792
2845
  controller.enqueue({
2793
2846
  type: "tool-call",
2794
2847
  toolCallId: value.item.id,
2795
- toolName: "web_search_preview",
2848
+ toolName: "web_search",
2796
2849
  input: JSON.stringify({ action: value.item.action }),
2797
2850
  providerExecuted: true
2798
2851
  });
2799
2852
  controller.enqueue({
2800
2853
  type: "tool-result",
2801
2854
  toolCallId: value.item.id,
2802
- toolName: "web_search_preview",
2855
+ toolName: "web_search",
2803
2856
  result: { status: value.item.status },
2804
2857
  providerExecuted: true
2805
2858
  });
2806
2859
  } else if (value.item.type === "computer_call") {
2807
2860
  ongoingToolCalls[value.output_index] = void 0;
2808
- hasToolCalls = true;
2809
2861
  controller.enqueue({
2810
2862
  type: "tool-input-end",
2811
2863
  id: value.item.id
@@ -2829,7 +2881,6 @@ var OpenAIResponsesLanguageModel = class {
2829
2881
  });
2830
2882
  } else if (value.item.type === "file_search_call") {
2831
2883
  ongoingToolCalls[value.output_index] = void 0;
2832
- hasToolCalls = true;
2833
2884
  controller.enqueue({
2834
2885
  type: "tool-input-end",
2835
2886
  id: value.item.id
@@ -2930,7 +2981,7 @@ var OpenAIResponsesLanguageModel = class {
2930
2981
  } else if (isResponseFinishedChunk(value)) {
2931
2982
  finishReason = mapOpenAIResponseFinishReason({
2932
2983
  finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
2933
- hasToolCalls
2984
+ hasFunctionCall
2934
2985
  });
2935
2986
  usage.inputTokens = value.response.usage.input_tokens;
2936
2987
  usage.outputTokens = value.response.usage.output_tokens;
@@ -2945,7 +2996,7 @@ var OpenAIResponsesLanguageModel = class {
2945
2996
  controller.enqueue({
2946
2997
  type: "source",
2947
2998
  sourceType: "url",
2948
- id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils12.generateId)(),
2999
+ id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils13.generateId)(),
2949
3000
  url: value.annotation.url,
2950
3001
  title: value.annotation.title
2951
3002
  });
@@ -2953,7 +3004,7 @@ var OpenAIResponsesLanguageModel = class {
2953
3004
  controller.enqueue({
2954
3005
  type: "source",
2955
3006
  sourceType: "document",
2956
- id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils12.generateId)(),
3007
+ id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils13.generateId)(),
2957
3008
  mediaType: "text/plain",
2958
3009
  title: (_t = (_s = value.annotation.quote) != null ? _s : value.annotation.filename) != null ? _t : "Document",
2959
3010
  filename: (_u = value.annotation.filename) != null ? _u : value.annotation.file_id
@@ -2989,176 +3040,176 @@ var OpenAIResponsesLanguageModel = class {
2989
3040
  };
2990
3041
  }
2991
3042
  };
2992
- var usageSchema2 = import_v413.z.object({
2993
- input_tokens: import_v413.z.number(),
2994
- input_tokens_details: import_v413.z.object({ cached_tokens: import_v413.z.number().nullish() }).nullish(),
2995
- output_tokens: import_v413.z.number(),
2996
- output_tokens_details: import_v413.z.object({ reasoning_tokens: import_v413.z.number().nullish() }).nullish()
3043
+ var usageSchema2 = import_v414.z.object({
3044
+ input_tokens: import_v414.z.number(),
3045
+ input_tokens_details: import_v414.z.object({ cached_tokens: import_v414.z.number().nullish() }).nullish(),
3046
+ output_tokens: import_v414.z.number(),
3047
+ output_tokens_details: import_v414.z.object({ reasoning_tokens: import_v414.z.number().nullish() }).nullish()
2997
3048
  });
2998
- var textDeltaChunkSchema = import_v413.z.object({
2999
- type: import_v413.z.literal("response.output_text.delta"),
3000
- item_id: import_v413.z.string(),
3001
- delta: import_v413.z.string(),
3049
+ var textDeltaChunkSchema = import_v414.z.object({
3050
+ type: import_v414.z.literal("response.output_text.delta"),
3051
+ item_id: import_v414.z.string(),
3052
+ delta: import_v414.z.string(),
3002
3053
  logprobs: LOGPROBS_SCHEMA.nullish()
3003
3054
  });
3004
- var errorChunkSchema = import_v413.z.object({
3005
- type: import_v413.z.literal("error"),
3006
- code: import_v413.z.string(),
3007
- message: import_v413.z.string(),
3008
- param: import_v413.z.string().nullish(),
3009
- sequence_number: import_v413.z.number()
3055
+ var errorChunkSchema = import_v414.z.object({
3056
+ type: import_v414.z.literal("error"),
3057
+ code: import_v414.z.string(),
3058
+ message: import_v414.z.string(),
3059
+ param: import_v414.z.string().nullish(),
3060
+ sequence_number: import_v414.z.number()
3010
3061
  });
3011
- var responseFinishedChunkSchema = import_v413.z.object({
3012
- type: import_v413.z.enum(["response.completed", "response.incomplete"]),
3013
- response: import_v413.z.object({
3014
- incomplete_details: import_v413.z.object({ reason: import_v413.z.string() }).nullish(),
3062
+ var responseFinishedChunkSchema = import_v414.z.object({
3063
+ type: import_v414.z.enum(["response.completed", "response.incomplete"]),
3064
+ response: import_v414.z.object({
3065
+ incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullish(),
3015
3066
  usage: usageSchema2,
3016
- service_tier: import_v413.z.string().nullish()
3067
+ service_tier: import_v414.z.string().nullish()
3017
3068
  })
3018
3069
  });
3019
- var responseCreatedChunkSchema = import_v413.z.object({
3020
- type: import_v413.z.literal("response.created"),
3021
- response: import_v413.z.object({
3022
- id: import_v413.z.string(),
3023
- created_at: import_v413.z.number(),
3024
- model: import_v413.z.string(),
3025
- service_tier: import_v413.z.string().nullish()
3070
+ var responseCreatedChunkSchema = import_v414.z.object({
3071
+ type: import_v414.z.literal("response.created"),
3072
+ response: import_v414.z.object({
3073
+ id: import_v414.z.string(),
3074
+ created_at: import_v414.z.number(),
3075
+ model: import_v414.z.string(),
3076
+ service_tier: import_v414.z.string().nullish()
3026
3077
  })
3027
3078
  });
3028
- var responseOutputItemAddedSchema = import_v413.z.object({
3029
- type: import_v413.z.literal("response.output_item.added"),
3030
- output_index: import_v413.z.number(),
3031
- item: import_v413.z.discriminatedUnion("type", [
3032
- import_v413.z.object({
3033
- type: import_v413.z.literal("message"),
3034
- id: import_v413.z.string()
3079
+ var responseOutputItemAddedSchema = import_v414.z.object({
3080
+ type: import_v414.z.literal("response.output_item.added"),
3081
+ output_index: import_v414.z.number(),
3082
+ item: import_v414.z.discriminatedUnion("type", [
3083
+ import_v414.z.object({
3084
+ type: import_v414.z.literal("message"),
3085
+ id: import_v414.z.string()
3035
3086
  }),
3036
- import_v413.z.object({
3037
- type: import_v413.z.literal("reasoning"),
3038
- id: import_v413.z.string(),
3039
- encrypted_content: import_v413.z.string().nullish()
3087
+ import_v414.z.object({
3088
+ type: import_v414.z.literal("reasoning"),
3089
+ id: import_v414.z.string(),
3090
+ encrypted_content: import_v414.z.string().nullish()
3040
3091
  }),
3041
- import_v413.z.object({
3042
- type: import_v413.z.literal("function_call"),
3043
- id: import_v413.z.string(),
3044
- call_id: import_v413.z.string(),
3045
- name: import_v413.z.string(),
3046
- arguments: import_v413.z.string()
3092
+ import_v414.z.object({
3093
+ type: import_v414.z.literal("function_call"),
3094
+ id: import_v414.z.string(),
3095
+ call_id: import_v414.z.string(),
3096
+ name: import_v414.z.string(),
3097
+ arguments: import_v414.z.string()
3047
3098
  }),
3048
- import_v413.z.object({
3049
- type: import_v413.z.literal("web_search_call"),
3050
- id: import_v413.z.string(),
3051
- status: import_v413.z.string(),
3052
- action: import_v413.z.object({
3053
- type: import_v413.z.literal("search"),
3054
- query: import_v413.z.string().optional()
3099
+ import_v414.z.object({
3100
+ type: import_v414.z.literal("web_search_call"),
3101
+ id: import_v414.z.string(),
3102
+ status: import_v414.z.string(),
3103
+ action: import_v414.z.object({
3104
+ type: import_v414.z.literal("search"),
3105
+ query: import_v414.z.string().optional()
3055
3106
  }).nullish()
3056
3107
  }),
3057
- import_v413.z.object({
3058
- type: import_v413.z.literal("computer_call"),
3059
- id: import_v413.z.string(),
3060
- status: import_v413.z.string()
3108
+ import_v414.z.object({
3109
+ type: import_v414.z.literal("computer_call"),
3110
+ id: import_v414.z.string(),
3111
+ status: import_v414.z.string()
3061
3112
  }),
3062
- import_v413.z.object({
3063
- type: import_v413.z.literal("file_search_call"),
3064
- id: import_v413.z.string(),
3065
- status: import_v413.z.string(),
3066
- queries: import_v413.z.array(import_v413.z.string()).nullish(),
3067
- results: import_v413.z.array(
3068
- import_v413.z.object({
3069
- attributes: import_v413.z.object({
3070
- file_id: import_v413.z.string(),
3071
- filename: import_v413.z.string(),
3072
- score: import_v413.z.number(),
3073
- text: import_v413.z.string()
3113
+ import_v414.z.object({
3114
+ type: import_v414.z.literal("file_search_call"),
3115
+ id: import_v414.z.string(),
3116
+ status: import_v414.z.string(),
3117
+ queries: import_v414.z.array(import_v414.z.string()).nullish(),
3118
+ results: import_v414.z.array(
3119
+ import_v414.z.object({
3120
+ attributes: import_v414.z.object({
3121
+ file_id: import_v414.z.string(),
3122
+ filename: import_v414.z.string(),
3123
+ score: import_v414.z.number(),
3124
+ text: import_v414.z.string()
3074
3125
  })
3075
3126
  })
3076
3127
  ).optional()
3077
3128
  })
3078
3129
  ])
3079
3130
  });
3080
- var responseOutputItemDoneSchema = import_v413.z.object({
3081
- type: import_v413.z.literal("response.output_item.done"),
3082
- output_index: import_v413.z.number(),
3083
- item: import_v413.z.discriminatedUnion("type", [
3084
- import_v413.z.object({
3085
- type: import_v413.z.literal("message"),
3086
- id: import_v413.z.string()
3131
+ var responseOutputItemDoneSchema = import_v414.z.object({
3132
+ type: import_v414.z.literal("response.output_item.done"),
3133
+ output_index: import_v414.z.number(),
3134
+ item: import_v414.z.discriminatedUnion("type", [
3135
+ import_v414.z.object({
3136
+ type: import_v414.z.literal("message"),
3137
+ id: import_v414.z.string()
3087
3138
  }),
3088
- import_v413.z.object({
3089
- type: import_v413.z.literal("reasoning"),
3090
- id: import_v413.z.string(),
3091
- encrypted_content: import_v413.z.string().nullish()
3139
+ import_v414.z.object({
3140
+ type: import_v414.z.literal("reasoning"),
3141
+ id: import_v414.z.string(),
3142
+ encrypted_content: import_v414.z.string().nullish()
3092
3143
  }),
3093
- import_v413.z.object({
3094
- type: import_v413.z.literal("function_call"),
3095
- id: import_v413.z.string(),
3096
- call_id: import_v413.z.string(),
3097
- name: import_v413.z.string(),
3098
- arguments: import_v413.z.string(),
3099
- status: import_v413.z.literal("completed")
3144
+ import_v414.z.object({
3145
+ type: import_v414.z.literal("function_call"),
3146
+ id: import_v414.z.string(),
3147
+ call_id: import_v414.z.string(),
3148
+ name: import_v414.z.string(),
3149
+ arguments: import_v414.z.string(),
3150
+ status: import_v414.z.literal("completed")
3100
3151
  }),
3101
3152
  webSearchCallItem,
3102
- import_v413.z.object({
3103
- type: import_v413.z.literal("computer_call"),
3104
- id: import_v413.z.string(),
3105
- status: import_v413.z.literal("completed")
3153
+ import_v414.z.object({
3154
+ type: import_v414.z.literal("computer_call"),
3155
+ id: import_v414.z.string(),
3156
+ status: import_v414.z.literal("completed")
3106
3157
  }),
3107
- import_v413.z.object({
3108
- type: import_v413.z.literal("file_search_call"),
3109
- id: import_v413.z.string(),
3110
- status: import_v413.z.literal("completed"),
3111
- queries: import_v413.z.array(import_v413.z.string()).nullish(),
3112
- results: import_v413.z.array(
3113
- import_v413.z.object({
3114
- attributes: import_v413.z.object({
3115
- file_id: import_v413.z.string(),
3116
- filename: import_v413.z.string(),
3117
- score: import_v413.z.number(),
3118
- text: import_v413.z.string()
3158
+ import_v414.z.object({
3159
+ type: import_v414.z.literal("file_search_call"),
3160
+ id: import_v414.z.string(),
3161
+ status: import_v414.z.literal("completed"),
3162
+ queries: import_v414.z.array(import_v414.z.string()).nullish(),
3163
+ results: import_v414.z.array(
3164
+ import_v414.z.object({
3165
+ attributes: import_v414.z.object({
3166
+ file_id: import_v414.z.string(),
3167
+ filename: import_v414.z.string(),
3168
+ score: import_v414.z.number(),
3169
+ text: import_v414.z.string()
3119
3170
  })
3120
3171
  })
3121
3172
  ).nullish()
3122
3173
  })
3123
3174
  ])
3124
3175
  });
3125
- var responseFunctionCallArgumentsDeltaSchema = import_v413.z.object({
3126
- type: import_v413.z.literal("response.function_call_arguments.delta"),
3127
- item_id: import_v413.z.string(),
3128
- output_index: import_v413.z.number(),
3129
- delta: import_v413.z.string()
3176
+ var responseFunctionCallArgumentsDeltaSchema = import_v414.z.object({
3177
+ type: import_v414.z.literal("response.function_call_arguments.delta"),
3178
+ item_id: import_v414.z.string(),
3179
+ output_index: import_v414.z.number(),
3180
+ delta: import_v414.z.string()
3130
3181
  });
3131
- var responseAnnotationAddedSchema = import_v413.z.object({
3132
- type: import_v413.z.literal("response.output_text.annotation.added"),
3133
- annotation: import_v413.z.discriminatedUnion("type", [
3134
- import_v413.z.object({
3135
- type: import_v413.z.literal("url_citation"),
3136
- url: import_v413.z.string(),
3137
- title: import_v413.z.string()
3182
+ var responseAnnotationAddedSchema = import_v414.z.object({
3183
+ type: import_v414.z.literal("response.output_text.annotation.added"),
3184
+ annotation: import_v414.z.discriminatedUnion("type", [
3185
+ import_v414.z.object({
3186
+ type: import_v414.z.literal("url_citation"),
3187
+ url: import_v414.z.string(),
3188
+ title: import_v414.z.string()
3138
3189
  }),
3139
- import_v413.z.object({
3140
- type: import_v413.z.literal("file_citation"),
3141
- file_id: import_v413.z.string(),
3142
- filename: import_v413.z.string().nullish(),
3143
- index: import_v413.z.number().nullish(),
3144
- start_index: import_v413.z.number().nullish(),
3145
- end_index: import_v413.z.number().nullish(),
3146
- quote: import_v413.z.string().nullish()
3190
+ import_v414.z.object({
3191
+ type: import_v414.z.literal("file_citation"),
3192
+ file_id: import_v414.z.string(),
3193
+ filename: import_v414.z.string().nullish(),
3194
+ index: import_v414.z.number().nullish(),
3195
+ start_index: import_v414.z.number().nullish(),
3196
+ end_index: import_v414.z.number().nullish(),
3197
+ quote: import_v414.z.string().nullish()
3147
3198
  })
3148
3199
  ])
3149
3200
  });
3150
- var responseReasoningSummaryPartAddedSchema = import_v413.z.object({
3151
- type: import_v413.z.literal("response.reasoning_summary_part.added"),
3152
- item_id: import_v413.z.string(),
3153
- summary_index: import_v413.z.number()
3201
+ var responseReasoningSummaryPartAddedSchema = import_v414.z.object({
3202
+ type: import_v414.z.literal("response.reasoning_summary_part.added"),
3203
+ item_id: import_v414.z.string(),
3204
+ summary_index: import_v414.z.number()
3154
3205
  });
3155
- var responseReasoningSummaryTextDeltaSchema = import_v413.z.object({
3156
- type: import_v413.z.literal("response.reasoning_summary_text.delta"),
3157
- item_id: import_v413.z.string(),
3158
- summary_index: import_v413.z.number(),
3159
- delta: import_v413.z.string()
3206
+ var responseReasoningSummaryTextDeltaSchema = import_v414.z.object({
3207
+ type: import_v414.z.literal("response.reasoning_summary_text.delta"),
3208
+ item_id: import_v414.z.string(),
3209
+ summary_index: import_v414.z.number(),
3210
+ delta: import_v414.z.string()
3160
3211
  });
3161
- var openaiResponsesChunkSchema = import_v413.z.union([
3212
+ var openaiResponsesChunkSchema = import_v414.z.union([
3162
3213
  textDeltaChunkSchema,
3163
3214
  responseFinishedChunkSchema,
3164
3215
  responseCreatedChunkSchema,
@@ -3169,7 +3220,7 @@ var openaiResponsesChunkSchema = import_v413.z.union([
3169
3220
  responseReasoningSummaryPartAddedSchema,
3170
3221
  responseReasoningSummaryTextDeltaSchema,
3171
3222
  errorChunkSchema,
3172
- import_v413.z.object({ type: import_v413.z.string() }).loose()
3223
+ import_v414.z.object({ type: import_v414.z.string() }).loose()
3173
3224
  // fallback for unknown chunks
3174
3225
  ]);
3175
3226
  function isTextDeltaChunk(chunk) {
@@ -3242,27 +3293,27 @@ function getResponsesModelConfig(modelId) {
3242
3293
  isReasoningModel: false
3243
3294
  };
3244
3295
  }
3245
- var openaiResponsesProviderOptionsSchema = import_v413.z.object({
3246
- metadata: import_v413.z.any().nullish(),
3247
- parallelToolCalls: import_v413.z.boolean().nullish(),
3248
- previousResponseId: import_v413.z.string().nullish(),
3249
- store: import_v413.z.boolean().nullish(),
3250
- user: import_v413.z.string().nullish(),
3251
- reasoningEffort: import_v413.z.string().nullish(),
3252
- strictJsonSchema: import_v413.z.boolean().nullish(),
3253
- instructions: import_v413.z.string().nullish(),
3254
- reasoningSummary: import_v413.z.string().nullish(),
3255
- serviceTier: import_v413.z.enum(["auto", "flex", "priority"]).nullish(),
3256
- include: import_v413.z.array(
3257
- import_v413.z.enum([
3296
+ var openaiResponsesProviderOptionsSchema = import_v414.z.object({
3297
+ metadata: import_v414.z.any().nullish(),
3298
+ parallelToolCalls: import_v414.z.boolean().nullish(),
3299
+ previousResponseId: import_v414.z.string().nullish(),
3300
+ store: import_v414.z.boolean().nullish(),
3301
+ user: import_v414.z.string().nullish(),
3302
+ reasoningEffort: import_v414.z.string().nullish(),
3303
+ strictJsonSchema: import_v414.z.boolean().nullish(),
3304
+ instructions: import_v414.z.string().nullish(),
3305
+ reasoningSummary: import_v414.z.string().nullish(),
3306
+ serviceTier: import_v414.z.enum(["auto", "flex", "priority"]).nullish(),
3307
+ include: import_v414.z.array(
3308
+ import_v414.z.enum([
3258
3309
  "reasoning.encrypted_content",
3259
3310
  "file_search_call.results",
3260
3311
  "message.output_text.logprobs"
3261
3312
  ])
3262
3313
  ).nullish(),
3263
- textVerbosity: import_v413.z.enum(["low", "medium", "high"]).nullish(),
3264
- promptCacheKey: import_v413.z.string().nullish(),
3265
- safetyIdentifier: import_v413.z.string().nullish(),
3314
+ textVerbosity: import_v414.z.enum(["low", "medium", "high"]).nullish(),
3315
+ promptCacheKey: import_v414.z.string().nullish(),
3316
+ safetyIdentifier: import_v414.z.string().nullish(),
3266
3317
  /**
3267
3318
  * Return the log probabilities of the tokens.
3268
3319
  *
@@ -3275,15 +3326,15 @@ var openaiResponsesProviderOptionsSchema = import_v413.z.object({
3275
3326
  * @see https://platform.openai.com/docs/api-reference/responses/create
3276
3327
  * @see https://cookbook.openai.com/examples/using_logprobs
3277
3328
  */
3278
- logprobs: import_v413.z.union([import_v413.z.boolean(), import_v413.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3329
+ logprobs: import_v414.z.union([import_v414.z.boolean(), import_v414.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional()
3279
3330
  });
3280
3331
 
3281
3332
  // src/speech/openai-speech-model.ts
3282
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
3283
- var import_v414 = require("zod/v4");
3284
- var OpenAIProviderOptionsSchema = import_v414.z.object({
3285
- instructions: import_v414.z.string().nullish(),
3286
- speed: import_v414.z.number().min(0.25).max(4).default(1).nullish()
3333
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
3334
+ var import_v415 = require("zod/v4");
3335
+ var OpenAIProviderOptionsSchema = import_v415.z.object({
3336
+ instructions: import_v415.z.string().nullish(),
3337
+ speed: import_v415.z.number().min(0.25).max(4).default(1).nullish()
3287
3338
  });
3288
3339
  var OpenAISpeechModel = class {
3289
3340
  constructor(modelId, config) {
@@ -3304,7 +3355,7 @@ var OpenAISpeechModel = class {
3304
3355
  providerOptions
3305
3356
  }) {
3306
3357
  const warnings = [];
3307
- const openAIOptions = await (0, import_provider_utils13.parseProviderOptions)({
3358
+ const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3308
3359
  provider: "openai",
3309
3360
  providerOptions,
3310
3361
  schema: OpenAIProviderOptionsSchema
@@ -3357,15 +3408,15 @@ var OpenAISpeechModel = class {
3357
3408
  value: audio,
3358
3409
  responseHeaders,
3359
3410
  rawValue: rawResponse
3360
- } = await (0, import_provider_utils13.postJsonToApi)({
3411
+ } = await (0, import_provider_utils14.postJsonToApi)({
3361
3412
  url: this.config.url({
3362
3413
  path: "/audio/speech",
3363
3414
  modelId: this.modelId
3364
3415
  }),
3365
- headers: (0, import_provider_utils13.combineHeaders)(this.config.headers(), options.headers),
3416
+ headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3366
3417
  body: requestBody,
3367
3418
  failedResponseHandler: openaiFailedResponseHandler,
3368
- successfulResponseHandler: (0, import_provider_utils13.createBinaryResponseHandler)(),
3419
+ successfulResponseHandler: (0, import_provider_utils14.createBinaryResponseHandler)(),
3369
3420
  abortSignal: options.abortSignal,
3370
3421
  fetch: this.config.fetch
3371
3422
  });
@@ -3386,34 +3437,34 @@ var OpenAISpeechModel = class {
3386
3437
  };
3387
3438
 
3388
3439
  // src/transcription/openai-transcription-model.ts
3389
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3390
- var import_v416 = require("zod/v4");
3440
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3441
+ var import_v417 = require("zod/v4");
3391
3442
 
3392
3443
  // src/transcription/openai-transcription-options.ts
3393
- var import_v415 = require("zod/v4");
3394
- var openAITranscriptionProviderOptions = import_v415.z.object({
3444
+ var import_v416 = require("zod/v4");
3445
+ var openAITranscriptionProviderOptions = import_v416.z.object({
3395
3446
  /**
3396
3447
  * Additional information to include in the transcription response.
3397
3448
  */
3398
- include: import_v415.z.array(import_v415.z.string()).optional(),
3449
+ include: import_v416.z.array(import_v416.z.string()).optional(),
3399
3450
  /**
3400
3451
  * The language of the input audio in ISO-639-1 format.
3401
3452
  */
3402
- language: import_v415.z.string().optional(),
3453
+ language: import_v416.z.string().optional(),
3403
3454
  /**
3404
3455
  * An optional text to guide the model's style or continue a previous audio segment.
3405
3456
  */
3406
- prompt: import_v415.z.string().optional(),
3457
+ prompt: import_v416.z.string().optional(),
3407
3458
  /**
3408
3459
  * The sampling temperature, between 0 and 1.
3409
3460
  * @default 0
3410
3461
  */
3411
- temperature: import_v415.z.number().min(0).max(1).default(0).optional(),
3462
+ temperature: import_v416.z.number().min(0).max(1).default(0).optional(),
3412
3463
  /**
3413
3464
  * The timestamp granularities to populate for this transcription.
3414
3465
  * @default ['segment']
3415
3466
  */
3416
- timestampGranularities: import_v415.z.array(import_v415.z.enum(["word", "segment"])).default(["segment"]).optional()
3467
+ timestampGranularities: import_v416.z.array(import_v416.z.enum(["word", "segment"])).default(["segment"]).optional()
3417
3468
  });
3418
3469
 
3419
3470
  // src/transcription/openai-transcription-model.ts
@@ -3491,15 +3542,15 @@ var OpenAITranscriptionModel = class {
3491
3542
  providerOptions
3492
3543
  }) {
3493
3544
  const warnings = [];
3494
- const openAIOptions = await (0, import_provider_utils14.parseProviderOptions)({
3545
+ const openAIOptions = await (0, import_provider_utils15.parseProviderOptions)({
3495
3546
  provider: "openai",
3496
3547
  providerOptions,
3497
3548
  schema: openAITranscriptionProviderOptions
3498
3549
  });
3499
3550
  const formData = new FormData();
3500
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils14.convertBase64ToUint8Array)(audio)]);
3551
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils15.convertBase64ToUint8Array)(audio)]);
3501
3552
  formData.append("model", this.modelId);
3502
- const fileExtension = (0, import_provider_utils14.mediaTypeToExtension)(mediaType);
3553
+ const fileExtension = (0, import_provider_utils15.mediaTypeToExtension)(mediaType);
3503
3554
  formData.append(
3504
3555
  "file",
3505
3556
  new File([blob], "audio", { type: mediaType }),
@@ -3521,7 +3572,13 @@ var OpenAITranscriptionModel = class {
3521
3572
  };
3522
3573
  for (const [key, value] of Object.entries(transcriptionModelOptions)) {
3523
3574
  if (value != null) {
3524
- formData.append(key, String(value));
3575
+ if (Array.isArray(value)) {
3576
+ for (const item of value) {
3577
+ formData.append(`${key}[]`, String(item));
3578
+ }
3579
+ } else {
3580
+ formData.append(key, String(value));
3581
+ }
3525
3582
  }
3526
3583
  }
3527
3584
  }
@@ -3538,15 +3595,15 @@ var OpenAITranscriptionModel = class {
3538
3595
  value: response,
3539
3596
  responseHeaders,
3540
3597
  rawValue: rawResponse
3541
- } = await (0, import_provider_utils14.postFormDataToApi)({
3598
+ } = await (0, import_provider_utils15.postFormDataToApi)({
3542
3599
  url: this.config.url({
3543
3600
  path: "/audio/transcriptions",
3544
3601
  modelId: this.modelId
3545
3602
  }),
3546
- headers: (0, import_provider_utils14.combineHeaders)(this.config.headers(), options.headers),
3603
+ headers: (0, import_provider_utils15.combineHeaders)(this.config.headers(), options.headers),
3547
3604
  formData,
3548
3605
  failedResponseHandler: openaiFailedResponseHandler,
3549
- successfulResponseHandler: (0, import_provider_utils14.createJsonResponseHandler)(
3606
+ successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
3550
3607
  openaiTranscriptionResponseSchema
3551
3608
  ),
3552
3609
  abortSignal: options.abortSignal,
@@ -3576,29 +3633,29 @@ var OpenAITranscriptionModel = class {
3576
3633
  };
3577
3634
  }
3578
3635
  };
3579
- var openaiTranscriptionResponseSchema = import_v416.z.object({
3580
- text: import_v416.z.string(),
3581
- language: import_v416.z.string().nullish(),
3582
- duration: import_v416.z.number().nullish(),
3583
- words: import_v416.z.array(
3584
- import_v416.z.object({
3585
- word: import_v416.z.string(),
3586
- start: import_v416.z.number(),
3587
- end: import_v416.z.number()
3636
+ var openaiTranscriptionResponseSchema = import_v417.z.object({
3637
+ text: import_v417.z.string(),
3638
+ language: import_v417.z.string().nullish(),
3639
+ duration: import_v417.z.number().nullish(),
3640
+ words: import_v417.z.array(
3641
+ import_v417.z.object({
3642
+ word: import_v417.z.string(),
3643
+ start: import_v417.z.number(),
3644
+ end: import_v417.z.number()
3588
3645
  })
3589
3646
  ).nullish(),
3590
- segments: import_v416.z.array(
3591
- import_v416.z.object({
3592
- id: import_v416.z.number(),
3593
- seek: import_v416.z.number(),
3594
- start: import_v416.z.number(),
3595
- end: import_v416.z.number(),
3596
- text: import_v416.z.string(),
3597
- tokens: import_v416.z.array(import_v416.z.number()),
3598
- temperature: import_v416.z.number(),
3599
- avg_logprob: import_v416.z.number(),
3600
- compression_ratio: import_v416.z.number(),
3601
- no_speech_prob: import_v416.z.number()
3647
+ segments: import_v417.z.array(
3648
+ import_v417.z.object({
3649
+ id: import_v417.z.number(),
3650
+ seek: import_v417.z.number(),
3651
+ start: import_v417.z.number(),
3652
+ end: import_v417.z.number(),
3653
+ text: import_v417.z.string(),
3654
+ tokens: import_v417.z.array(import_v417.z.number()),
3655
+ temperature: import_v417.z.number(),
3656
+ avg_logprob: import_v417.z.number(),
3657
+ compression_ratio: import_v417.z.number(),
3658
+ no_speech_prob: import_v417.z.number()
3602
3659
  })
3603
3660
  ).nullish()
3604
3661
  });
@@ -3606,10 +3663,10 @@ var openaiTranscriptionResponseSchema = import_v416.z.object({
3606
3663
  // src/openai-provider.ts
3607
3664
  function createOpenAI(options = {}) {
3608
3665
  var _a, _b;
3609
- const baseURL = (_a = (0, import_provider_utils15.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3666
+ const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3610
3667
  const providerName = (_b = options.name) != null ? _b : "openai";
3611
3668
  const getHeaders = () => ({
3612
- Authorization: `Bearer ${(0, import_provider_utils15.loadApiKey)({
3669
+ Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
3613
3670
  apiKey: options.apiKey,
3614
3671
  environmentVariableName: "OPENAI_API_KEY",
3615
3672
  description: "OpenAI"