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