@ai-sdk/openai 2.0.129 → 2.0.130

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.
@@ -2409,6 +2409,7 @@ var OpenAISpeechModel = class {
2409
2409
 
2410
2410
  // src/responses/openai-responses-language-model.ts
2411
2411
  import {
2412
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
2412
2413
  APICallError
2413
2414
  } from "@ai-sdk/provider";
2414
2415
  import {
@@ -2429,31 +2430,235 @@ import {
2429
2430
  parseProviderOptions as parseProviderOptions7,
2430
2431
  validateTypes
2431
2432
  } from "@ai-sdk/provider-utils";
2432
- import { z as z14 } from "zod/v4";
2433
+ import { z as z15 } from "zod/v4";
2433
2434
 
2434
- // src/tool/local-shell.ts
2435
+ // src/responses/openai-responses-options.ts
2435
2436
  import {
2436
- createProviderDefinedToolFactoryWithOutputSchema,
2437
- lazySchema,
2437
+ lazyValidator as lazyValidator12,
2438
2438
  zodSchema as zodSchema12
2439
2439
  } from "@ai-sdk/provider-utils";
2440
2440
  import { z as z13 } from "zod/v4";
2441
- var localShellInputSchema = lazySchema(
2441
+ var TOP_LOGPROBS_MAX = 20;
2442
+ var openaiResponsesReasoningModelIds = [
2443
+ "o1",
2444
+ "o1-2024-12-17",
2445
+ "o3",
2446
+ "o3-2025-04-16",
2447
+ "o3-deep-research",
2448
+ "o3-deep-research-2025-06-26",
2449
+ "o3-mini",
2450
+ "o3-mini-2025-01-31",
2451
+ "o4-mini",
2452
+ "o4-mini-2025-04-16",
2453
+ "o4-mini-deep-research",
2454
+ "o4-mini-deep-research-2025-06-26",
2455
+ "codex-mini-latest",
2456
+ "computer-use-preview",
2457
+ "gpt-5",
2458
+ "gpt-5-2025-08-07",
2459
+ "gpt-5-codex",
2460
+ "gpt-5-mini",
2461
+ "gpt-5-mini-2025-08-07",
2462
+ "gpt-5-nano",
2463
+ "gpt-5-nano-2025-08-07",
2464
+ "gpt-5-pro",
2465
+ "gpt-5-pro-2025-10-06",
2466
+ "gpt-5.1",
2467
+ "gpt-5.1-chat-latest",
2468
+ "gpt-5.1-codex-mini",
2469
+ "gpt-5.1-codex",
2470
+ "gpt-5.1-codex-max",
2471
+ "gpt-5.2",
2472
+ "gpt-5.2-chat-latest",
2473
+ "gpt-5.2-pro",
2474
+ "gpt-5.2-codex",
2475
+ "gpt-5.3-chat-latest",
2476
+ "gpt-5.3-codex",
2477
+ "gpt-5.4",
2478
+ "gpt-5.4-2026-03-05",
2479
+ "gpt-5.4-mini",
2480
+ "gpt-5.4-mini-2026-03-17",
2481
+ "gpt-5.4-nano",
2482
+ "gpt-5.4-nano-2026-03-17",
2483
+ "gpt-5.4-pro",
2484
+ "gpt-5.4-pro-2026-03-05",
2485
+ "gpt-5.6",
2486
+ "gpt-5.6-luna",
2487
+ "gpt-5.6-sol",
2488
+ "gpt-5.6-terra",
2489
+ "gpt-6-astra",
2490
+ "gpt-6-luna",
2491
+ "gpt-6-sol"
2492
+ ];
2493
+ var openaiResponsesModelIds = [
2494
+ "gpt-4.1",
2495
+ "gpt-4.1-2025-04-14",
2496
+ "gpt-4.1-mini",
2497
+ "gpt-4.1-mini-2025-04-14",
2498
+ "gpt-4.1-nano",
2499
+ "gpt-4.1-nano-2025-04-14",
2500
+ "gpt-4o",
2501
+ "gpt-4o-2024-05-13",
2502
+ "gpt-4o-2024-08-06",
2503
+ "gpt-4o-2024-11-20",
2504
+ "gpt-4o-audio-preview",
2505
+ "gpt-4o-audio-preview-2024-10-01",
2506
+ "gpt-4o-audio-preview-2024-12-17",
2507
+ "gpt-4o-search-preview",
2508
+ "gpt-4o-search-preview-2025-03-11",
2509
+ "gpt-4o-mini-search-preview",
2510
+ "gpt-4o-mini-search-preview-2025-03-11",
2511
+ "gpt-4o-mini",
2512
+ "gpt-4o-mini-2024-07-18",
2513
+ "gpt-4-turbo",
2514
+ "gpt-4-turbo-2024-04-09",
2515
+ "gpt-4-turbo-preview",
2516
+ "gpt-4-0125-preview",
2517
+ "gpt-4-1106-preview",
2518
+ "gpt-4",
2519
+ "gpt-4-0613",
2520
+ "gpt-4.5-preview",
2521
+ "gpt-4.5-preview-2025-02-27",
2522
+ "gpt-3.5-turbo-0125",
2523
+ "gpt-3.5-turbo",
2524
+ "gpt-3.5-turbo-1106",
2525
+ "chatgpt-4o-latest",
2526
+ "gpt-5-chat-latest",
2527
+ ...openaiResponsesReasoningModelIds
2528
+ ];
2529
+ var openaiResponsesProviderOptionsSchema = lazyValidator12(
2442
2530
  () => zodSchema12(
2443
2531
  z13.object({
2444
- action: z13.object({
2445
- type: z13.literal("exec"),
2446
- command: z13.array(z13.string()),
2447
- timeoutMs: z13.number().optional(),
2448
- user: z13.string().optional(),
2449
- workingDirectory: z13.string().optional(),
2450
- env: z13.record(z13.string(), z13.string()).optional()
2532
+ conversation: z13.string().nullish(),
2533
+ include: z13.array(
2534
+ z13.enum([
2535
+ "reasoning.encrypted_content",
2536
+ // handled internally by default, only needed for unknown reasoning models
2537
+ "file_search_call.results",
2538
+ "message.output_text.logprobs"
2539
+ ])
2540
+ ).nullish(),
2541
+ instructions: z13.string().nullish(),
2542
+ /**
2543
+ * Return the log probabilities of the tokens.
2544
+ *
2545
+ * Setting to true will return the log probabilities of the tokens that
2546
+ * were generated.
2547
+ *
2548
+ * Setting to a number will return the log probabilities of the top n
2549
+ * tokens that were generated.
2550
+ *
2551
+ * @see https://platform.openai.com/docs/api-reference/responses/create
2552
+ * @see https://cookbook.openai.com/examples/using_logprobs
2553
+ */
2554
+ logprobs: z13.union([z13.boolean(), z13.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2555
+ /**
2556
+ * The maximum number of total calls to built-in tools that can be processed in a response.
2557
+ * This maximum number applies across all built-in tool calls, not per individual tool.
2558
+ * Any further attempts to call a tool by the model will be ignored.
2559
+ */
2560
+ maxToolCalls: z13.number().nullish(),
2561
+ metadata: z13.any().nullish(),
2562
+ parallelToolCalls: z13.boolean().nullish(),
2563
+ previousResponseId: z13.string().nullish(),
2564
+ promptCacheKey: z13.string().nullish(),
2565
+ /**
2566
+ * Prompt cache behavior for GPT-5.6 and later models.
2567
+ * `mode` controls whether OpenAI also places an implicit breakpoint.
2568
+ * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2569
+ */
2570
+ promptCacheOptions: z13.object({
2571
+ mode: z13.enum(["implicit", "explicit"]).optional(),
2572
+ ttl: z13.literal("30m").optional()
2573
+ }).optional(),
2574
+ /**
2575
+ * The retention policy for the prompt cache.
2576
+ * - 'in_memory': Default. Standard prompt caching behavior.
2577
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2578
+ * Available for models before GPT-5.6 that support extended caching.
2579
+ *
2580
+ * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
2581
+ *
2582
+ * @default 'in_memory'
2583
+ */
2584
+ promptCacheRetention: z13.enum(["in_memory", "24h"]).nullish(),
2585
+ /**
2586
+ * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2587
+ * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2588
+ * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2589
+ * Supported values vary by model.
2590
+ */
2591
+ reasoningEffort: z13.string().nullish(),
2592
+ /**
2593
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
2594
+ * without changing the request-level reasoning effort. This preserves the
2595
+ * request prefix for prompt caching.
2596
+ *
2597
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
2598
+ * combined with automatic truncation.
2599
+ */
2600
+ reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2601
+ /**
2602
+ * Controls how much model work GPT-5.6 performs before returning a final answer.
2603
+ * `standard` is the default. `pro` increases quality, latency, and token usage.
2604
+ */
2605
+ reasoningMode: z13.enum(["standard", "pro"]).optional(),
2606
+ /**
2607
+ * Controls which available reasoning items GPT-5.6 can use.
2608
+ * `auto` uses the model default, `current_turn` excludes reasoning from earlier
2609
+ * turns, and `all_turns` makes compatible earlier reasoning available.
2610
+ */
2611
+ reasoningContext: z13.enum(["auto", "current_turn", "all_turns"]).optional(),
2612
+ reasoningSummary: z13.string().nullish(),
2613
+ safetyIdentifier: z13.string().nullish(),
2614
+ serviceTier: z13.enum(["auto", "flex", "priority", "default"]).nullish(),
2615
+ store: z13.boolean().nullish(),
2616
+ strictJsonSchema: z13.boolean().nullish(),
2617
+ textVerbosity: z13.enum(["low", "medium", "high"]).nullish(),
2618
+ truncation: z13.enum(["auto", "disabled"]).nullish(),
2619
+ user: z13.string().nullish()
2620
+ })
2621
+ )
2622
+ );
2623
+ var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
2624
+ () => zodSchema12(
2625
+ z13.object({
2626
+ /**
2627
+ * Emit a configuration update at this position in Responses history.
2628
+ * Requires empty system message content and the same supported
2629
+ * configuration as the request-level reasoningEffortUpdate option.
2630
+ * Unsupported historical updates throw instead of being omitted.
2631
+ *
2632
+ * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
2633
+ */
2634
+ reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2635
+ })
2636
+ )
2637
+ );
2638
+
2639
+ // src/tool/local-shell.ts
2640
+ import {
2641
+ createProviderDefinedToolFactoryWithOutputSchema,
2642
+ lazySchema,
2643
+ zodSchema as zodSchema13
2644
+ } from "@ai-sdk/provider-utils";
2645
+ import { z as z14 } from "zod/v4";
2646
+ var localShellInputSchema = lazySchema(
2647
+ () => zodSchema13(
2648
+ z14.object({
2649
+ action: z14.object({
2650
+ type: z14.literal("exec"),
2651
+ command: z14.array(z14.string()),
2652
+ timeoutMs: z14.number().optional(),
2653
+ user: z14.string().optional(),
2654
+ workingDirectory: z14.string().optional(),
2655
+ env: z14.record(z14.string(), z14.string()).optional()
2451
2656
  })
2452
2657
  })
2453
2658
  )
2454
2659
  );
2455
2660
  var localShellOutputSchema = lazySchema(
2456
- () => zodSchema12(z13.object({ output: z13.string() }))
2661
+ () => zodSchema13(z14.object({ output: z14.string() }))
2457
2662
  );
2458
2663
  var localShell = createProviderDefinedToolFactoryWithOutputSchema({
2459
2664
  id: "openai.local_shell",
@@ -2474,9 +2679,11 @@ function isFileId(data, prefixes) {
2474
2679
  async function convertToOpenAIResponsesInput({
2475
2680
  prompt,
2476
2681
  systemMessageMode,
2682
+ providerOptionsName = "openai",
2477
2683
  explicitMessageItemType = false,
2478
2684
  fileIdPrefixes,
2479
2685
  store,
2686
+ configurationUpdateUnsupportedReason,
2480
2687
  hasLocalShellTool = false
2481
2688
  }) {
2482
2689
  var _a2, _b, _c, _d, _e, _f, _g, _h;
@@ -2485,6 +2692,33 @@ async function convertToOpenAIResponsesInput({
2485
2692
  for (const { role, content, providerOptions } of prompt) {
2486
2693
  switch (role) {
2487
2694
  case "system": {
2695
+ let options = await parseProviderOptions7({
2696
+ provider: providerOptionsName,
2697
+ providerOptions,
2698
+ schema: openaiResponsesSystemMessageOptionsSchema
2699
+ });
2700
+ if (options == null && providerOptionsName !== "openai") {
2701
+ options = await parseProviderOptions7({
2702
+ provider: "openai",
2703
+ providerOptions,
2704
+ schema: openaiResponsesSystemMessageOptionsSchema
2705
+ });
2706
+ }
2707
+ const effort = options == null ? void 0 : options.reasoningEffortUpdate;
2708
+ if (effort != null) {
2709
+ const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
2710
+ if (unsupportedReason != null) {
2711
+ throw new UnsupportedFunctionalityError4({
2712
+ functionality: "Message-level reasoningEffortUpdate",
2713
+ message: unsupportedReason
2714
+ });
2715
+ }
2716
+ input.push({
2717
+ type: "configuration_update",
2718
+ reasoning: { effort }
2719
+ });
2720
+ break;
2721
+ }
2488
2722
  switch (systemMessageMode) {
2489
2723
  case "system": {
2490
2724
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
@@ -2830,9 +3064,9 @@ async function convertToOpenAIResponsesInput({
2830
3064
  }
2831
3065
  return { input, warnings };
2832
3066
  }
2833
- var openaiResponsesReasoningProviderOptionsSchema = z14.object({
2834
- itemId: z14.string().nullish(),
2835
- reasoningEncryptedContent: z14.string().nullish()
3067
+ var openaiResponsesReasoningProviderOptionsSchema = z15.object({
3068
+ itemId: z15.string().nullish(),
3069
+ reasoningEncryptedContent: z15.string().nullish()
2836
3070
  });
2837
3071
 
2838
3072
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2855,290 +3089,290 @@ function mapOpenAIResponseFinishReason({
2855
3089
 
2856
3090
  // src/responses/openai-responses-api.ts
2857
3091
  import {
2858
- lazyValidator as lazyValidator12,
2859
- zodSchema as zodSchema13
3092
+ lazyValidator as lazyValidator13,
3093
+ zodSchema as zodSchema14
2860
3094
  } from "@ai-sdk/provider-utils";
2861
- import { z as z15 } from "zod/v4";
2862
- var openaiResponsesChunkSchema = lazyValidator12(
2863
- () => zodSchema13(
2864
- z15.union([
2865
- z15.object({
2866
- type: z15.literal("response.output_text.delta"),
2867
- item_id: z15.string(),
2868
- delta: z15.string(),
2869
- logprobs: z15.array(
2870
- z15.object({
2871
- token: z15.string(),
2872
- logprob: z15.number(),
2873
- top_logprobs: z15.array(
2874
- z15.object({
2875
- token: z15.string(),
2876
- logprob: z15.number()
3095
+ import { z as z16 } from "zod/v4";
3096
+ var openaiResponsesChunkSchema = lazyValidator13(
3097
+ () => zodSchema14(
3098
+ z16.union([
3099
+ z16.object({
3100
+ type: z16.literal("response.output_text.delta"),
3101
+ item_id: z16.string(),
3102
+ delta: z16.string(),
3103
+ logprobs: z16.array(
3104
+ z16.object({
3105
+ token: z16.string(),
3106
+ logprob: z16.number(),
3107
+ top_logprobs: z16.array(
3108
+ z16.object({
3109
+ token: z16.string(),
3110
+ logprob: z16.number()
2877
3111
  })
2878
3112
  )
2879
3113
  })
2880
3114
  ).nullish()
2881
3115
  }),
2882
- z15.object({
2883
- type: z15.enum(["response.completed", "response.incomplete"]),
2884
- response: z15.object({
2885
- incomplete_details: z15.object({ reason: z15.string() }).nullish(),
2886
- usage: z15.object({
2887
- input_tokens: z15.number(),
2888
- input_tokens_details: z15.object({
2889
- cached_tokens: z15.number().nullish(),
2890
- cache_write_tokens: z15.number().nullish(),
2891
- orchestration_input_tokens: z15.number().nullish(),
2892
- orchestration_input_cached_tokens: z15.number().nullish()
3116
+ z16.object({
3117
+ type: z16.enum(["response.completed", "response.incomplete"]),
3118
+ response: z16.object({
3119
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3120
+ usage: z16.object({
3121
+ input_tokens: z16.number(),
3122
+ input_tokens_details: z16.object({
3123
+ cached_tokens: z16.number().nullish(),
3124
+ cache_write_tokens: z16.number().nullish(),
3125
+ orchestration_input_tokens: z16.number().nullish(),
3126
+ orchestration_input_cached_tokens: z16.number().nullish()
2893
3127
  }).nullish(),
2894
- output_tokens: z15.number(),
2895
- output_tokens_details: z15.object({
2896
- reasoning_tokens: z15.number().nullish(),
2897
- orchestration_output_tokens: z15.number().nullish()
3128
+ output_tokens: z16.number(),
3129
+ output_tokens_details: z16.object({
3130
+ reasoning_tokens: z16.number().nullish(),
3131
+ orchestration_output_tokens: z16.number().nullish()
2898
3132
  }).nullish()
2899
3133
  }),
2900
- reasoning: z15.object({
2901
- context: z15.string().nullish()
3134
+ reasoning: z16.object({
3135
+ context: z16.string().nullish()
2902
3136
  }).nullish(),
2903
- service_tier: z15.string().nullish()
3137
+ service_tier: z16.string().nullish()
2904
3138
  })
2905
3139
  }),
2906
- z15.object({
2907
- type: z15.literal("response.created"),
2908
- response: z15.object({
2909
- id: z15.string(),
2910
- created_at: z15.number(),
2911
- model: z15.string(),
2912
- service_tier: z15.string().nullish()
3140
+ z16.object({
3141
+ type: z16.literal("response.created"),
3142
+ response: z16.object({
3143
+ id: z16.string(),
3144
+ created_at: z16.number(),
3145
+ model: z16.string(),
3146
+ service_tier: z16.string().nullish()
2913
3147
  })
2914
3148
  }),
2915
- z15.object({
2916
- type: z15.literal("response.output_item.added"),
2917
- output_index: z15.number(),
2918
- item: z15.discriminatedUnion("type", [
2919
- z15.object({
2920
- type: z15.literal("message"),
2921
- id: z15.string(),
2922
- phase: z15.enum(["commentary", "final_answer"]).nullish()
3149
+ z16.object({
3150
+ type: z16.literal("response.output_item.added"),
3151
+ output_index: z16.number(),
3152
+ item: z16.discriminatedUnion("type", [
3153
+ z16.object({
3154
+ type: z16.literal("message"),
3155
+ id: z16.string(),
3156
+ phase: z16.enum(["commentary", "final_answer"]).nullish()
2923
3157
  }),
2924
- z15.object({
2925
- type: z15.literal("reasoning"),
2926
- id: z15.string(),
2927
- encrypted_content: z15.string().nullish()
3158
+ z16.object({
3159
+ type: z16.literal("reasoning"),
3160
+ id: z16.string(),
3161
+ encrypted_content: z16.string().nullish()
2928
3162
  }),
2929
- z15.object({
2930
- type: z15.literal("function_call"),
2931
- id: z15.string(),
2932
- call_id: z15.string(),
2933
- name: z15.string(),
2934
- arguments: z15.string(),
2935
- async: z15.boolean().nullish()
3163
+ z16.object({
3164
+ type: z16.literal("function_call"),
3165
+ id: z16.string(),
3166
+ call_id: z16.string(),
3167
+ name: z16.string(),
3168
+ arguments: z16.string(),
3169
+ async: z16.boolean().nullish()
2936
3170
  }),
2937
- z15.object({
2938
- type: z15.literal("web_search_call"),
2939
- id: z15.string(),
2940
- status: z15.string()
3171
+ z16.object({
3172
+ type: z16.literal("web_search_call"),
3173
+ id: z16.string(),
3174
+ status: z16.string()
2941
3175
  }),
2942
- z15.object({
2943
- type: z15.literal("computer_call"),
2944
- id: z15.string(),
2945
- status: z15.string()
3176
+ z16.object({
3177
+ type: z16.literal("computer_call"),
3178
+ id: z16.string(),
3179
+ status: z16.string()
2946
3180
  }),
2947
- z15.object({
2948
- type: z15.literal("file_search_call"),
2949
- id: z15.string()
3181
+ z16.object({
3182
+ type: z16.literal("file_search_call"),
3183
+ id: z16.string()
2950
3184
  }),
2951
- z15.object({
2952
- type: z15.literal("image_generation_call"),
2953
- id: z15.string()
3185
+ z16.object({
3186
+ type: z16.literal("image_generation_call"),
3187
+ id: z16.string()
2954
3188
  }),
2955
- z15.object({
2956
- type: z15.literal("code_interpreter_call"),
2957
- id: z15.string(),
2958
- container_id: z15.string(),
2959
- code: z15.string().nullable(),
2960
- outputs: z15.array(
2961
- z15.discriminatedUnion("type", [
2962
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
2963
- z15.object({ type: z15.literal("image"), url: z15.string() })
3189
+ z16.object({
3190
+ type: z16.literal("code_interpreter_call"),
3191
+ id: z16.string(),
3192
+ container_id: z16.string(),
3193
+ code: z16.string().nullable(),
3194
+ outputs: z16.array(
3195
+ z16.discriminatedUnion("type", [
3196
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3197
+ z16.object({ type: z16.literal("image"), url: z16.string() })
2964
3198
  ])
2965
3199
  ).nullable(),
2966
- status: z15.string()
3200
+ status: z16.string()
2967
3201
  })
2968
3202
  ])
2969
3203
  }),
2970
- z15.object({
2971
- type: z15.literal("response.output_item.done"),
2972
- output_index: z15.number(),
2973
- item: z15.discriminatedUnion("type", [
2974
- z15.object({
2975
- type: z15.literal("message"),
2976
- id: z15.string(),
2977
- phase: z15.enum(["commentary", "final_answer"]).nullish()
3204
+ z16.object({
3205
+ type: z16.literal("response.output_item.done"),
3206
+ output_index: z16.number(),
3207
+ item: z16.discriminatedUnion("type", [
3208
+ z16.object({
3209
+ type: z16.literal("message"),
3210
+ id: z16.string(),
3211
+ phase: z16.enum(["commentary", "final_answer"]).nullish()
2978
3212
  }),
2979
- z15.object({
2980
- type: z15.literal("reasoning"),
2981
- id: z15.string(),
2982
- encrypted_content: z15.string().nullish()
3213
+ z16.object({
3214
+ type: z16.literal("reasoning"),
3215
+ id: z16.string(),
3216
+ encrypted_content: z16.string().nullish()
2983
3217
  }),
2984
- z15.object({
2985
- type: z15.literal("function_call"),
2986
- id: z15.string(),
2987
- call_id: z15.string(),
2988
- name: z15.string(),
2989
- arguments: z15.string(),
2990
- async: z15.boolean().nullish(),
2991
- status: z15.enum(["in_progress", "completed", "incomplete"])
3218
+ z16.object({
3219
+ type: z16.literal("function_call"),
3220
+ id: z16.string(),
3221
+ call_id: z16.string(),
3222
+ name: z16.string(),
3223
+ arguments: z16.string(),
3224
+ async: z16.boolean().nullish(),
3225
+ status: z16.enum(["in_progress", "completed", "incomplete"])
2992
3226
  }),
2993
- z15.object({
2994
- type: z15.literal("code_interpreter_call"),
2995
- id: z15.string(),
2996
- code: z15.string().nullable(),
2997
- container_id: z15.string(),
2998
- outputs: z15.array(
2999
- z15.discriminatedUnion("type", [
3000
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
3001
- z15.object({ type: z15.literal("image"), url: z15.string() })
3227
+ z16.object({
3228
+ type: z16.literal("code_interpreter_call"),
3229
+ id: z16.string(),
3230
+ code: z16.string().nullable(),
3231
+ container_id: z16.string(),
3232
+ outputs: z16.array(
3233
+ z16.discriminatedUnion("type", [
3234
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3235
+ z16.object({ type: z16.literal("image"), url: z16.string() })
3002
3236
  ])
3003
3237
  ).nullable()
3004
3238
  }),
3005
- z15.object({
3006
- type: z15.literal("image_generation_call"),
3007
- id: z15.string(),
3008
- result: z15.string()
3239
+ z16.object({
3240
+ type: z16.literal("image_generation_call"),
3241
+ id: z16.string(),
3242
+ result: z16.string()
3009
3243
  }),
3010
- z15.object({
3011
- type: z15.literal("web_search_call"),
3012
- id: z15.string(),
3013
- status: z15.string(),
3014
- action: z15.discriminatedUnion("type", [
3015
- z15.object({
3016
- type: z15.literal("search"),
3017
- query: z15.string().nullish(),
3018
- sources: z15.array(
3019
- z15.discriminatedUnion("type", [
3020
- z15.object({ type: z15.literal("url"), url: z15.string() }),
3021
- z15.object({ type: z15.literal("api"), name: z15.string() })
3244
+ z16.object({
3245
+ type: z16.literal("web_search_call"),
3246
+ id: z16.string(),
3247
+ status: z16.string(),
3248
+ action: z16.discriminatedUnion("type", [
3249
+ z16.object({
3250
+ type: z16.literal("search"),
3251
+ query: z16.string().nullish(),
3252
+ sources: z16.array(
3253
+ z16.discriminatedUnion("type", [
3254
+ z16.object({ type: z16.literal("url"), url: z16.string() }),
3255
+ z16.object({ type: z16.literal("api"), name: z16.string() })
3022
3256
  ])
3023
3257
  ).nullish()
3024
3258
  }),
3025
- z15.object({
3026
- type: z15.literal("open_page"),
3027
- url: z15.string().nullish()
3259
+ z16.object({
3260
+ type: z16.literal("open_page"),
3261
+ url: z16.string().nullish()
3028
3262
  }),
3029
- z15.object({
3030
- type: z15.literal("find_in_page"),
3031
- url: z15.string().nullish(),
3032
- pattern: z15.string().nullish()
3263
+ z16.object({
3264
+ type: z16.literal("find_in_page"),
3265
+ url: z16.string().nullish(),
3266
+ pattern: z16.string().nullish()
3033
3267
  })
3034
3268
  ]).nullish()
3035
3269
  }),
3036
- z15.object({
3037
- type: z15.literal("file_search_call"),
3038
- id: z15.string(),
3039
- queries: z15.array(z15.string()),
3040
- results: z15.array(
3041
- z15.object({
3042
- attributes: z15.record(z15.string(), z15.unknown()),
3043
- file_id: z15.string(),
3044
- filename: z15.string(),
3045
- score: z15.number(),
3046
- text: z15.string()
3270
+ z16.object({
3271
+ type: z16.literal("file_search_call"),
3272
+ id: z16.string(),
3273
+ queries: z16.array(z16.string()),
3274
+ results: z16.array(
3275
+ z16.object({
3276
+ attributes: z16.record(z16.string(), z16.unknown()),
3277
+ file_id: z16.string(),
3278
+ filename: z16.string(),
3279
+ score: z16.number(),
3280
+ text: z16.string()
3047
3281
  })
3048
3282
  ).nullish()
3049
3283
  }),
3050
- z15.object({
3051
- type: z15.literal("local_shell_call"),
3052
- id: z15.string(),
3053
- call_id: z15.string(),
3054
- action: z15.object({
3055
- type: z15.literal("exec"),
3056
- command: z15.array(z15.string()),
3057
- timeout_ms: z15.number().optional(),
3058
- user: z15.string().optional(),
3059
- working_directory: z15.string().optional(),
3060
- env: z15.record(z15.string(), z15.string()).optional()
3284
+ z16.object({
3285
+ type: z16.literal("local_shell_call"),
3286
+ id: z16.string(),
3287
+ call_id: z16.string(),
3288
+ action: z16.object({
3289
+ type: z16.literal("exec"),
3290
+ command: z16.array(z16.string()),
3291
+ timeout_ms: z16.number().optional(),
3292
+ user: z16.string().optional(),
3293
+ working_directory: z16.string().optional(),
3294
+ env: z16.record(z16.string(), z16.string()).optional()
3061
3295
  })
3062
3296
  }),
3063
- z15.object({
3064
- type: z15.literal("computer_call"),
3065
- id: z15.string(),
3066
- status: z15.literal("completed")
3297
+ z16.object({
3298
+ type: z16.literal("computer_call"),
3299
+ id: z16.string(),
3300
+ status: z16.literal("completed")
3067
3301
  })
3068
3302
  ])
3069
3303
  }),
3070
- z15.object({
3071
- type: z15.literal("response.function_call_arguments.delta"),
3072
- item_id: z15.string(),
3073
- output_index: z15.number(),
3074
- delta: z15.string()
3304
+ z16.object({
3305
+ type: z16.literal("response.function_call_arguments.delta"),
3306
+ item_id: z16.string(),
3307
+ output_index: z16.number(),
3308
+ delta: z16.string()
3075
3309
  }),
3076
- z15.object({
3077
- type: z15.literal("response.image_generation_call.partial_image"),
3078
- item_id: z15.string(),
3079
- output_index: z15.number(),
3080
- partial_image_b64: z15.string()
3310
+ z16.object({
3311
+ type: z16.literal("response.image_generation_call.partial_image"),
3312
+ item_id: z16.string(),
3313
+ output_index: z16.number(),
3314
+ partial_image_b64: z16.string()
3081
3315
  }),
3082
- z15.object({
3083
- type: z15.literal("response.code_interpreter_call_code.delta"),
3084
- item_id: z15.string(),
3085
- output_index: z15.number(),
3086
- delta: z15.string()
3316
+ z16.object({
3317
+ type: z16.literal("response.code_interpreter_call_code.delta"),
3318
+ item_id: z16.string(),
3319
+ output_index: z16.number(),
3320
+ delta: z16.string()
3087
3321
  }),
3088
- z15.object({
3089
- type: z15.literal("response.code_interpreter_call_code.done"),
3090
- item_id: z15.string(),
3091
- output_index: z15.number(),
3092
- code: z15.string()
3322
+ z16.object({
3323
+ type: z16.literal("response.code_interpreter_call_code.done"),
3324
+ item_id: z16.string(),
3325
+ output_index: z16.number(),
3326
+ code: z16.string()
3093
3327
  }),
3094
- z15.object({
3095
- type: z15.literal("response.output_text.annotation.added"),
3096
- annotation: z15.discriminatedUnion("type", [
3097
- z15.object({
3098
- type: z15.literal("url_citation"),
3099
- start_index: z15.number(),
3100
- end_index: z15.number(),
3101
- url: z15.string(),
3102
- title: z15.string()
3328
+ z16.object({
3329
+ type: z16.literal("response.output_text.annotation.added"),
3330
+ annotation: z16.discriminatedUnion("type", [
3331
+ z16.object({
3332
+ type: z16.literal("url_citation"),
3333
+ start_index: z16.number(),
3334
+ end_index: z16.number(),
3335
+ url: z16.string(),
3336
+ title: z16.string()
3103
3337
  }),
3104
- z15.object({
3105
- type: z15.literal("file_citation"),
3106
- file_id: z15.string(),
3107
- filename: z15.string().nullish(),
3108
- index: z15.number().nullish(),
3109
- start_index: z15.number().nullish(),
3110
- end_index: z15.number().nullish(),
3111
- quote: z15.string().nullish()
3338
+ z16.object({
3339
+ type: z16.literal("file_citation"),
3340
+ file_id: z16.string(),
3341
+ filename: z16.string().nullish(),
3342
+ index: z16.number().nullish(),
3343
+ start_index: z16.number().nullish(),
3344
+ end_index: z16.number().nullish(),
3345
+ quote: z16.string().nullish()
3112
3346
  })
3113
3347
  ])
3114
3348
  }),
3115
- z15.object({
3116
- type: z15.literal("response.reasoning_summary_part.added"),
3117
- item_id: z15.string(),
3118
- summary_index: z15.number()
3349
+ z16.object({
3350
+ type: z16.literal("response.reasoning_summary_part.added"),
3351
+ item_id: z16.string(),
3352
+ summary_index: z16.number()
3119
3353
  }),
3120
- z15.object({
3121
- type: z15.literal("response.reasoning_summary_text.delta"),
3122
- item_id: z15.string(),
3123
- summary_index: z15.number(),
3124
- delta: z15.string()
3354
+ z16.object({
3355
+ type: z16.literal("response.reasoning_summary_text.delta"),
3356
+ item_id: z16.string(),
3357
+ summary_index: z16.number(),
3358
+ delta: z16.string()
3125
3359
  }),
3126
- z15.object({
3127
- type: z15.literal("response.reasoning_summary_part.done"),
3128
- item_id: z15.string(),
3129
- summary_index: z15.number()
3360
+ z16.object({
3361
+ type: z16.literal("response.reasoning_summary_part.done"),
3362
+ item_id: z16.string(),
3363
+ summary_index: z16.number()
3130
3364
  }),
3131
- z15.object({
3132
- type: z15.literal("error"),
3133
- sequence_number: z15.number(),
3134
- error: z15.object({
3135
- type: z15.string(),
3136
- code: z15.string(),
3137
- message: z15.string(),
3138
- param: z15.string().nullish()
3365
+ z16.object({
3366
+ type: z16.literal("error"),
3367
+ sequence_number: z16.number(),
3368
+ error: z16.object({
3369
+ type: z16.string(),
3370
+ code: z16.string(),
3371
+ message: z16.string(),
3372
+ param: z16.string().nullish()
3139
3373
  })
3140
3374
  }),
3141
- z15.object({ type: z15.string() }).loose().transform((value) => ({
3375
+ z16.object({ type: z16.string() }).loose().transform((value) => ({
3142
3376
  type: "unknown_chunk",
3143
3377
  message: value.type
3144
3378
  }))
@@ -3146,392 +3380,203 @@ var openaiResponsesChunkSchema = lazyValidator12(
3146
3380
  ])
3147
3381
  )
3148
3382
  );
3149
- var openaiResponsesResponseSchema = lazyValidator12(
3150
- () => zodSchema13(
3151
- z15.object({
3152
- id: z15.string().optional(),
3153
- created_at: z15.number().optional(),
3154
- error: z15.object({
3155
- message: z15.string(),
3156
- type: z15.string(),
3157
- param: z15.string().nullish(),
3158
- code: z15.string()
3383
+ var openaiResponsesResponseSchema = lazyValidator13(
3384
+ () => zodSchema14(
3385
+ z16.object({
3386
+ id: z16.string().optional(),
3387
+ created_at: z16.number().optional(),
3388
+ error: z16.object({
3389
+ message: z16.string(),
3390
+ type: z16.string(),
3391
+ param: z16.string().nullish(),
3392
+ code: z16.string()
3159
3393
  }).nullish(),
3160
- model: z15.string().optional(),
3161
- output: z15.array(
3162
- z15.discriminatedUnion("type", [
3163
- z15.object({
3164
- type: z15.literal("message"),
3165
- role: z15.literal("assistant"),
3166
- id: z15.string(),
3167
- phase: z15.enum(["commentary", "final_answer"]).nullish(),
3168
- content: z15.array(
3169
- z15.object({
3170
- type: z15.literal("output_text"),
3171
- text: z15.string(),
3172
- logprobs: z15.array(
3173
- z15.object({
3174
- token: z15.string(),
3175
- logprob: z15.number(),
3176
- top_logprobs: z15.array(
3177
- z15.object({
3178
- token: z15.string(),
3179
- logprob: z15.number()
3394
+ model: z16.string().optional(),
3395
+ output: z16.array(
3396
+ z16.discriminatedUnion("type", [
3397
+ z16.object({
3398
+ type: z16.literal("message"),
3399
+ role: z16.literal("assistant"),
3400
+ id: z16.string(),
3401
+ phase: z16.enum(["commentary", "final_answer"]).nullish(),
3402
+ content: z16.array(
3403
+ z16.object({
3404
+ type: z16.literal("output_text"),
3405
+ text: z16.string(),
3406
+ logprobs: z16.array(
3407
+ z16.object({
3408
+ token: z16.string(),
3409
+ logprob: z16.number(),
3410
+ top_logprobs: z16.array(
3411
+ z16.object({
3412
+ token: z16.string(),
3413
+ logprob: z16.number()
3180
3414
  })
3181
3415
  )
3182
3416
  })
3183
3417
  ).nullish(),
3184
- annotations: z15.array(
3185
- z15.discriminatedUnion("type", [
3186
- z15.object({
3187
- type: z15.literal("url_citation"),
3188
- start_index: z15.number(),
3189
- end_index: z15.number(),
3190
- url: z15.string(),
3191
- title: z15.string()
3418
+ annotations: z16.array(
3419
+ z16.discriminatedUnion("type", [
3420
+ z16.object({
3421
+ type: z16.literal("url_citation"),
3422
+ start_index: z16.number(),
3423
+ end_index: z16.number(),
3424
+ url: z16.string(),
3425
+ title: z16.string()
3192
3426
  }),
3193
- z15.object({
3194
- type: z15.literal("file_citation"),
3195
- file_id: z15.string(),
3196
- filename: z15.string().nullish(),
3197
- index: z15.number().nullish(),
3198
- start_index: z15.number().nullish(),
3199
- end_index: z15.number().nullish(),
3200
- quote: z15.string().nullish()
3427
+ z16.object({
3428
+ type: z16.literal("file_citation"),
3429
+ file_id: z16.string(),
3430
+ filename: z16.string().nullish(),
3431
+ index: z16.number().nullish(),
3432
+ start_index: z16.number().nullish(),
3433
+ end_index: z16.number().nullish(),
3434
+ quote: z16.string().nullish()
3201
3435
  }),
3202
- z15.object({
3203
- type: z15.literal("container_file_citation"),
3204
- container_id: z15.string(),
3205
- file_id: z15.string(),
3206
- filename: z15.string().nullish(),
3207
- start_index: z15.number().nullish(),
3208
- end_index: z15.number().nullish(),
3209
- index: z15.number().nullish()
3436
+ z16.object({
3437
+ type: z16.literal("container_file_citation"),
3438
+ container_id: z16.string(),
3439
+ file_id: z16.string(),
3440
+ filename: z16.string().nullish(),
3441
+ start_index: z16.number().nullish(),
3442
+ end_index: z16.number().nullish(),
3443
+ index: z16.number().nullish()
3210
3444
  }),
3211
- z15.object({
3212
- type: z15.literal("file_path"),
3213
- file_id: z15.string(),
3214
- index: z15.number().nullish()
3445
+ z16.object({
3446
+ type: z16.literal("file_path"),
3447
+ file_id: z16.string(),
3448
+ index: z16.number().nullish()
3215
3449
  })
3216
3450
  ])
3217
3451
  )
3218
3452
  })
3219
3453
  )
3220
3454
  }),
3221
- z15.object({
3222
- type: z15.literal("web_search_call"),
3223
- id: z15.string(),
3224
- status: z15.string(),
3225
- action: z15.discriminatedUnion("type", [
3226
- z15.object({
3227
- type: z15.literal("search"),
3228
- query: z15.string().nullish(),
3229
- sources: z15.array(
3230
- z15.discriminatedUnion("type", [
3231
- z15.object({ type: z15.literal("url"), url: z15.string() }),
3232
- z15.object({
3233
- type: z15.literal("api"),
3234
- name: z15.string()
3455
+ z16.object({
3456
+ type: z16.literal("web_search_call"),
3457
+ id: z16.string(),
3458
+ status: z16.string(),
3459
+ action: z16.discriminatedUnion("type", [
3460
+ z16.object({
3461
+ type: z16.literal("search"),
3462
+ query: z16.string().nullish(),
3463
+ sources: z16.array(
3464
+ z16.discriminatedUnion("type", [
3465
+ z16.object({ type: z16.literal("url"), url: z16.string() }),
3466
+ z16.object({
3467
+ type: z16.literal("api"),
3468
+ name: z16.string()
3235
3469
  })
3236
3470
  ])
3237
3471
  ).nullish()
3238
3472
  }),
3239
- z15.object({
3240
- type: z15.literal("open_page"),
3241
- url: z15.string().nullish()
3473
+ z16.object({
3474
+ type: z16.literal("open_page"),
3475
+ url: z16.string().nullish()
3242
3476
  }),
3243
- z15.object({
3244
- type: z15.literal("find_in_page"),
3245
- url: z15.string().nullish(),
3246
- pattern: z15.string().nullish()
3477
+ z16.object({
3478
+ type: z16.literal("find_in_page"),
3479
+ url: z16.string().nullish(),
3480
+ pattern: z16.string().nullish()
3247
3481
  })
3248
3482
  ]).nullish()
3249
3483
  }),
3250
- z15.object({
3251
- type: z15.literal("file_search_call"),
3252
- id: z15.string(),
3253
- queries: z15.array(z15.string()),
3254
- results: z15.array(
3255
- z15.object({
3256
- attributes: z15.record(
3257
- z15.string(),
3258
- z15.union([z15.string(), z15.number(), z15.boolean()])
3484
+ z16.object({
3485
+ type: z16.literal("file_search_call"),
3486
+ id: z16.string(),
3487
+ queries: z16.array(z16.string()),
3488
+ results: z16.array(
3489
+ z16.object({
3490
+ attributes: z16.record(
3491
+ z16.string(),
3492
+ z16.union([z16.string(), z16.number(), z16.boolean()])
3259
3493
  ),
3260
- file_id: z15.string(),
3261
- filename: z15.string(),
3262
- score: z15.number(),
3263
- text: z15.string()
3494
+ file_id: z16.string(),
3495
+ filename: z16.string(),
3496
+ score: z16.number(),
3497
+ text: z16.string()
3264
3498
  })
3265
3499
  ).nullish()
3266
3500
  }),
3267
- z15.object({
3268
- type: z15.literal("code_interpreter_call"),
3269
- id: z15.string(),
3270
- code: z15.string().nullable(),
3271
- container_id: z15.string(),
3272
- outputs: z15.array(
3273
- z15.discriminatedUnion("type", [
3274
- z15.object({ type: z15.literal("logs"), logs: z15.string() }),
3275
- z15.object({ type: z15.literal("image"), url: z15.string() })
3501
+ z16.object({
3502
+ type: z16.literal("code_interpreter_call"),
3503
+ id: z16.string(),
3504
+ code: z16.string().nullable(),
3505
+ container_id: z16.string(),
3506
+ outputs: z16.array(
3507
+ z16.discriminatedUnion("type", [
3508
+ z16.object({ type: z16.literal("logs"), logs: z16.string() }),
3509
+ z16.object({ type: z16.literal("image"), url: z16.string() })
3276
3510
  ])
3277
3511
  ).nullable()
3278
3512
  }),
3279
- z15.object({
3280
- type: z15.literal("image_generation_call"),
3281
- id: z15.string(),
3282
- result: z15.string()
3513
+ z16.object({
3514
+ type: z16.literal("image_generation_call"),
3515
+ id: z16.string(),
3516
+ result: z16.string()
3283
3517
  }),
3284
- z15.object({
3285
- type: z15.literal("local_shell_call"),
3286
- id: z15.string(),
3287
- call_id: z15.string(),
3288
- action: z15.object({
3289
- type: z15.literal("exec"),
3290
- command: z15.array(z15.string()),
3291
- timeout_ms: z15.number().optional(),
3292
- user: z15.string().optional(),
3293
- working_directory: z15.string().optional(),
3294
- env: z15.record(z15.string(), z15.string()).optional()
3518
+ z16.object({
3519
+ type: z16.literal("local_shell_call"),
3520
+ id: z16.string(),
3521
+ call_id: z16.string(),
3522
+ action: z16.object({
3523
+ type: z16.literal("exec"),
3524
+ command: z16.array(z16.string()),
3525
+ timeout_ms: z16.number().optional(),
3526
+ user: z16.string().optional(),
3527
+ working_directory: z16.string().optional(),
3528
+ env: z16.record(z16.string(), z16.string()).optional()
3295
3529
  })
3296
3530
  }),
3297
- z15.object({
3298
- type: z15.literal("function_call"),
3299
- call_id: z15.string(),
3300
- name: z15.string(),
3301
- arguments: z15.string(),
3302
- id: z15.string(),
3303
- async: z15.boolean().nullish()
3531
+ z16.object({
3532
+ type: z16.literal("function_call"),
3533
+ call_id: z16.string(),
3534
+ name: z16.string(),
3535
+ arguments: z16.string(),
3536
+ id: z16.string(),
3537
+ async: z16.boolean().nullish()
3304
3538
  }),
3305
- z15.object({
3306
- type: z15.literal("computer_call"),
3307
- id: z15.string(),
3308
- status: z15.string().optional()
3539
+ z16.object({
3540
+ type: z16.literal("computer_call"),
3541
+ id: z16.string(),
3542
+ status: z16.string().optional()
3309
3543
  }),
3310
- z15.object({
3311
- type: z15.literal("reasoning"),
3312
- id: z15.string(),
3313
- encrypted_content: z15.string().nullish(),
3314
- summary: z15.array(
3315
- z15.object({
3316
- type: z15.literal("summary_text"),
3317
- text: z15.string()
3544
+ z16.object({
3545
+ type: z16.literal("reasoning"),
3546
+ id: z16.string(),
3547
+ encrypted_content: z16.string().nullish(),
3548
+ summary: z16.array(
3549
+ z16.object({
3550
+ type: z16.literal("summary_text"),
3551
+ text: z16.string()
3318
3552
  })
3319
3553
  )
3320
3554
  })
3321
3555
  ])
3322
3556
  ).optional(),
3323
- service_tier: z15.string().nullish(),
3324
- reasoning: z15.object({
3325
- context: z15.string().nullish()
3557
+ service_tier: z16.string().nullish(),
3558
+ reasoning: z16.object({
3559
+ context: z16.string().nullish()
3326
3560
  }).nullish(),
3327
- incomplete_details: z15.object({ reason: z15.string() }).nullish(),
3328
- usage: z15.object({
3329
- input_tokens: z15.number(),
3330
- input_tokens_details: z15.object({
3331
- cached_tokens: z15.number().nullish(),
3332
- cache_write_tokens: z15.number().nullish(),
3333
- orchestration_input_tokens: z15.number().nullish(),
3334
- orchestration_input_cached_tokens: z15.number().nullish()
3561
+ incomplete_details: z16.object({ reason: z16.string() }).nullish(),
3562
+ usage: z16.object({
3563
+ input_tokens: z16.number(),
3564
+ input_tokens_details: z16.object({
3565
+ cached_tokens: z16.number().nullish(),
3566
+ cache_write_tokens: z16.number().nullish(),
3567
+ orchestration_input_tokens: z16.number().nullish(),
3568
+ orchestration_input_cached_tokens: z16.number().nullish()
3335
3569
  }).nullish(),
3336
- output_tokens: z15.number(),
3337
- output_tokens_details: z15.object({
3338
- reasoning_tokens: z15.number().nullish(),
3339
- orchestration_output_tokens: z15.number().nullish()
3570
+ output_tokens: z16.number(),
3571
+ output_tokens_details: z16.object({
3572
+ reasoning_tokens: z16.number().nullish(),
3573
+ orchestration_output_tokens: z16.number().nullish()
3340
3574
  }).nullish()
3341
3575
  }).optional()
3342
3576
  })
3343
3577
  )
3344
3578
  );
3345
3579
 
3346
- // src/responses/openai-responses-options.ts
3347
- import {
3348
- lazyValidator as lazyValidator13,
3349
- zodSchema as zodSchema14
3350
- } from "@ai-sdk/provider-utils";
3351
- import { z as z16 } from "zod/v4";
3352
- var TOP_LOGPROBS_MAX = 20;
3353
- var openaiResponsesReasoningModelIds = [
3354
- "o1",
3355
- "o1-2024-12-17",
3356
- "o3",
3357
- "o3-2025-04-16",
3358
- "o3-deep-research",
3359
- "o3-deep-research-2025-06-26",
3360
- "o3-mini",
3361
- "o3-mini-2025-01-31",
3362
- "o4-mini",
3363
- "o4-mini-2025-04-16",
3364
- "o4-mini-deep-research",
3365
- "o4-mini-deep-research-2025-06-26",
3366
- "codex-mini-latest",
3367
- "computer-use-preview",
3368
- "gpt-5",
3369
- "gpt-5-2025-08-07",
3370
- "gpt-5-codex",
3371
- "gpt-5-mini",
3372
- "gpt-5-mini-2025-08-07",
3373
- "gpt-5-nano",
3374
- "gpt-5-nano-2025-08-07",
3375
- "gpt-5-pro",
3376
- "gpt-5-pro-2025-10-06",
3377
- "gpt-5.1",
3378
- "gpt-5.1-chat-latest",
3379
- "gpt-5.1-codex-mini",
3380
- "gpt-5.1-codex",
3381
- "gpt-5.1-codex-max",
3382
- "gpt-5.2",
3383
- "gpt-5.2-chat-latest",
3384
- "gpt-5.2-pro",
3385
- "gpt-5.2-codex",
3386
- "gpt-5.3-chat-latest",
3387
- "gpt-5.3-codex",
3388
- "gpt-5.4",
3389
- "gpt-5.4-2026-03-05",
3390
- "gpt-5.4-mini",
3391
- "gpt-5.4-mini-2026-03-17",
3392
- "gpt-5.4-nano",
3393
- "gpt-5.4-nano-2026-03-17",
3394
- "gpt-5.4-pro",
3395
- "gpt-5.4-pro-2026-03-05",
3396
- "gpt-5.6",
3397
- "gpt-5.6-luna",
3398
- "gpt-5.6-sol",
3399
- "gpt-5.6-terra",
3400
- "gpt-6-astra",
3401
- "gpt-6-luna",
3402
- "gpt-6-sol"
3403
- ];
3404
- var openaiResponsesModelIds = [
3405
- "gpt-4.1",
3406
- "gpt-4.1-2025-04-14",
3407
- "gpt-4.1-mini",
3408
- "gpt-4.1-mini-2025-04-14",
3409
- "gpt-4.1-nano",
3410
- "gpt-4.1-nano-2025-04-14",
3411
- "gpt-4o",
3412
- "gpt-4o-2024-05-13",
3413
- "gpt-4o-2024-08-06",
3414
- "gpt-4o-2024-11-20",
3415
- "gpt-4o-audio-preview",
3416
- "gpt-4o-audio-preview-2024-10-01",
3417
- "gpt-4o-audio-preview-2024-12-17",
3418
- "gpt-4o-search-preview",
3419
- "gpt-4o-search-preview-2025-03-11",
3420
- "gpt-4o-mini-search-preview",
3421
- "gpt-4o-mini-search-preview-2025-03-11",
3422
- "gpt-4o-mini",
3423
- "gpt-4o-mini-2024-07-18",
3424
- "gpt-4-turbo",
3425
- "gpt-4-turbo-2024-04-09",
3426
- "gpt-4-turbo-preview",
3427
- "gpt-4-0125-preview",
3428
- "gpt-4-1106-preview",
3429
- "gpt-4",
3430
- "gpt-4-0613",
3431
- "gpt-4.5-preview",
3432
- "gpt-4.5-preview-2025-02-27",
3433
- "gpt-3.5-turbo-0125",
3434
- "gpt-3.5-turbo",
3435
- "gpt-3.5-turbo-1106",
3436
- "chatgpt-4o-latest",
3437
- "gpt-5-chat-latest",
3438
- ...openaiResponsesReasoningModelIds
3439
- ];
3440
- var openaiResponsesProviderOptionsSchema = lazyValidator13(
3441
- () => zodSchema14(
3442
- z16.object({
3443
- conversation: z16.string().nullish(),
3444
- include: z16.array(
3445
- z16.enum([
3446
- "reasoning.encrypted_content",
3447
- // handled internally by default, only needed for unknown reasoning models
3448
- "file_search_call.results",
3449
- "message.output_text.logprobs"
3450
- ])
3451
- ).nullish(),
3452
- instructions: z16.string().nullish(),
3453
- /**
3454
- * Return the log probabilities of the tokens.
3455
- *
3456
- * Setting to true will return the log probabilities of the tokens that
3457
- * were generated.
3458
- *
3459
- * Setting to a number will return the log probabilities of the top n
3460
- * tokens that were generated.
3461
- *
3462
- * @see https://platform.openai.com/docs/api-reference/responses/create
3463
- * @see https://cookbook.openai.com/examples/using_logprobs
3464
- */
3465
- logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3466
- /**
3467
- * The maximum number of total calls to built-in tools that can be processed in a response.
3468
- * This maximum number applies across all built-in tool calls, not per individual tool.
3469
- * Any further attempts to call a tool by the model will be ignored.
3470
- */
3471
- maxToolCalls: z16.number().nullish(),
3472
- metadata: z16.any().nullish(),
3473
- parallelToolCalls: z16.boolean().nullish(),
3474
- previousResponseId: z16.string().nullish(),
3475
- promptCacheKey: z16.string().nullish(),
3476
- /**
3477
- * Prompt cache behavior for GPT-5.6 and later models.
3478
- * `mode` controls whether OpenAI also places an implicit breakpoint.
3479
- * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
3480
- */
3481
- promptCacheOptions: z16.object({
3482
- mode: z16.enum(["implicit", "explicit"]).optional(),
3483
- ttl: z16.literal("30m").optional()
3484
- }).optional(),
3485
- /**
3486
- * The retention policy for the prompt cache.
3487
- * - 'in_memory': Default. Standard prompt caching behavior.
3488
- * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
3489
- * Available for models before GPT-5.6 that support extended caching.
3490
- *
3491
- * @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
3492
- *
3493
- * @default 'in_memory'
3494
- */
3495
- promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
3496
- /**
3497
- * Reasoning effort for reasoning models. Defaults to `medium`. If you use
3498
- * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
3499
- * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
3500
- * Supported values vary by model.
3501
- */
3502
- reasoningEffort: z16.string().nullish(),
3503
- /**
3504
- * Updates the reasoning effort for GPT-6 and later models starting with this response
3505
- * without changing the request-level reasoning effort. This preserves the
3506
- * request prefix for prompt caching.
3507
- *
3508
- * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
3509
- * combined with automatic truncation.
3510
- */
3511
- reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
3512
- /**
3513
- * Controls how much model work GPT-5.6 performs before returning a final answer.
3514
- * `standard` is the default. `pro` increases quality, latency, and token usage.
3515
- */
3516
- reasoningMode: z16.enum(["standard", "pro"]).optional(),
3517
- /**
3518
- * Controls which available reasoning items GPT-5.6 can use.
3519
- * `auto` uses the model default, `current_turn` excludes reasoning from earlier
3520
- * turns, and `all_turns` makes compatible earlier reasoning available.
3521
- */
3522
- reasoningContext: z16.enum(["auto", "current_turn", "all_turns"]).optional(),
3523
- reasoningSummary: z16.string().nullish(),
3524
- safetyIdentifier: z16.string().nullish(),
3525
- serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
3526
- store: z16.boolean().nullish(),
3527
- strictJsonSchema: z16.boolean().nullish(),
3528
- textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
3529
- truncation: z16.enum(["auto", "disabled"]).nullish(),
3530
- user: z16.string().nullish()
3531
- })
3532
- )
3533
- );
3534
-
3535
3580
  // src/responses/openai-responses-prepare-tools.ts
3536
3581
  import {
3537
3582
  UnsupportedFunctionalityError as UnsupportedFunctionalityError5
@@ -3965,6 +4010,18 @@ function resolveAsyncToolOption({
3965
4010
  }
3966
4011
 
3967
4012
  // src/responses/openai-responses-language-model.ts
4013
+ function getConfigurationUpdateUnsupportedReason({
4014
+ modelCapabilities,
4015
+ options
4016
+ }) {
4017
+ if (!modelCapabilities.supportsConfigurationUpdate) {
4018
+ return "reasoningEffortUpdate is only supported by GPT-6 and later models";
4019
+ }
4020
+ if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
4021
+ return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
4022
+ }
4023
+ return void 0;
4024
+ }
3968
4025
  var OpenAIResponsesLanguageModel = class {
3969
4026
  constructor(modelId, config) {
3970
4027
  this.specificationVersion = "v2";
@@ -4029,8 +4086,14 @@ var OpenAIResponsesLanguageModel = class {
4029
4086
  details: "conversation and previousResponseId cannot be used together"
4030
4087
  });
4031
4088
  }
4089
+ const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
4090
+ modelCapabilities,
4091
+ options: openaiOptions
4092
+ });
4032
4093
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
4033
4094
  prompt,
4095
+ configurationUpdateUnsupportedReason,
4096
+ providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
4034
4097
  systemMessageMode: modelCapabilities.systemMessageMode,
4035
4098
  explicitMessageItemType: this.config.explicitMessageItemType,
4036
4099
  fileIdPrefixes: this.config.fileIdPrefixes,
@@ -4050,18 +4113,27 @@ var OpenAIResponsesLanguageModel = class {
4050
4113
  resolvedReasoningEffort = void 0;
4051
4114
  }
4052
4115
  const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
4053
- const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
4054
- if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
4116
+ if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
4055
4117
  warnings.push({
4056
4118
  type: "unsupported-setting",
4057
4119
  setting: "reasoningEffortUpdate",
4058
- details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
4120
+ details: configurationUpdateUnsupportedReason
4059
4121
  });
4060
4122
  } else if (reasoningEffortUpdate != null) {
4061
- input.unshift({
4062
- type: "configuration_update",
4063
- reasoning: { effort: reasoningEffortUpdate }
4064
- });
4123
+ const firstItem = input[0];
4124
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
4125
+ input.unshift({
4126
+ type: "configuration_update",
4127
+ reasoning: { effort: reasoningEffortUpdate }
4128
+ });
4129
+ }
4130
+ }
4131
+ for (let i = 1; i < input.length; i++) {
4132
+ if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
4133
+ throw new UnsupportedFunctionalityError6({
4134
+ functionality: "Adjacent reasoning effort configuration updates"
4135
+ });
4136
+ }
4065
4137
  }
4066
4138
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
4067
4139
  let include = openaiOptions == null ? void 0 : openaiOptions.include;