@ai-sdk/openai 2.0.124 → 2.0.126

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.
@@ -8,7 +8,7 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazyValidat
8
8
  logprobs?: number | boolean | undefined;
9
9
  parallelToolCalls?: boolean | undefined;
10
10
  user?: string | undefined;
11
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11
+ reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
12
12
  maxCompletionTokens?: number | undefined;
13
13
  store?: boolean | undefined;
14
14
  metadata?: Record<string, string> | undefined;
@@ -91,6 +91,11 @@ type OpenAIConfig = {
91
91
  headers: () => Record<string, string | undefined>;
92
92
  fetch?: FetchFunction;
93
93
  generateId?: () => string;
94
+ /**
95
+ * Whether Responses API message input items must include an explicit
96
+ * `type: 'message'` discriminator.
97
+ */
98
+ explicitMessageItemType?: boolean;
94
99
  /**
95
100
  * File ID prefixes used to identify file IDs in Responses API.
96
101
  * When undefined, all file data is treated as base64 content.
@@ -126,7 +131,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
126
131
  declare function hasDefaultResponseFormat(modelId: string): boolean;
127
132
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
128
133
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
129
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
134
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
130
135
  background?: "auto" | "transparent" | "opaque" | undefined;
131
136
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
132
137
  outputCompression?: number | undefined;
@@ -134,13 +139,13 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
134
139
  }>;
135
140
  type OpenAIImageModelOptions = InferValidator<typeof openaiImageModelOptions>;
136
141
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazyValidator<{
137
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
142
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
138
143
  background?: "auto" | "transparent" | "opaque" | undefined;
139
144
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
140
145
  outputCompression?: number | undefined;
141
146
  user?: string | undefined;
142
147
  style?: "vivid" | "natural" | undefined;
143
- moderation?: "auto" | "low" | undefined;
148
+ moderation?: "low" | "auto" | undefined;
144
149
  }>;
145
150
  type OpenAIImageModelGenerationOptions = InferValidator<typeof openaiImageModelGenerationOptions>;
146
151
 
@@ -436,7 +441,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
436
441
  outputCompression?: number | undefined;
437
442
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
438
443
  partialImages?: number | undefined;
439
- quality?: "auto" | "low" | "medium" | "high" | undefined;
444
+ quality?: "low" | "medium" | "high" | "auto" | undefined;
440
445
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
441
446
  }>;
442
447
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -8,7 +8,7 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazyValidat
8
8
  logprobs?: number | boolean | undefined;
9
9
  parallelToolCalls?: boolean | undefined;
10
10
  user?: string | undefined;
11
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11
+ reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
12
12
  maxCompletionTokens?: number | undefined;
13
13
  store?: boolean | undefined;
14
14
  metadata?: Record<string, string> | undefined;
@@ -91,6 +91,11 @@ type OpenAIConfig = {
91
91
  headers: () => Record<string, string | undefined>;
92
92
  fetch?: FetchFunction;
93
93
  generateId?: () => string;
94
+ /**
95
+ * Whether Responses API message input items must include an explicit
96
+ * `type: 'message'` discriminator.
97
+ */
98
+ explicitMessageItemType?: boolean;
94
99
  /**
95
100
  * File ID prefixes used to identify file IDs in Responses API.
96
101
  * When undefined, all file data is treated as base64 content.
@@ -126,7 +131,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
126
131
  declare function hasDefaultResponseFormat(modelId: string): boolean;
127
132
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
128
133
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
129
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
134
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
130
135
  background?: "auto" | "transparent" | "opaque" | undefined;
131
136
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
132
137
  outputCompression?: number | undefined;
@@ -134,13 +139,13 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
134
139
  }>;
135
140
  type OpenAIImageModelOptions = InferValidator<typeof openaiImageModelOptions>;
136
141
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazyValidator<{
137
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
142
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
138
143
  background?: "auto" | "transparent" | "opaque" | undefined;
139
144
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
140
145
  outputCompression?: number | undefined;
141
146
  user?: string | undefined;
142
147
  style?: "vivid" | "natural" | undefined;
143
- moderation?: "auto" | "low" | undefined;
148
+ moderation?: "low" | "auto" | undefined;
144
149
  }>;
145
150
  type OpenAIImageModelGenerationOptions = InferValidator<typeof openaiImageModelGenerationOptions>;
146
151
 
@@ -436,7 +441,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
436
441
  outputCompression?: number | undefined;
437
442
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
438
443
  partialImages?: number | undefined;
439
- quality?: "auto" | "low" | "medium" | "high" | undefined;
444
+ quality?: "low" | "medium" | "high" | "auto" | undefined;
440
445
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
441
446
  }>;
442
447
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -88,14 +88,18 @@ function getOpenAILanguageModelCapabilities(modelId) {
88
88
  const gptVersion = getGptVersion(modelId);
89
89
  const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a2 = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a2.startsWith("chat")) != null ? _b : false);
90
90
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
91
+ const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
91
92
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
92
93
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
93
94
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel || modelId === "codex-mini-latest" || modelId === "computer-use-preview";
94
- const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
95
+ const supportsNonReasoningParameters = !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
95
96
  const systemMessageMode = isReasoningModel ? "developer" : "system";
96
97
  return {
97
98
  supportsFlexProcessing,
98
99
  supportsPriorityProcessing,
100
+ supportsConfigurationUpdate: isGpt6OrLaterModel,
101
+ supportsAsyncToolCalling: isGpt6OrLaterModel,
102
+ supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
99
103
  isReasoningModel,
100
104
  systemMessageMode,
101
105
  supportsNonReasoningParameters
@@ -780,6 +784,17 @@ var OpenAIChatLanguageModel = class {
780
784
  );
781
785
  warnings.push(...messageWarnings);
782
786
  const strictJsonSchema = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
787
+ let resolvedReasoningEffort = openaiOptions.reasoningEffort;
788
+ if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
789
+ resolvedReasoningEffort
790
+ )) {
791
+ warnings.push({
792
+ type: "unsupported-setting",
793
+ setting: "reasoningEffort",
794
+ details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
795
+ });
796
+ resolvedReasoningEffort = void 0;
797
+ }
783
798
  const baseArgs = {
784
799
  // model id:
785
800
  model: this.modelId,
@@ -813,7 +828,7 @@ var OpenAIChatLanguageModel = class {
813
828
  store: openaiOptions.store,
814
829
  metadata: openaiOptions.metadata,
815
830
  prediction: openaiOptions.prediction,
816
- reasoning_effort: openaiOptions.reasoningEffort,
831
+ reasoning_effort: resolvedReasoningEffort,
817
832
  service_tier: openaiOptions.serviceTier,
818
833
  prompt_cache_key: openaiOptions.promptCacheKey,
819
834
  prompt_cache_options: openaiOptions.promptCacheOptions,
@@ -822,6 +837,14 @@ var OpenAIChatLanguageModel = class {
822
837
  // messages:
823
838
  messages
824
839
  };
840
+ if (modelCapabilities.supportedReasoningEfforts != null && baseArgs.prompt_cache_retention != null) {
841
+ baseArgs.prompt_cache_retention = void 0;
842
+ warnings.push({
843
+ type: "unsupported-setting",
844
+ setting: "promptCacheRetention",
845
+ details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
846
+ });
847
+ }
825
848
  if (modelCapabilities.isReasoningModel) {
826
849
  if (openaiOptions.reasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
827
850
  if (baseArgs.temperature != null) {
@@ -2410,11 +2433,12 @@ function isFileId(data, prefixes) {
2410
2433
  async function convertToOpenAIResponsesInput({
2411
2434
  prompt,
2412
2435
  systemMessageMode,
2436
+ explicitMessageItemType = false,
2413
2437
  fileIdPrefixes,
2414
2438
  store,
2415
2439
  hasLocalShellTool = false
2416
2440
  }) {
2417
- var _a2, _b, _c, _d, _e, _f;
2441
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
2418
2442
  let input = [];
2419
2443
  const warnings = [];
2420
2444
  for (const { role, content, providerOptions } of prompt) {
@@ -2424,6 +2448,7 @@ async function convertToOpenAIResponsesInput({
2424
2448
  case "system": {
2425
2449
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
2426
2450
  input.push({
2451
+ ...explicitMessageItemType && { type: "message" },
2427
2452
  role: "system",
2428
2453
  content: promptCacheBreakpoint == null ? content : [
2429
2454
  {
@@ -2438,6 +2463,7 @@ async function convertToOpenAIResponsesInput({
2438
2463
  case "developer": {
2439
2464
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
2440
2465
  input.push({
2466
+ ...explicitMessageItemType && { type: "message" },
2441
2467
  role: "developer",
2442
2468
  content: promptCacheBreakpoint == null ? content : [
2443
2469
  {
@@ -2467,6 +2493,7 @@ async function convertToOpenAIResponsesInput({
2467
2493
  }
2468
2494
  case "user": {
2469
2495
  input.push({
2496
+ ...explicitMessageItemType && { type: "message" },
2470
2497
  role: "user",
2471
2498
  content: content.map((part, index) => {
2472
2499
  var _a3, _b2, _c2;
@@ -2543,6 +2570,7 @@ async function convertToOpenAIResponsesInput({
2543
2570
  break;
2544
2571
  }
2545
2572
  input.push({
2573
+ ...explicitMessageItemType && { type: "message" },
2546
2574
  role: "assistant",
2547
2575
  content: [{ type: "output_text", text: part.text }],
2548
2576
  id,
@@ -2556,6 +2584,7 @@ async function convertToOpenAIResponsesInput({
2556
2584
  break;
2557
2585
  }
2558
2586
  const id = (_f = (_e = part.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
2587
+ const isAsync = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.async;
2559
2588
  if (store && id != null) {
2560
2589
  input.push({ type: "item_reference", id });
2561
2590
  break;
@@ -2585,6 +2614,7 @@ async function convertToOpenAIResponsesInput({
2585
2614
  call_id: part.toolCallId,
2586
2615
  name: part.toolName,
2587
2616
  arguments: JSON.stringify(part.input),
2617
+ ...isAsync != null && { async: isAsync },
2588
2618
  id
2589
2619
  });
2590
2620
  break;
@@ -2857,7 +2887,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
2857
2887
  id: import_v415.z.string(),
2858
2888
  call_id: import_v415.z.string(),
2859
2889
  name: import_v415.z.string(),
2860
- arguments: import_v415.z.string()
2890
+ arguments: import_v415.z.string(),
2891
+ async: import_v415.z.boolean().nullish()
2861
2892
  }),
2862
2893
  import_v415.z.object({
2863
2894
  type: import_v415.z.literal("web_search_call"),
@@ -2912,6 +2943,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
2912
2943
  call_id: import_v415.z.string(),
2913
2944
  name: import_v415.z.string(),
2914
2945
  arguments: import_v415.z.string(),
2946
+ async: import_v415.z.boolean().nullish(),
2915
2947
  status: import_v415.z.literal("completed")
2916
2948
  }),
2917
2949
  import_v415.z.object({
@@ -3223,7 +3255,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils22.lazyValidator)(
3223
3255
  call_id: import_v415.z.string(),
3224
3256
  name: import_v415.z.string(),
3225
3257
  arguments: import_v415.z.string(),
3226
- id: import_v415.z.string()
3258
+ id: import_v415.z.string(),
3259
+ async: import_v415.z.boolean().nullish()
3227
3260
  }),
3228
3261
  import_v415.z.object({
3229
3262
  type: import_v415.z.literal("computer_call"),
@@ -3418,6 +3451,15 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValid
3418
3451
  * Supported values vary by model.
3419
3452
  */
3420
3453
  reasoningEffort: import_v416.z.string().nullish(),
3454
+ /**
3455
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
3456
+ * without changing the request-level reasoning effort. This preserves the
3457
+ * request prefix for prompt caching.
3458
+ *
3459
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
3460
+ * combined with automatic truncation.
3461
+ */
3462
+ reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
3421
3463
  /**
3422
3464
  * Controls how much model work GPT-5.6 performs before returning a final answer.
3423
3465
  * `standard` is the default. `pro` increases quality, latency, and token usage.
@@ -3686,8 +3728,10 @@ var import_provider_utils29 = require("@ai-sdk/provider-utils");
3686
3728
  async function prepareResponsesTools({
3687
3729
  tools,
3688
3730
  toolChoice,
3689
- strictJsonSchema
3731
+ strictJsonSchema,
3732
+ supportsAsyncToolCalling = true
3690
3733
  }) {
3734
+ var _a2;
3691
3735
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
3692
3736
  const toolWarnings = [];
3693
3737
  if (tools == null) {
@@ -3696,15 +3740,24 @@ async function prepareResponsesTools({
3696
3740
  const openaiTools = [];
3697
3741
  for (const tool of tools) {
3698
3742
  switch (tool.type) {
3699
- case "function":
3743
+ case "function": {
3744
+ const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
3745
+ const async = resolveAsyncToolOption({
3746
+ value: openaiOptions == null ? void 0 : openaiOptions.async,
3747
+ supportsAsyncToolCalling,
3748
+ tool,
3749
+ toolWarnings
3750
+ });
3700
3751
  openaiTools.push({
3701
3752
  type: "function",
3702
3753
  name: tool.name,
3703
3754
  description: tool.description,
3704
3755
  parameters: tool.inputSchema,
3705
- strict: strictJsonSchema
3756
+ strict: strictJsonSchema,
3757
+ ...async != null ? { async } : {}
3706
3758
  });
3707
3759
  break;
3760
+ }
3708
3761
  case "provider-defined": {
3709
3762
  switch (tool.id) {
3710
3763
  case "openai.file_search": {
@@ -3823,6 +3876,22 @@ async function prepareResponsesTools({
3823
3876
  }
3824
3877
  }
3825
3878
  }
3879
+ function resolveAsyncToolOption({
3880
+ value,
3881
+ supportsAsyncToolCalling,
3882
+ tool,
3883
+ toolWarnings
3884
+ }) {
3885
+ if (value !== true || supportsAsyncToolCalling) {
3886
+ return value;
3887
+ }
3888
+ toolWarnings.push({
3889
+ type: "unsupported-tool",
3890
+ tool,
3891
+ details: "Async tool calling is only supported by GPT-6 and later models."
3892
+ });
3893
+ return void 0;
3894
+ }
3826
3895
 
3827
3896
  // src/responses/openai-responses-language-model.ts
3828
3897
  var OpenAIResponsesLanguageModel = class {
@@ -3853,7 +3922,7 @@ var OpenAIResponsesLanguageModel = class {
3853
3922
  toolChoice,
3854
3923
  responseFormat
3855
3924
  }) {
3856
- var _a2, _b, _c, _d;
3925
+ var _a2, _b, _c, _d, _e, _f;
3857
3926
  const warnings = [];
3858
3927
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
3859
3928
  if (topK != null) {
@@ -3892,11 +3961,37 @@ var OpenAIResponsesLanguageModel = class {
3892
3961
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
3893
3962
  prompt,
3894
3963
  systemMessageMode: modelCapabilities.systemMessageMode,
3964
+ explicitMessageItemType: this.config.explicitMessageItemType,
3895
3965
  fileIdPrefixes: this.config.fileIdPrefixes,
3896
3966
  store: (_a2 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a2 : true,
3897
3967
  hasLocalShellTool: hasOpenAITool("openai.local_shell")
3898
3968
  });
3899
3969
  warnings.push(...inputWarnings);
3970
+ let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
3971
+ if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
3972
+ resolvedReasoningEffort
3973
+ )) {
3974
+ warnings.push({
3975
+ type: "unsupported-setting",
3976
+ setting: "reasoningEffort",
3977
+ details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
3978
+ });
3979
+ resolvedReasoningEffort = void 0;
3980
+ }
3981
+ const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
3982
+ const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
3983
+ if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
3984
+ warnings.push({
3985
+ type: "unsupported-setting",
3986
+ setting: "reasoningEffortUpdate",
3987
+ details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
3988
+ });
3989
+ } else if (reasoningEffortUpdate != null) {
3990
+ input.unshift({
3991
+ type: "configuration_update",
3992
+ reasoning: { effort: reasoningEffortUpdate }
3993
+ });
3994
+ }
3900
3995
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
3901
3996
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
3902
3997
  function addInclude(key) {
@@ -3968,10 +4063,10 @@ var OpenAIResponsesLanguageModel = class {
3968
4063
  top_logprobs: topLogprobs,
3969
4064
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
3970
4065
  // model-specific settings:
3971
- ...modelCapabilities.isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningContext) != null) && {
4066
+ ...modelCapabilities.isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningContext) != null) && {
3972
4067
  reasoning: {
3973
- ...(openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null && {
3974
- effort: openaiOptions.reasoningEffort
4068
+ ...resolvedReasoningEffort != null && {
4069
+ effort: resolvedReasoningEffort
3975
4070
  },
3976
4071
  ...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
3977
4072
  summary: openaiOptions.reasoningSummary
@@ -3985,6 +4080,14 @@ var OpenAIResponsesLanguageModel = class {
3985
4080
  }
3986
4081
  }
3987
4082
  };
4083
+ if (modelCapabilities.supportsConfigurationUpdate && baseArgs.prompt_cache_retention != null) {
4084
+ baseArgs.prompt_cache_retention = void 0;
4085
+ warnings.push({
4086
+ type: "unsupported-setting",
4087
+ setting: "promptCacheRetention",
4088
+ details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
4089
+ });
4090
+ }
3988
4091
  if (modelCapabilities.isReasoningModel) {
3989
4092
  if (!((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) === "none" && modelCapabilities.supportsNonReasoningParameters)) {
3990
4093
  if (baseArgs.temperature != null) {
@@ -4003,6 +4106,18 @@ var OpenAIResponsesLanguageModel = class {
4003
4106
  details: "topP is not supported for reasoning models"
4004
4107
  });
4005
4108
  }
4109
+ if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_e = baseArgs.include) == null ? void 0 : _e.includes("message.output_text.logprobs")))) {
4110
+ baseArgs.top_logprobs = void 0;
4111
+ const filteredInclude = (_f = baseArgs.include) == null ? void 0 : _f.filter(
4112
+ (value) => value !== "message.output_text.logprobs"
4113
+ );
4114
+ baseArgs.include = filteredInclude != null && filteredInclude.length > 0 ? filteredInclude : void 0;
4115
+ warnings.push({
4116
+ type: "unsupported-setting",
4117
+ setting: "logprobs",
4118
+ details: "logprobs is not supported for reasoning models"
4119
+ });
4120
+ }
4006
4121
  }
4007
4122
  } else {
4008
4123
  if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
@@ -4057,7 +4172,8 @@ var OpenAIResponsesLanguageModel = class {
4057
4172
  } = await prepareResponsesTools({
4058
4173
  tools,
4059
4174
  toolChoice,
4060
- strictJsonSchema
4175
+ strictJsonSchema,
4176
+ supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
4061
4177
  });
4062
4178
  return {
4063
4179
  webSearchToolName,
@@ -4251,7 +4367,8 @@ var OpenAIResponsesLanguageModel = class {
4251
4367
  input: part.arguments,
4252
4368
  providerMetadata: {
4253
4369
  [providerKey]: {
4254
- itemId: part.id
4370
+ itemId: part.id,
4371
+ ...part.async != null && { async: part.async }
4255
4372
  }
4256
4373
  }
4257
4374
  });
@@ -4451,7 +4568,8 @@ var OpenAIResponsesLanguageModel = class {
4451
4568
  if (value.item.type === "function_call") {
4452
4569
  ongoingToolCalls[value.output_index] = {
4453
4570
  toolName: value.item.name,
4454
- toolCallId: value.item.call_id
4571
+ toolCallId: value.item.call_id,
4572
+ async: value.item.async
4455
4573
  };
4456
4574
  controller.enqueue({
4457
4575
  type: "tool-input-start",
@@ -4575,6 +4693,7 @@ var OpenAIResponsesLanguageModel = class {
4575
4693
  }
4576
4694
  });
4577
4695
  } else if (value.item.type === "function_call") {
4696
+ const ongoingToolCall = ongoingToolCalls[value.output_index];
4578
4697
  ongoingToolCalls[value.output_index] = void 0;
4579
4698
  hasFunctionCall = true;
4580
4699
  controller.enqueue({
@@ -4588,7 +4707,8 @@ var OpenAIResponsesLanguageModel = class {
4588
4707
  input: value.item.arguments,
4589
4708
  providerMetadata: {
4590
4709
  [providerKey]: {
4591
- itemId: value.item.id
4710
+ itemId: value.item.id,
4711
+ ...value.item.async != null ? { async: value.item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {}
4592
4712
  }
4593
4713
  }
4594
4714
  });