@ai-sdk/openai 2.0.0-beta.3 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1888,19 +1888,22 @@ import {
1888
1888
  createEventSourceResponseHandler as createEventSourceResponseHandler3,
1889
1889
  createJsonResponseHandler as createJsonResponseHandler6,
1890
1890
  generateId as generateId2,
1891
- parseProviderOptions as parseProviderOptions5,
1891
+ parseProviderOptions as parseProviderOptions6,
1892
1892
  postJsonToApi as postJsonToApi5
1893
1893
  } from "@ai-sdk/provider-utils";
1894
- import { z as z13 } from "zod/v4";
1894
+ import { z as z14 } from "zod/v4";
1895
1895
 
1896
1896
  // src/responses/convert-to-openai-responses-messages.ts
1897
1897
  import {
1898
1898
  UnsupportedFunctionalityError as UnsupportedFunctionalityError4
1899
1899
  } from "@ai-sdk/provider";
1900
- function convertToOpenAIResponsesMessages({
1900
+ import { parseProviderOptions as parseProviderOptions5 } from "@ai-sdk/provider-utils";
1901
+ import { z as z13 } from "zod/v4";
1902
+ async function convertToOpenAIResponsesMessages({
1901
1903
  prompt,
1902
1904
  systemMessageMode
1903
1905
  }) {
1906
+ var _a, _b;
1904
1907
  const messages = [];
1905
1908
  const warnings = [];
1906
1909
  for (const { role, content } of prompt) {
@@ -1935,7 +1938,7 @@ function convertToOpenAIResponsesMessages({
1935
1938
  messages.push({
1936
1939
  role: "user",
1937
1940
  content: content.map((part, index) => {
1938
- var _a, _b, _c;
1941
+ var _a2, _b2, _c;
1939
1942
  switch (part.type) {
1940
1943
  case "text": {
1941
1944
  return { type: "input_text", text: part.text };
@@ -1947,7 +1950,7 @@ function convertToOpenAIResponsesMessages({
1947
1950
  type: "input_image",
1948
1951
  image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${part.data}`,
1949
1952
  // OpenAI specific extension: image detail
1950
- detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
1953
+ detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
1951
1954
  };
1952
1955
  } else if (part.mediaType === "application/pdf") {
1953
1956
  if (part.data instanceof URL) {
@@ -1972,6 +1975,7 @@ function convertToOpenAIResponsesMessages({
1972
1975
  break;
1973
1976
  }
1974
1977
  case "assistant": {
1978
+ const reasoningMessages = {};
1975
1979
  for (const part of content) {
1976
1980
  switch (part.type) {
1977
1981
  case "text": {
@@ -2000,6 +2004,43 @@ function convertToOpenAIResponsesMessages({
2000
2004
  });
2001
2005
  break;
2002
2006
  }
2007
+ case "reasoning": {
2008
+ const providerOptions = await parseProviderOptions5({
2009
+ provider: "openai",
2010
+ providerOptions: part.providerOptions,
2011
+ schema: openaiResponsesReasoningProviderOptionsSchema
2012
+ });
2013
+ const reasoningId = (_a = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _a.id;
2014
+ if (reasoningId != null) {
2015
+ const existingReasoningMessage = reasoningMessages[reasoningId];
2016
+ const summaryParts = [];
2017
+ if (part.text.length > 0) {
2018
+ summaryParts.push({ type: "summary_text", text: part.text });
2019
+ } else {
2020
+ warnings.push({
2021
+ type: "other",
2022
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2023
+ });
2024
+ }
2025
+ if (existingReasoningMessage === void 0) {
2026
+ reasoningMessages[reasoningId] = {
2027
+ type: "reasoning",
2028
+ id: reasoningId,
2029
+ encrypted_content: (_b = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _b.encryptedContent,
2030
+ summary: summaryParts
2031
+ };
2032
+ messages.push(reasoningMessages[reasoningId]);
2033
+ } else {
2034
+ existingReasoningMessage.summary.push(...summaryParts);
2035
+ }
2036
+ } else {
2037
+ warnings.push({
2038
+ type: "other",
2039
+ message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
2040
+ });
2041
+ }
2042
+ break;
2043
+ }
2003
2044
  }
2004
2045
  }
2005
2046
  break;
@@ -2035,6 +2076,12 @@ function convertToOpenAIResponsesMessages({
2035
2076
  }
2036
2077
  return { messages, warnings };
2037
2078
  }
2079
+ var openaiResponsesReasoningProviderOptionsSchema = z13.object({
2080
+ reasoning: z13.object({
2081
+ id: z13.string().nullish(),
2082
+ encryptedContent: z13.string().nullish()
2083
+ }).nullish()
2084
+ });
2038
2085
 
2039
2086
  // src/responses/map-openai-responses-finish-reason.ts
2040
2087
  function mapOpenAIResponseFinishReason({
@@ -2175,12 +2222,12 @@ var OpenAIResponsesLanguageModel = class {
2175
2222
  if (stopSequences != null) {
2176
2223
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2177
2224
  }
2178
- const { messages, warnings: messageWarnings } = convertToOpenAIResponsesMessages({
2225
+ const { messages, warnings: messageWarnings } = await convertToOpenAIResponsesMessages({
2179
2226
  prompt,
2180
2227
  systemMessageMode: modelConfig.systemMessageMode
2181
2228
  });
2182
2229
  warnings.push(...messageWarnings);
2183
- const openaiOptions = await parseProviderOptions5({
2230
+ const openaiOptions = await parseProviderOptions6({
2184
2231
  provider: "openai",
2185
2232
  providerOptions,
2186
2233
  schema: openaiResponsesProviderOptionsSchema
@@ -2211,6 +2258,7 @@ var OpenAIResponsesLanguageModel = class {
2211
2258
  user: openaiOptions == null ? void 0 : openaiOptions.user,
2212
2259
  instructions: openaiOptions == null ? void 0 : openaiOptions.instructions,
2213
2260
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
2261
+ include: openaiOptions == null ? void 0 : openaiOptions.include,
2214
2262
  // model-specific settings:
2215
2263
  ...modelConfig.isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
2216
2264
  reasoning: {
@@ -2243,6 +2291,21 @@ var OpenAIResponsesLanguageModel = class {
2243
2291
  details: "topP is not supported for reasoning models"
2244
2292
  });
2245
2293
  }
2294
+ } else {
2295
+ if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
2296
+ warnings.push({
2297
+ type: "unsupported-setting",
2298
+ setting: "reasoningEffort",
2299
+ details: "reasoningEffort is not supported for non-reasoning models"
2300
+ });
2301
+ }
2302
+ if ((openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) {
2303
+ warnings.push({
2304
+ type: "unsupported-setting",
2305
+ setting: "reasoningSummary",
2306
+ details: "reasoningSummary is not supported for non-reasoning models"
2307
+ });
2308
+ }
2246
2309
  }
2247
2310
  if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "flex" && !supportsFlexProcessing2(this.modelId)) {
2248
2311
  warnings.push({
@@ -2271,7 +2334,7 @@ var OpenAIResponsesLanguageModel = class {
2271
2334
  };
2272
2335
  }
2273
2336
  async doGenerate(options) {
2274
- var _a, _b, _c, _d, _e, _f, _g, _h;
2337
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2275
2338
  const { args: body, warnings } = await this.getArgs(options);
2276
2339
  const {
2277
2340
  responseHeaders,
@@ -2286,59 +2349,61 @@ var OpenAIResponsesLanguageModel = class {
2286
2349
  body,
2287
2350
  failedResponseHandler: openaiFailedResponseHandler,
2288
2351
  successfulResponseHandler: createJsonResponseHandler6(
2289
- z13.object({
2290
- id: z13.string(),
2291
- created_at: z13.number(),
2292
- model: z13.string(),
2293
- output: z13.array(
2294
- z13.discriminatedUnion("type", [
2295
- z13.object({
2296
- type: z13.literal("message"),
2297
- role: z13.literal("assistant"),
2298
- content: z13.array(
2299
- z13.object({
2300
- type: z13.literal("output_text"),
2301
- text: z13.string(),
2302
- annotations: z13.array(
2303
- z13.object({
2304
- type: z13.literal("url_citation"),
2305
- start_index: z13.number(),
2306
- end_index: z13.number(),
2307
- url: z13.string(),
2308
- title: z13.string()
2352
+ z14.object({
2353
+ id: z14.string(),
2354
+ created_at: z14.number(),
2355
+ model: z14.string(),
2356
+ output: z14.array(
2357
+ z14.discriminatedUnion("type", [
2358
+ z14.object({
2359
+ type: z14.literal("message"),
2360
+ role: z14.literal("assistant"),
2361
+ content: z14.array(
2362
+ z14.object({
2363
+ type: z14.literal("output_text"),
2364
+ text: z14.string(),
2365
+ annotations: z14.array(
2366
+ z14.object({
2367
+ type: z14.literal("url_citation"),
2368
+ start_index: z14.number(),
2369
+ end_index: z14.number(),
2370
+ url: z14.string(),
2371
+ title: z14.string()
2309
2372
  })
2310
2373
  )
2311
2374
  })
2312
2375
  )
2313
2376
  }),
2314
- z13.object({
2315
- type: z13.literal("function_call"),
2316
- call_id: z13.string(),
2317
- name: z13.string(),
2318
- arguments: z13.string()
2377
+ z14.object({
2378
+ type: z14.literal("function_call"),
2379
+ call_id: z14.string(),
2380
+ name: z14.string(),
2381
+ arguments: z14.string()
2319
2382
  }),
2320
- z13.object({
2321
- type: z13.literal("web_search_call"),
2322
- id: z13.string(),
2323
- status: z13.string().optional()
2383
+ z14.object({
2384
+ type: z14.literal("web_search_call"),
2385
+ id: z14.string(),
2386
+ status: z14.string().optional()
2324
2387
  }),
2325
- z13.object({
2326
- type: z13.literal("computer_call"),
2327
- id: z13.string(),
2328
- status: z13.string().optional()
2388
+ z14.object({
2389
+ type: z14.literal("computer_call"),
2390
+ id: z14.string(),
2391
+ status: z14.string().optional()
2329
2392
  }),
2330
- z13.object({
2331
- type: z13.literal("reasoning"),
2332
- summary: z13.array(
2333
- z13.object({
2334
- type: z13.literal("summary_text"),
2335
- text: z13.string()
2393
+ z14.object({
2394
+ type: z14.literal("reasoning"),
2395
+ id: z14.string(),
2396
+ encrypted_content: z14.string().nullish(),
2397
+ summary: z14.array(
2398
+ z14.object({
2399
+ type: z14.literal("summary_text"),
2400
+ text: z14.string()
2336
2401
  })
2337
2402
  )
2338
2403
  })
2339
2404
  ])
2340
2405
  ),
2341
- incomplete_details: z13.object({ reason: z13.string() }).nullable(),
2406
+ incomplete_details: z14.object({ reason: z14.string() }).nullable(),
2342
2407
  usage: usageSchema2
2343
2408
  })
2344
2409
  ),
@@ -2349,10 +2414,23 @@ var OpenAIResponsesLanguageModel = class {
2349
2414
  for (const part of response.output) {
2350
2415
  switch (part.type) {
2351
2416
  case "reasoning": {
2352
- content.push({
2353
- type: "reasoning",
2354
- text: part.summary.map((summary) => summary.text).join()
2355
- });
2417
+ if (part.summary.length === 0) {
2418
+ part.summary.push({ type: "summary_text", text: "" });
2419
+ }
2420
+ for (const summary of part.summary) {
2421
+ content.push({
2422
+ type: "reasoning",
2423
+ text: summary.text,
2424
+ providerMetadata: {
2425
+ openai: {
2426
+ reasoning: {
2427
+ id: part.id,
2428
+ encryptedContent: (_a = part.encrypted_content) != null ? _a : null
2429
+ }
2430
+ }
2431
+ }
2432
+ });
2433
+ }
2356
2434
  break;
2357
2435
  }
2358
2436
  case "message": {
@@ -2365,7 +2443,7 @@ var OpenAIResponsesLanguageModel = class {
2365
2443
  content.push({
2366
2444
  type: "source",
2367
2445
  sourceType: "url",
2368
- id: (_c = (_b = (_a = this.config).generateId) == null ? void 0 : _b.call(_a)) != null ? _c : generateId2(),
2446
+ id: (_d = (_c = (_b = this.config).generateId) == null ? void 0 : _c.call(_b)) != null ? _d : generateId2(),
2369
2447
  url: annotation.url,
2370
2448
  title: annotation.title
2371
2449
  });
@@ -2424,15 +2502,15 @@ var OpenAIResponsesLanguageModel = class {
2424
2502
  return {
2425
2503
  content,
2426
2504
  finishReason: mapOpenAIResponseFinishReason({
2427
- finishReason: (_d = response.incomplete_details) == null ? void 0 : _d.reason,
2505
+ finishReason: (_e = response.incomplete_details) == null ? void 0 : _e.reason,
2428
2506
  hasToolCalls: content.some((part) => part.type === "tool-call")
2429
2507
  }),
2430
2508
  usage: {
2431
2509
  inputTokens: response.usage.input_tokens,
2432
2510
  outputTokens: response.usage.output_tokens,
2433
2511
  totalTokens: response.usage.input_tokens + response.usage.output_tokens,
2434
- reasoningTokens: (_f = (_e = response.usage.output_tokens_details) == null ? void 0 : _e.reasoning_tokens) != null ? _f : void 0,
2435
- cachedInputTokens: (_h = (_g = response.usage.input_tokens_details) == null ? void 0 : _g.cached_tokens) != null ? _h : void 0
2512
+ reasoningTokens: (_g = (_f = response.usage.output_tokens_details) == null ? void 0 : _f.reasoning_tokens) != null ? _g : void 0,
2513
+ cachedInputTokens: (_i = (_h = response.usage.input_tokens_details) == null ? void 0 : _h.cached_tokens) != null ? _i : void 0
2436
2514
  },
2437
2515
  request: { body },
2438
2516
  response: {
@@ -2486,7 +2564,7 @@ var OpenAIResponsesLanguageModel = class {
2486
2564
  controller.enqueue({ type: "stream-start", warnings });
2487
2565
  },
2488
2566
  transform(chunk, controller) {
2489
- var _a, _b, _c, _d, _e, _f, _g, _h;
2567
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2490
2568
  if (options.includeRawChunks) {
2491
2569
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2492
2570
  }
@@ -2535,7 +2613,15 @@ var OpenAIResponsesLanguageModel = class {
2535
2613
  } else if (value.item.type === "reasoning") {
2536
2614
  controller.enqueue({
2537
2615
  type: "reasoning-start",
2538
- id: value.item.id
2616
+ id: value.item.id,
2617
+ providerMetadata: {
2618
+ openai: {
2619
+ reasoning: {
2620
+ id: value.item.id,
2621
+ encryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
2622
+ }
2623
+ }
2624
+ }
2539
2625
  });
2540
2626
  }
2541
2627
  } else if (isResponseOutputItemDoneChunk(value)) {
@@ -2608,7 +2694,15 @@ var OpenAIResponsesLanguageModel = class {
2608
2694
  } else if (value.item.type === "reasoning") {
2609
2695
  controller.enqueue({
2610
2696
  type: "reasoning-end",
2611
- id: value.item.id
2697
+ id: value.item.id,
2698
+ providerMetadata: {
2699
+ openai: {
2700
+ reasoning: {
2701
+ id: value.item.id,
2702
+ encryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
2703
+ }
2704
+ }
2705
+ }
2612
2706
  });
2613
2707
  }
2614
2708
  } else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
@@ -2637,24 +2731,24 @@ var OpenAIResponsesLanguageModel = class {
2637
2731
  } else if (isResponseReasoningSummaryTextDeltaChunk(value)) {
2638
2732
  controller.enqueue({
2639
2733
  type: "reasoning-delta",
2640
- delta: value.delta,
2641
- id: value.item_id
2734
+ id: value.item_id,
2735
+ delta: value.delta
2642
2736
  });
2643
2737
  } else if (isResponseFinishedChunk(value)) {
2644
2738
  finishReason = mapOpenAIResponseFinishReason({
2645
- finishReason: (_a = value.response.incomplete_details) == null ? void 0 : _a.reason,
2739
+ finishReason: (_c = value.response.incomplete_details) == null ? void 0 : _c.reason,
2646
2740
  hasToolCalls
2647
2741
  });
2648
2742
  usage.inputTokens = value.response.usage.input_tokens;
2649
2743
  usage.outputTokens = value.response.usage.output_tokens;
2650
2744
  usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
2651
- usage.reasoningTokens = (_c = (_b = value.response.usage.output_tokens_details) == null ? void 0 : _b.reasoning_tokens) != null ? _c : void 0;
2652
- usage.cachedInputTokens = (_e = (_d = value.response.usage.input_tokens_details) == null ? void 0 : _d.cached_tokens) != null ? _e : void 0;
2745
+ usage.reasoningTokens = (_e = (_d = value.response.usage.output_tokens_details) == null ? void 0 : _d.reasoning_tokens) != null ? _e : void 0;
2746
+ usage.cachedInputTokens = (_g = (_f = value.response.usage.input_tokens_details) == null ? void 0 : _f.cached_tokens) != null ? _g : void 0;
2653
2747
  } else if (isResponseAnnotationAddedChunk(value)) {
2654
2748
  controller.enqueue({
2655
2749
  type: "source",
2656
2750
  sourceType: "url",
2657
- id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : generateId2(),
2751
+ id: (_j = (_i = (_h = self.config).generateId) == null ? void 0 : _i.call(_h)) != null ? _j : generateId2(),
2658
2752
  url: value.annotation.url,
2659
2753
  title: value.annotation.title
2660
2754
  });
@@ -2679,124 +2773,129 @@ var OpenAIResponsesLanguageModel = class {
2679
2773
  };
2680
2774
  }
2681
2775
  };
2682
- var usageSchema2 = z13.object({
2683
- input_tokens: z13.number(),
2684
- input_tokens_details: z13.object({ cached_tokens: z13.number().nullish() }).nullish(),
2685
- output_tokens: z13.number(),
2686
- output_tokens_details: z13.object({ reasoning_tokens: z13.number().nullish() }).nullish()
2776
+ var usageSchema2 = z14.object({
2777
+ input_tokens: z14.number(),
2778
+ input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
2779
+ output_tokens: z14.number(),
2780
+ output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
2687
2781
  });
2688
- var textDeltaChunkSchema = z13.object({
2689
- type: z13.literal("response.output_text.delta"),
2690
- item_id: z13.string(),
2691
- delta: z13.string()
2782
+ var textDeltaChunkSchema = z14.object({
2783
+ type: z14.literal("response.output_text.delta"),
2784
+ item_id: z14.string(),
2785
+ delta: z14.string()
2692
2786
  });
2693
- var responseFinishedChunkSchema = z13.object({
2694
- type: z13.enum(["response.completed", "response.incomplete"]),
2695
- response: z13.object({
2696
- incomplete_details: z13.object({ reason: z13.string() }).nullish(),
2787
+ var responseFinishedChunkSchema = z14.object({
2788
+ type: z14.enum(["response.completed", "response.incomplete"]),
2789
+ response: z14.object({
2790
+ incomplete_details: z14.object({ reason: z14.string() }).nullish(),
2697
2791
  usage: usageSchema2
2698
2792
  })
2699
2793
  });
2700
- var responseCreatedChunkSchema = z13.object({
2701
- type: z13.literal("response.created"),
2702
- response: z13.object({
2703
- id: z13.string(),
2704
- created_at: z13.number(),
2705
- model: z13.string()
2794
+ var responseCreatedChunkSchema = z14.object({
2795
+ type: z14.literal("response.created"),
2796
+ response: z14.object({
2797
+ id: z14.string(),
2798
+ created_at: z14.number(),
2799
+ model: z14.string()
2706
2800
  })
2707
2801
  });
2708
- var responseOutputItemAddedSchema = z13.object({
2709
- type: z13.literal("response.output_item.added"),
2710
- output_index: z13.number(),
2711
- item: z13.discriminatedUnion("type", [
2712
- z13.object({
2713
- type: z13.literal("message"),
2714
- id: z13.string()
2802
+ var responseOutputItemAddedSchema = z14.object({
2803
+ type: z14.literal("response.output_item.added"),
2804
+ output_index: z14.number(),
2805
+ item: z14.discriminatedUnion("type", [
2806
+ z14.object({
2807
+ type: z14.literal("message"),
2808
+ id: z14.string()
2715
2809
  }),
2716
- z13.object({
2717
- type: z13.literal("reasoning"),
2718
- id: z13.string()
2810
+ z14.object({
2811
+ type: z14.literal("reasoning"),
2812
+ id: z14.string(),
2813
+ encrypted_content: z14.string().nullish(),
2814
+ summary: z14.array(
2815
+ z14.object({
2816
+ type: z14.literal("summary_text"),
2817
+ text: z14.string()
2818
+ })
2819
+ )
2719
2820
  }),
2720
- z13.object({
2721
- type: z13.literal("function_call"),
2722
- id: z13.string(),
2723
- call_id: z13.string(),
2724
- name: z13.string(),
2725
- arguments: z13.string()
2821
+ z14.object({
2822
+ type: z14.literal("function_call"),
2823
+ id: z14.string(),
2824
+ call_id: z14.string(),
2825
+ name: z14.string(),
2826
+ arguments: z14.string()
2726
2827
  }),
2727
- z13.object({
2728
- type: z13.literal("web_search_call"),
2729
- id: z13.string(),
2730
- status: z13.string()
2828
+ z14.object({
2829
+ type: z14.literal("web_search_call"),
2830
+ id: z14.string(),
2831
+ status: z14.string()
2731
2832
  }),
2732
- z13.object({
2733
- type: z13.literal("computer_call"),
2734
- id: z13.string(),
2735
- status: z13.string()
2833
+ z14.object({
2834
+ type: z14.literal("computer_call"),
2835
+ id: z14.string(),
2836
+ status: z14.string()
2736
2837
  })
2737
2838
  ])
2738
2839
  });
2739
- var responseOutputItemDoneSchema = z13.object({
2740
- type: z13.literal("response.output_item.done"),
2741
- output_index: z13.number(),
2742
- item: z13.discriminatedUnion("type", [
2743
- z13.object({
2744
- type: z13.literal("message"),
2745
- id: z13.string()
2840
+ var responseOutputItemDoneSchema = z14.object({
2841
+ type: z14.literal("response.output_item.done"),
2842
+ output_index: z14.number(),
2843
+ item: z14.discriminatedUnion("type", [
2844
+ z14.object({
2845
+ type: z14.literal("message"),
2846
+ id: z14.string()
2746
2847
  }),
2747
- z13.object({
2748
- type: z13.literal("reasoning"),
2749
- id: z13.string()
2848
+ z14.object({
2849
+ type: z14.literal("reasoning"),
2850
+ id: z14.string(),
2851
+ encrypted_content: z14.string().nullish(),
2852
+ summary: z14.array(
2853
+ z14.object({
2854
+ type: z14.literal("summary_text"),
2855
+ text: z14.string()
2856
+ })
2857
+ )
2750
2858
  }),
2751
- z13.object({
2752
- type: z13.literal("function_call"),
2753
- id: z13.string(),
2754
- call_id: z13.string(),
2755
- name: z13.string(),
2756
- arguments: z13.string(),
2757
- status: z13.literal("completed")
2859
+ z14.object({
2860
+ type: z14.literal("function_call"),
2861
+ id: z14.string(),
2862
+ call_id: z14.string(),
2863
+ name: z14.string(),
2864
+ arguments: z14.string(),
2865
+ status: z14.literal("completed")
2758
2866
  }),
2759
- z13.object({
2760
- type: z13.literal("web_search_call"),
2761
- id: z13.string(),
2762
- status: z13.literal("completed")
2867
+ z14.object({
2868
+ type: z14.literal("web_search_call"),
2869
+ id: z14.string(),
2870
+ status: z14.literal("completed")
2763
2871
  }),
2764
- z13.object({
2765
- type: z13.literal("computer_call"),
2766
- id: z13.string(),
2767
- status: z13.literal("completed")
2872
+ z14.object({
2873
+ type: z14.literal("computer_call"),
2874
+ id: z14.string(),
2875
+ status: z14.literal("completed")
2768
2876
  })
2769
2877
  ])
2770
2878
  });
2771
- var responseFunctionCallArgumentsDeltaSchema = z13.object({
2772
- type: z13.literal("response.function_call_arguments.delta"),
2773
- item_id: z13.string(),
2774
- output_index: z13.number(),
2775
- delta: z13.string()
2879
+ var responseFunctionCallArgumentsDeltaSchema = z14.object({
2880
+ type: z14.literal("response.function_call_arguments.delta"),
2881
+ item_id: z14.string(),
2882
+ output_index: z14.number(),
2883
+ delta: z14.string()
2776
2884
  });
2777
- var responseAnnotationAddedSchema = z13.object({
2778
- type: z13.literal("response.output_text.annotation.added"),
2779
- annotation: z13.object({
2780
- type: z13.literal("url_citation"),
2781
- url: z13.string(),
2782
- title: z13.string()
2885
+ var responseAnnotationAddedSchema = z14.object({
2886
+ type: z14.literal("response.output_text.annotation.added"),
2887
+ annotation: z14.object({
2888
+ type: z14.literal("url_citation"),
2889
+ url: z14.string(),
2890
+ title: z14.string()
2783
2891
  })
2784
2892
  });
2785
- var responseReasoningSummaryTextDeltaSchema = z13.object({
2786
- type: z13.literal("response.reasoning_summary_text.delta"),
2787
- item_id: z13.string(),
2788
- output_index: z13.number(),
2789
- summary_index: z13.number(),
2790
- delta: z13.string()
2791
- });
2792
- var responseReasoningSummaryPartDoneSchema = z13.object({
2793
- type: z13.literal("response.reasoning_summary_part.done"),
2794
- item_id: z13.string(),
2795
- output_index: z13.number(),
2796
- summary_index: z13.number(),
2797
- part: z13.unknown().nullish()
2893
+ var responseReasoningSummaryTextDeltaSchema = z14.object({
2894
+ type: z14.literal("response.reasoning_summary_text.delta"),
2895
+ item_id: z14.string(),
2896
+ delta: z14.string()
2798
2897
  });
2799
- var openaiResponsesChunkSchema = z13.union([
2898
+ var openaiResponsesChunkSchema = z14.union([
2800
2899
  textDeltaChunkSchema,
2801
2900
  responseFinishedChunkSchema,
2802
2901
  responseCreatedChunkSchema,
@@ -2805,8 +2904,7 @@ var openaiResponsesChunkSchema = z13.union([
2805
2904
  responseFunctionCallArgumentsDeltaSchema,
2806
2905
  responseAnnotationAddedSchema,
2807
2906
  responseReasoningSummaryTextDeltaSchema,
2808
- responseReasoningSummaryPartDoneSchema,
2809
- z13.object({ type: z13.string() }).passthrough()
2907
+ z14.object({ type: z14.string() }).passthrough()
2810
2908
  // fallback for unknown chunks
2811
2909
  ]);
2812
2910
  function isTextDeltaChunk(chunk) {
@@ -2834,7 +2932,7 @@ function isResponseReasoningSummaryTextDeltaChunk(chunk) {
2834
2932
  return chunk.type === "response.reasoning_summary_text.delta";
2835
2933
  }
2836
2934
  function getResponsesModelConfig(modelId) {
2837
- if (modelId.startsWith("o")) {
2935
+ if (modelId.startsWith("o") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
2838
2936
  if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
2839
2937
  return {
2840
2938
  isReasoningModel: true,
@@ -2857,30 +2955,31 @@ function getResponsesModelConfig(modelId) {
2857
2955
  function supportsFlexProcessing2(modelId) {
2858
2956
  return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
2859
2957
  }
2860
- var openaiResponsesProviderOptionsSchema = z13.object({
2861
- metadata: z13.any().nullish(),
2862
- parallelToolCalls: z13.boolean().nullish(),
2863
- previousResponseId: z13.string().nullish(),
2864
- store: z13.boolean().nullish(),
2865
- user: z13.string().nullish(),
2866
- reasoningEffort: z13.string().nullish(),
2867
- strictJsonSchema: z13.boolean().nullish(),
2868
- instructions: z13.string().nullish(),
2869
- reasoningSummary: z13.string().nullish(),
2870
- serviceTier: z13.enum(["auto", "flex"]).nullish()
2958
+ var openaiResponsesProviderOptionsSchema = z14.object({
2959
+ metadata: z14.any().nullish(),
2960
+ parallelToolCalls: z14.boolean().nullish(),
2961
+ previousResponseId: z14.string().nullish(),
2962
+ store: z14.boolean().nullish(),
2963
+ user: z14.string().nullish(),
2964
+ reasoningEffort: z14.string().nullish(),
2965
+ strictJsonSchema: z14.boolean().nullish(),
2966
+ instructions: z14.string().nullish(),
2967
+ reasoningSummary: z14.string().nullish(),
2968
+ serviceTier: z14.enum(["auto", "flex"]).nullish(),
2969
+ include: z14.array(z14.enum(["reasoning.encrypted_content"])).nullish()
2871
2970
  });
2872
2971
 
2873
2972
  // src/openai-speech-model.ts
2874
2973
  import {
2875
2974
  combineHeaders as combineHeaders7,
2876
2975
  createBinaryResponseHandler,
2877
- parseProviderOptions as parseProviderOptions6,
2976
+ parseProviderOptions as parseProviderOptions7,
2878
2977
  postJsonToApi as postJsonToApi6
2879
2978
  } from "@ai-sdk/provider-utils";
2880
- import { z as z14 } from "zod/v4";
2881
- var OpenAIProviderOptionsSchema = z14.object({
2882
- instructions: z14.string().nullish(),
2883
- speed: z14.number().min(0.25).max(4).default(1).nullish()
2979
+ import { z as z15 } from "zod/v4";
2980
+ var OpenAIProviderOptionsSchema = z15.object({
2981
+ instructions: z15.string().nullish(),
2982
+ speed: z15.number().min(0.25).max(4).default(1).nullish()
2884
2983
  });
2885
2984
  var OpenAISpeechModel = class {
2886
2985
  constructor(modelId, config) {
@@ -2901,7 +3000,7 @@ var OpenAISpeechModel = class {
2901
3000
  providerOptions
2902
3001
  }) {
2903
3002
  const warnings = [];
2904
- const openAIOptions = await parseProviderOptions6({
3003
+ const openAIOptions = await parseProviderOptions7({
2905
3004
  provider: "openai",
2906
3005
  providerOptions,
2907
3006
  schema: OpenAIProviderOptionsSchema