@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.
@@ -1976,15 +1976,18 @@ var OpenAISpeechModel = class {
1976
1976
  };
1977
1977
 
1978
1978
  // src/responses/openai-responses-language-model.ts
1979
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
1980
- var import_v414 = require("zod/v4");
1979
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
1980
+ var import_v415 = require("zod/v4");
1981
1981
 
1982
1982
  // src/responses/convert-to-openai-responses-messages.ts
1983
1983
  var import_provider6 = require("@ai-sdk/provider");
1984
- function convertToOpenAIResponsesMessages({
1984
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1985
+ var import_v414 = require("zod/v4");
1986
+ async function convertToOpenAIResponsesMessages({
1985
1987
  prompt,
1986
1988
  systemMessageMode
1987
1989
  }) {
1990
+ var _a, _b;
1988
1991
  const messages = [];
1989
1992
  const warnings = [];
1990
1993
  for (const { role, content } of prompt) {
@@ -2019,7 +2022,7 @@ function convertToOpenAIResponsesMessages({
2019
2022
  messages.push({
2020
2023
  role: "user",
2021
2024
  content: content.map((part, index) => {
2022
- var _a, _b, _c;
2025
+ var _a2, _b2, _c;
2023
2026
  switch (part.type) {
2024
2027
  case "text": {
2025
2028
  return { type: "input_text", text: part.text };
@@ -2031,7 +2034,7 @@ function convertToOpenAIResponsesMessages({
2031
2034
  type: "input_image",
2032
2035
  image_url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${part.data}`,
2033
2036
  // OpenAI specific extension: image detail
2034
- detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
2037
+ detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
2035
2038
  };
2036
2039
  } else if (part.mediaType === "application/pdf") {
2037
2040
  if (part.data instanceof URL) {
@@ -2056,6 +2059,7 @@ function convertToOpenAIResponsesMessages({
2056
2059
  break;
2057
2060
  }
2058
2061
  case "assistant": {
2062
+ const reasoningMessages = {};
2059
2063
  for (const part of content) {
2060
2064
  switch (part.type) {
2061
2065
  case "text": {
@@ -2084,6 +2088,43 @@ function convertToOpenAIResponsesMessages({
2084
2088
  });
2085
2089
  break;
2086
2090
  }
2091
+ case "reasoning": {
2092
+ const providerOptions = await (0, import_provider_utils11.parseProviderOptions)({
2093
+ provider: "openai",
2094
+ providerOptions: part.providerOptions,
2095
+ schema: openaiResponsesReasoningProviderOptionsSchema
2096
+ });
2097
+ const reasoningId = (_a = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _a.id;
2098
+ if (reasoningId != null) {
2099
+ const existingReasoningMessage = reasoningMessages[reasoningId];
2100
+ const summaryParts = [];
2101
+ if (part.text.length > 0) {
2102
+ summaryParts.push({ type: "summary_text", text: part.text });
2103
+ } else {
2104
+ warnings.push({
2105
+ type: "other",
2106
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2107
+ });
2108
+ }
2109
+ if (existingReasoningMessage === void 0) {
2110
+ reasoningMessages[reasoningId] = {
2111
+ type: "reasoning",
2112
+ id: reasoningId,
2113
+ encrypted_content: (_b = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _b.encryptedContent,
2114
+ summary: summaryParts
2115
+ };
2116
+ messages.push(reasoningMessages[reasoningId]);
2117
+ } else {
2118
+ existingReasoningMessage.summary.push(...summaryParts);
2119
+ }
2120
+ } else {
2121
+ warnings.push({
2122
+ type: "other",
2123
+ message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
2124
+ });
2125
+ }
2126
+ break;
2127
+ }
2087
2128
  }
2088
2129
  }
2089
2130
  break;
@@ -2119,6 +2160,12 @@ function convertToOpenAIResponsesMessages({
2119
2160
  }
2120
2161
  return { messages, warnings };
2121
2162
  }
2163
+ var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
2164
+ reasoning: import_v414.z.object({
2165
+ id: import_v414.z.string().nullish(),
2166
+ encryptedContent: import_v414.z.string().nullish()
2167
+ }).nullish()
2168
+ });
2122
2169
 
2123
2170
  // src/responses/map-openai-responses-finish-reason.ts
2124
2171
  function mapOpenAIResponseFinishReason({
@@ -2257,12 +2304,12 @@ var OpenAIResponsesLanguageModel = class {
2257
2304
  if (stopSequences != null) {
2258
2305
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
2259
2306
  }
2260
- const { messages, warnings: messageWarnings } = convertToOpenAIResponsesMessages({
2307
+ const { messages, warnings: messageWarnings } = await convertToOpenAIResponsesMessages({
2261
2308
  prompt,
2262
2309
  systemMessageMode: modelConfig.systemMessageMode
2263
2310
  });
2264
2311
  warnings.push(...messageWarnings);
2265
- const openaiOptions = await (0, import_provider_utils11.parseProviderOptions)({
2312
+ const openaiOptions = await (0, import_provider_utils12.parseProviderOptions)({
2266
2313
  provider: "openai",
2267
2314
  providerOptions,
2268
2315
  schema: openaiResponsesProviderOptionsSchema
@@ -2293,6 +2340,7 @@ var OpenAIResponsesLanguageModel = class {
2293
2340
  user: openaiOptions == null ? void 0 : openaiOptions.user,
2294
2341
  instructions: openaiOptions == null ? void 0 : openaiOptions.instructions,
2295
2342
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
2343
+ include: openaiOptions == null ? void 0 : openaiOptions.include,
2296
2344
  // model-specific settings:
2297
2345
  ...modelConfig.isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
2298
2346
  reasoning: {
@@ -2325,6 +2373,21 @@ var OpenAIResponsesLanguageModel = class {
2325
2373
  details: "topP is not supported for reasoning models"
2326
2374
  });
2327
2375
  }
2376
+ } else {
2377
+ if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
2378
+ warnings.push({
2379
+ type: "unsupported-setting",
2380
+ setting: "reasoningEffort",
2381
+ details: "reasoningEffort is not supported for non-reasoning models"
2382
+ });
2383
+ }
2384
+ if ((openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) {
2385
+ warnings.push({
2386
+ type: "unsupported-setting",
2387
+ setting: "reasoningSummary",
2388
+ details: "reasoningSummary is not supported for non-reasoning models"
2389
+ });
2390
+ }
2328
2391
  }
2329
2392
  if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "flex" && !supportsFlexProcessing2(this.modelId)) {
2330
2393
  warnings.push({
@@ -2353,74 +2416,76 @@ var OpenAIResponsesLanguageModel = class {
2353
2416
  };
2354
2417
  }
2355
2418
  async doGenerate(options) {
2356
- var _a, _b, _c, _d, _e, _f, _g, _h;
2419
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2357
2420
  const { args: body, warnings } = await this.getArgs(options);
2358
2421
  const {
2359
2422
  responseHeaders,
2360
2423
  value: response,
2361
2424
  rawValue: rawResponse
2362
- } = await (0, import_provider_utils11.postJsonToApi)({
2425
+ } = await (0, import_provider_utils12.postJsonToApi)({
2363
2426
  url: this.config.url({
2364
2427
  path: "/responses",
2365
2428
  modelId: this.modelId
2366
2429
  }),
2367
- headers: (0, import_provider_utils11.combineHeaders)(this.config.headers(), options.headers),
2430
+ headers: (0, import_provider_utils12.combineHeaders)(this.config.headers(), options.headers),
2368
2431
  body,
2369
2432
  failedResponseHandler: openaiFailedResponseHandler,
2370
- successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
2371
- import_v414.z.object({
2372
- id: import_v414.z.string(),
2373
- created_at: import_v414.z.number(),
2374
- model: import_v414.z.string(),
2375
- output: import_v414.z.array(
2376
- import_v414.z.discriminatedUnion("type", [
2377
- import_v414.z.object({
2378
- type: import_v414.z.literal("message"),
2379
- role: import_v414.z.literal("assistant"),
2380
- content: import_v414.z.array(
2381
- import_v414.z.object({
2382
- type: import_v414.z.literal("output_text"),
2383
- text: import_v414.z.string(),
2384
- annotations: import_v414.z.array(
2385
- import_v414.z.object({
2386
- type: import_v414.z.literal("url_citation"),
2387
- start_index: import_v414.z.number(),
2388
- end_index: import_v414.z.number(),
2389
- url: import_v414.z.string(),
2390
- title: import_v414.z.string()
2433
+ successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
2434
+ import_v415.z.object({
2435
+ id: import_v415.z.string(),
2436
+ created_at: import_v415.z.number(),
2437
+ model: import_v415.z.string(),
2438
+ output: import_v415.z.array(
2439
+ import_v415.z.discriminatedUnion("type", [
2440
+ import_v415.z.object({
2441
+ type: import_v415.z.literal("message"),
2442
+ role: import_v415.z.literal("assistant"),
2443
+ content: import_v415.z.array(
2444
+ import_v415.z.object({
2445
+ type: import_v415.z.literal("output_text"),
2446
+ text: import_v415.z.string(),
2447
+ annotations: import_v415.z.array(
2448
+ import_v415.z.object({
2449
+ type: import_v415.z.literal("url_citation"),
2450
+ start_index: import_v415.z.number(),
2451
+ end_index: import_v415.z.number(),
2452
+ url: import_v415.z.string(),
2453
+ title: import_v415.z.string()
2391
2454
  })
2392
2455
  )
2393
2456
  })
2394
2457
  )
2395
2458
  }),
2396
- import_v414.z.object({
2397
- type: import_v414.z.literal("function_call"),
2398
- call_id: import_v414.z.string(),
2399
- name: import_v414.z.string(),
2400
- arguments: import_v414.z.string()
2459
+ import_v415.z.object({
2460
+ type: import_v415.z.literal("function_call"),
2461
+ call_id: import_v415.z.string(),
2462
+ name: import_v415.z.string(),
2463
+ arguments: import_v415.z.string()
2401
2464
  }),
2402
- import_v414.z.object({
2403
- type: import_v414.z.literal("web_search_call"),
2404
- id: import_v414.z.string(),
2405
- status: import_v414.z.string().optional()
2465
+ import_v415.z.object({
2466
+ type: import_v415.z.literal("web_search_call"),
2467
+ id: import_v415.z.string(),
2468
+ status: import_v415.z.string().optional()
2406
2469
  }),
2407
- import_v414.z.object({
2408
- type: import_v414.z.literal("computer_call"),
2409
- id: import_v414.z.string(),
2410
- status: import_v414.z.string().optional()
2470
+ import_v415.z.object({
2471
+ type: import_v415.z.literal("computer_call"),
2472
+ id: import_v415.z.string(),
2473
+ status: import_v415.z.string().optional()
2411
2474
  }),
2412
- import_v414.z.object({
2413
- type: import_v414.z.literal("reasoning"),
2414
- summary: import_v414.z.array(
2415
- import_v414.z.object({
2416
- type: import_v414.z.literal("summary_text"),
2417
- text: import_v414.z.string()
2475
+ import_v415.z.object({
2476
+ type: import_v415.z.literal("reasoning"),
2477
+ id: import_v415.z.string(),
2478
+ encrypted_content: import_v415.z.string().nullish(),
2479
+ summary: import_v415.z.array(
2480
+ import_v415.z.object({
2481
+ type: import_v415.z.literal("summary_text"),
2482
+ text: import_v415.z.string()
2418
2483
  })
2419
2484
  )
2420
2485
  })
2421
2486
  ])
2422
2487
  ),
2423
- incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullable(),
2488
+ incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullable(),
2424
2489
  usage: usageSchema2
2425
2490
  })
2426
2491
  ),
@@ -2431,10 +2496,23 @@ var OpenAIResponsesLanguageModel = class {
2431
2496
  for (const part of response.output) {
2432
2497
  switch (part.type) {
2433
2498
  case "reasoning": {
2434
- content.push({
2435
- type: "reasoning",
2436
- text: part.summary.map((summary) => summary.text).join()
2437
- });
2499
+ if (part.summary.length === 0) {
2500
+ part.summary.push({ type: "summary_text", text: "" });
2501
+ }
2502
+ for (const summary of part.summary) {
2503
+ content.push({
2504
+ type: "reasoning",
2505
+ text: summary.text,
2506
+ providerMetadata: {
2507
+ openai: {
2508
+ reasoning: {
2509
+ id: part.id,
2510
+ encryptedContent: (_a = part.encrypted_content) != null ? _a : null
2511
+ }
2512
+ }
2513
+ }
2514
+ });
2515
+ }
2438
2516
  break;
2439
2517
  }
2440
2518
  case "message": {
@@ -2447,7 +2525,7 @@ var OpenAIResponsesLanguageModel = class {
2447
2525
  content.push({
2448
2526
  type: "source",
2449
2527
  sourceType: "url",
2450
- id: (_c = (_b = (_a = this.config).generateId) == null ? void 0 : _b.call(_a)) != null ? _c : (0, import_provider_utils11.generateId)(),
2528
+ id: (_d = (_c = (_b = this.config).generateId) == null ? void 0 : _c.call(_b)) != null ? _d : (0, import_provider_utils12.generateId)(),
2451
2529
  url: annotation.url,
2452
2530
  title: annotation.title
2453
2531
  });
@@ -2506,15 +2584,15 @@ var OpenAIResponsesLanguageModel = class {
2506
2584
  return {
2507
2585
  content,
2508
2586
  finishReason: mapOpenAIResponseFinishReason({
2509
- finishReason: (_d = response.incomplete_details) == null ? void 0 : _d.reason,
2587
+ finishReason: (_e = response.incomplete_details) == null ? void 0 : _e.reason,
2510
2588
  hasToolCalls: content.some((part) => part.type === "tool-call")
2511
2589
  }),
2512
2590
  usage: {
2513
2591
  inputTokens: response.usage.input_tokens,
2514
2592
  outputTokens: response.usage.output_tokens,
2515
2593
  totalTokens: response.usage.input_tokens + response.usage.output_tokens,
2516
- reasoningTokens: (_f = (_e = response.usage.output_tokens_details) == null ? void 0 : _e.reasoning_tokens) != null ? _f : void 0,
2517
- cachedInputTokens: (_h = (_g = response.usage.input_tokens_details) == null ? void 0 : _g.cached_tokens) != null ? _h : void 0
2594
+ reasoningTokens: (_g = (_f = response.usage.output_tokens_details) == null ? void 0 : _f.reasoning_tokens) != null ? _g : void 0,
2595
+ cachedInputTokens: (_i = (_h = response.usage.input_tokens_details) == null ? void 0 : _h.cached_tokens) != null ? _i : void 0
2518
2596
  },
2519
2597
  request: { body },
2520
2598
  response: {
@@ -2534,18 +2612,18 @@ var OpenAIResponsesLanguageModel = class {
2534
2612
  }
2535
2613
  async doStream(options) {
2536
2614
  const { args: body, warnings } = await this.getArgs(options);
2537
- const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
2615
+ const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
2538
2616
  url: this.config.url({
2539
2617
  path: "/responses",
2540
2618
  modelId: this.modelId
2541
2619
  }),
2542
- headers: (0, import_provider_utils11.combineHeaders)(this.config.headers(), options.headers),
2620
+ headers: (0, import_provider_utils12.combineHeaders)(this.config.headers(), options.headers),
2543
2621
  body: {
2544
2622
  ...body,
2545
2623
  stream: true
2546
2624
  },
2547
2625
  failedResponseHandler: openaiFailedResponseHandler,
2548
- successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
2626
+ successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
2549
2627
  openaiResponsesChunkSchema
2550
2628
  ),
2551
2629
  abortSignal: options.abortSignal,
@@ -2568,7 +2646,7 @@ var OpenAIResponsesLanguageModel = class {
2568
2646
  controller.enqueue({ type: "stream-start", warnings });
2569
2647
  },
2570
2648
  transform(chunk, controller) {
2571
- var _a, _b, _c, _d, _e, _f, _g, _h;
2649
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2572
2650
  if (options.includeRawChunks) {
2573
2651
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2574
2652
  }
@@ -2617,7 +2695,15 @@ var OpenAIResponsesLanguageModel = class {
2617
2695
  } else if (value.item.type === "reasoning") {
2618
2696
  controller.enqueue({
2619
2697
  type: "reasoning-start",
2620
- id: value.item.id
2698
+ id: value.item.id,
2699
+ providerMetadata: {
2700
+ openai: {
2701
+ reasoning: {
2702
+ id: value.item.id,
2703
+ encryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
2704
+ }
2705
+ }
2706
+ }
2621
2707
  });
2622
2708
  }
2623
2709
  } else if (isResponseOutputItemDoneChunk(value)) {
@@ -2690,7 +2776,15 @@ var OpenAIResponsesLanguageModel = class {
2690
2776
  } else if (value.item.type === "reasoning") {
2691
2777
  controller.enqueue({
2692
2778
  type: "reasoning-end",
2693
- id: value.item.id
2779
+ id: value.item.id,
2780
+ providerMetadata: {
2781
+ openai: {
2782
+ reasoning: {
2783
+ id: value.item.id,
2784
+ encryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
2785
+ }
2786
+ }
2787
+ }
2694
2788
  });
2695
2789
  }
2696
2790
  } else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
@@ -2719,24 +2813,24 @@ var OpenAIResponsesLanguageModel = class {
2719
2813
  } else if (isResponseReasoningSummaryTextDeltaChunk(value)) {
2720
2814
  controller.enqueue({
2721
2815
  type: "reasoning-delta",
2722
- delta: value.delta,
2723
- id: value.item_id
2816
+ id: value.item_id,
2817
+ delta: value.delta
2724
2818
  });
2725
2819
  } else if (isResponseFinishedChunk(value)) {
2726
2820
  finishReason = mapOpenAIResponseFinishReason({
2727
- finishReason: (_a = value.response.incomplete_details) == null ? void 0 : _a.reason,
2821
+ finishReason: (_c = value.response.incomplete_details) == null ? void 0 : _c.reason,
2728
2822
  hasToolCalls
2729
2823
  });
2730
2824
  usage.inputTokens = value.response.usage.input_tokens;
2731
2825
  usage.outputTokens = value.response.usage.output_tokens;
2732
2826
  usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
2733
- usage.reasoningTokens = (_c = (_b = value.response.usage.output_tokens_details) == null ? void 0 : _b.reasoning_tokens) != null ? _c : void 0;
2734
- usage.cachedInputTokens = (_e = (_d = value.response.usage.input_tokens_details) == null ? void 0 : _d.cached_tokens) != null ? _e : void 0;
2827
+ usage.reasoningTokens = (_e = (_d = value.response.usage.output_tokens_details) == null ? void 0 : _d.reasoning_tokens) != null ? _e : void 0;
2828
+ usage.cachedInputTokens = (_g = (_f = value.response.usage.input_tokens_details) == null ? void 0 : _f.cached_tokens) != null ? _g : void 0;
2735
2829
  } else if (isResponseAnnotationAddedChunk(value)) {
2736
2830
  controller.enqueue({
2737
2831
  type: "source",
2738
2832
  sourceType: "url",
2739
- id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0, import_provider_utils11.generateId)(),
2833
+ id: (_j = (_i = (_h = self.config).generateId) == null ? void 0 : _i.call(_h)) != null ? _j : (0, import_provider_utils12.generateId)(),
2740
2834
  url: value.annotation.url,
2741
2835
  title: value.annotation.title
2742
2836
  });
@@ -2761,124 +2855,129 @@ var OpenAIResponsesLanguageModel = class {
2761
2855
  };
2762
2856
  }
2763
2857
  };
2764
- var usageSchema2 = import_v414.z.object({
2765
- input_tokens: import_v414.z.number(),
2766
- input_tokens_details: import_v414.z.object({ cached_tokens: import_v414.z.number().nullish() }).nullish(),
2767
- output_tokens: import_v414.z.number(),
2768
- output_tokens_details: import_v414.z.object({ reasoning_tokens: import_v414.z.number().nullish() }).nullish()
2858
+ var usageSchema2 = import_v415.z.object({
2859
+ input_tokens: import_v415.z.number(),
2860
+ input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
2861
+ output_tokens: import_v415.z.number(),
2862
+ output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
2769
2863
  });
2770
- var textDeltaChunkSchema = import_v414.z.object({
2771
- type: import_v414.z.literal("response.output_text.delta"),
2772
- item_id: import_v414.z.string(),
2773
- delta: import_v414.z.string()
2864
+ var textDeltaChunkSchema = import_v415.z.object({
2865
+ type: import_v415.z.literal("response.output_text.delta"),
2866
+ item_id: import_v415.z.string(),
2867
+ delta: import_v415.z.string()
2774
2868
  });
2775
- var responseFinishedChunkSchema = import_v414.z.object({
2776
- type: import_v414.z.enum(["response.completed", "response.incomplete"]),
2777
- response: import_v414.z.object({
2778
- incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullish(),
2869
+ var responseFinishedChunkSchema = import_v415.z.object({
2870
+ type: import_v415.z.enum(["response.completed", "response.incomplete"]),
2871
+ response: import_v415.z.object({
2872
+ incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
2779
2873
  usage: usageSchema2
2780
2874
  })
2781
2875
  });
2782
- var responseCreatedChunkSchema = import_v414.z.object({
2783
- type: import_v414.z.literal("response.created"),
2784
- response: import_v414.z.object({
2785
- id: import_v414.z.string(),
2786
- created_at: import_v414.z.number(),
2787
- model: import_v414.z.string()
2876
+ var responseCreatedChunkSchema = import_v415.z.object({
2877
+ type: import_v415.z.literal("response.created"),
2878
+ response: import_v415.z.object({
2879
+ id: import_v415.z.string(),
2880
+ created_at: import_v415.z.number(),
2881
+ model: import_v415.z.string()
2788
2882
  })
2789
2883
  });
2790
- var responseOutputItemAddedSchema = import_v414.z.object({
2791
- type: import_v414.z.literal("response.output_item.added"),
2792
- output_index: import_v414.z.number(),
2793
- item: import_v414.z.discriminatedUnion("type", [
2794
- import_v414.z.object({
2795
- type: import_v414.z.literal("message"),
2796
- id: import_v414.z.string()
2884
+ var responseOutputItemAddedSchema = import_v415.z.object({
2885
+ type: import_v415.z.literal("response.output_item.added"),
2886
+ output_index: import_v415.z.number(),
2887
+ item: import_v415.z.discriminatedUnion("type", [
2888
+ import_v415.z.object({
2889
+ type: import_v415.z.literal("message"),
2890
+ id: import_v415.z.string()
2797
2891
  }),
2798
- import_v414.z.object({
2799
- type: import_v414.z.literal("reasoning"),
2800
- id: import_v414.z.string()
2892
+ import_v415.z.object({
2893
+ type: import_v415.z.literal("reasoning"),
2894
+ id: import_v415.z.string(),
2895
+ encrypted_content: import_v415.z.string().nullish(),
2896
+ summary: import_v415.z.array(
2897
+ import_v415.z.object({
2898
+ type: import_v415.z.literal("summary_text"),
2899
+ text: import_v415.z.string()
2900
+ })
2901
+ )
2801
2902
  }),
2802
- import_v414.z.object({
2803
- type: import_v414.z.literal("function_call"),
2804
- id: import_v414.z.string(),
2805
- call_id: import_v414.z.string(),
2806
- name: import_v414.z.string(),
2807
- arguments: import_v414.z.string()
2903
+ import_v415.z.object({
2904
+ type: import_v415.z.literal("function_call"),
2905
+ id: import_v415.z.string(),
2906
+ call_id: import_v415.z.string(),
2907
+ name: import_v415.z.string(),
2908
+ arguments: import_v415.z.string()
2808
2909
  }),
2809
- import_v414.z.object({
2810
- type: import_v414.z.literal("web_search_call"),
2811
- id: import_v414.z.string(),
2812
- status: import_v414.z.string()
2910
+ import_v415.z.object({
2911
+ type: import_v415.z.literal("web_search_call"),
2912
+ id: import_v415.z.string(),
2913
+ status: import_v415.z.string()
2813
2914
  }),
2814
- import_v414.z.object({
2815
- type: import_v414.z.literal("computer_call"),
2816
- id: import_v414.z.string(),
2817
- status: import_v414.z.string()
2915
+ import_v415.z.object({
2916
+ type: import_v415.z.literal("computer_call"),
2917
+ id: import_v415.z.string(),
2918
+ status: import_v415.z.string()
2818
2919
  })
2819
2920
  ])
2820
2921
  });
2821
- var responseOutputItemDoneSchema = import_v414.z.object({
2822
- type: import_v414.z.literal("response.output_item.done"),
2823
- output_index: import_v414.z.number(),
2824
- item: import_v414.z.discriminatedUnion("type", [
2825
- import_v414.z.object({
2826
- type: import_v414.z.literal("message"),
2827
- id: import_v414.z.string()
2922
+ var responseOutputItemDoneSchema = import_v415.z.object({
2923
+ type: import_v415.z.literal("response.output_item.done"),
2924
+ output_index: import_v415.z.number(),
2925
+ item: import_v415.z.discriminatedUnion("type", [
2926
+ import_v415.z.object({
2927
+ type: import_v415.z.literal("message"),
2928
+ id: import_v415.z.string()
2828
2929
  }),
2829
- import_v414.z.object({
2830
- type: import_v414.z.literal("reasoning"),
2831
- id: import_v414.z.string()
2930
+ import_v415.z.object({
2931
+ type: import_v415.z.literal("reasoning"),
2932
+ id: import_v415.z.string(),
2933
+ encrypted_content: import_v415.z.string().nullish(),
2934
+ summary: import_v415.z.array(
2935
+ import_v415.z.object({
2936
+ type: import_v415.z.literal("summary_text"),
2937
+ text: import_v415.z.string()
2938
+ })
2939
+ )
2832
2940
  }),
2833
- import_v414.z.object({
2834
- type: import_v414.z.literal("function_call"),
2835
- id: import_v414.z.string(),
2836
- call_id: import_v414.z.string(),
2837
- name: import_v414.z.string(),
2838
- arguments: import_v414.z.string(),
2839
- status: import_v414.z.literal("completed")
2941
+ import_v415.z.object({
2942
+ type: import_v415.z.literal("function_call"),
2943
+ id: import_v415.z.string(),
2944
+ call_id: import_v415.z.string(),
2945
+ name: import_v415.z.string(),
2946
+ arguments: import_v415.z.string(),
2947
+ status: import_v415.z.literal("completed")
2840
2948
  }),
2841
- import_v414.z.object({
2842
- type: import_v414.z.literal("web_search_call"),
2843
- id: import_v414.z.string(),
2844
- status: import_v414.z.literal("completed")
2949
+ import_v415.z.object({
2950
+ type: import_v415.z.literal("web_search_call"),
2951
+ id: import_v415.z.string(),
2952
+ status: import_v415.z.literal("completed")
2845
2953
  }),
2846
- import_v414.z.object({
2847
- type: import_v414.z.literal("computer_call"),
2848
- id: import_v414.z.string(),
2849
- status: import_v414.z.literal("completed")
2954
+ import_v415.z.object({
2955
+ type: import_v415.z.literal("computer_call"),
2956
+ id: import_v415.z.string(),
2957
+ status: import_v415.z.literal("completed")
2850
2958
  })
2851
2959
  ])
2852
2960
  });
2853
- var responseFunctionCallArgumentsDeltaSchema = import_v414.z.object({
2854
- type: import_v414.z.literal("response.function_call_arguments.delta"),
2855
- item_id: import_v414.z.string(),
2856
- output_index: import_v414.z.number(),
2857
- delta: import_v414.z.string()
2961
+ var responseFunctionCallArgumentsDeltaSchema = import_v415.z.object({
2962
+ type: import_v415.z.literal("response.function_call_arguments.delta"),
2963
+ item_id: import_v415.z.string(),
2964
+ output_index: import_v415.z.number(),
2965
+ delta: import_v415.z.string()
2858
2966
  });
2859
- var responseAnnotationAddedSchema = import_v414.z.object({
2860
- type: import_v414.z.literal("response.output_text.annotation.added"),
2861
- annotation: import_v414.z.object({
2862
- type: import_v414.z.literal("url_citation"),
2863
- url: import_v414.z.string(),
2864
- title: import_v414.z.string()
2967
+ var responseAnnotationAddedSchema = import_v415.z.object({
2968
+ type: import_v415.z.literal("response.output_text.annotation.added"),
2969
+ annotation: import_v415.z.object({
2970
+ type: import_v415.z.literal("url_citation"),
2971
+ url: import_v415.z.string(),
2972
+ title: import_v415.z.string()
2865
2973
  })
2866
2974
  });
2867
- var responseReasoningSummaryTextDeltaSchema = import_v414.z.object({
2868
- type: import_v414.z.literal("response.reasoning_summary_text.delta"),
2869
- item_id: import_v414.z.string(),
2870
- output_index: import_v414.z.number(),
2871
- summary_index: import_v414.z.number(),
2872
- delta: import_v414.z.string()
2873
- });
2874
- var responseReasoningSummaryPartDoneSchema = import_v414.z.object({
2875
- type: import_v414.z.literal("response.reasoning_summary_part.done"),
2876
- item_id: import_v414.z.string(),
2877
- output_index: import_v414.z.number(),
2878
- summary_index: import_v414.z.number(),
2879
- part: import_v414.z.unknown().nullish()
2975
+ var responseReasoningSummaryTextDeltaSchema = import_v415.z.object({
2976
+ type: import_v415.z.literal("response.reasoning_summary_text.delta"),
2977
+ item_id: import_v415.z.string(),
2978
+ delta: import_v415.z.string()
2880
2979
  });
2881
- var openaiResponsesChunkSchema = import_v414.z.union([
2980
+ var openaiResponsesChunkSchema = import_v415.z.union([
2882
2981
  textDeltaChunkSchema,
2883
2982
  responseFinishedChunkSchema,
2884
2983
  responseCreatedChunkSchema,
@@ -2887,8 +2986,7 @@ var openaiResponsesChunkSchema = import_v414.z.union([
2887
2986
  responseFunctionCallArgumentsDeltaSchema,
2888
2987
  responseAnnotationAddedSchema,
2889
2988
  responseReasoningSummaryTextDeltaSchema,
2890
- responseReasoningSummaryPartDoneSchema,
2891
- import_v414.z.object({ type: import_v414.z.string() }).passthrough()
2989
+ import_v415.z.object({ type: import_v415.z.string() }).passthrough()
2892
2990
  // fallback for unknown chunks
2893
2991
  ]);
2894
2992
  function isTextDeltaChunk(chunk) {
@@ -2916,7 +3014,7 @@ function isResponseReasoningSummaryTextDeltaChunk(chunk) {
2916
3014
  return chunk.type === "response.reasoning_summary_text.delta";
2917
3015
  }
2918
3016
  function getResponsesModelConfig(modelId) {
2919
- if (modelId.startsWith("o")) {
3017
+ if (modelId.startsWith("o") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
2920
3018
  if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
2921
3019
  return {
2922
3020
  isReasoningModel: true,
@@ -2939,17 +3037,18 @@ function getResponsesModelConfig(modelId) {
2939
3037
  function supportsFlexProcessing2(modelId) {
2940
3038
  return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
2941
3039
  }
2942
- var openaiResponsesProviderOptionsSchema = import_v414.z.object({
2943
- metadata: import_v414.z.any().nullish(),
2944
- parallelToolCalls: import_v414.z.boolean().nullish(),
2945
- previousResponseId: import_v414.z.string().nullish(),
2946
- store: import_v414.z.boolean().nullish(),
2947
- user: import_v414.z.string().nullish(),
2948
- reasoningEffort: import_v414.z.string().nullish(),
2949
- strictJsonSchema: import_v414.z.boolean().nullish(),
2950
- instructions: import_v414.z.string().nullish(),
2951
- reasoningSummary: import_v414.z.string().nullish(),
2952
- serviceTier: import_v414.z.enum(["auto", "flex"]).nullish()
3040
+ var openaiResponsesProviderOptionsSchema = import_v415.z.object({
3041
+ metadata: import_v415.z.any().nullish(),
3042
+ parallelToolCalls: import_v415.z.boolean().nullish(),
3043
+ previousResponseId: import_v415.z.string().nullish(),
3044
+ store: import_v415.z.boolean().nullish(),
3045
+ user: import_v415.z.string().nullish(),
3046
+ reasoningEffort: import_v415.z.string().nullish(),
3047
+ strictJsonSchema: import_v415.z.boolean().nullish(),
3048
+ instructions: import_v415.z.string().nullish(),
3049
+ reasoningSummary: import_v415.z.string().nullish(),
3050
+ serviceTier: import_v415.z.enum(["auto", "flex"]).nullish(),
3051
+ include: import_v415.z.array(import_v415.z.enum(["reasoning.encrypted_content"])).nullish()
2953
3052
  });
2954
3053
  // Annotate the CommonJS export names for ESM import in node:
2955
3054
  0 && (module.exports = {