@ai-sdk/openai 3.0.109 → 3.0.110

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.
@@ -127,7 +127,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
127
127
  declare function hasDefaultResponseFormat(modelId: string): boolean;
128
128
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
129
129
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
130
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
130
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
131
131
  background?: "auto" | "transparent" | "opaque" | undefined;
132
132
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
133
133
  outputCompression?: number | undefined;
@@ -135,7 +135,7 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
135
135
  }>;
136
136
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
137
137
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
138
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
138
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
139
139
  background?: "auto" | "transparent" | "opaque" | undefined;
140
140
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
141
141
  outputCompression?: number | undefined;
@@ -145,7 +145,7 @@ declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySche
145
145
  }>;
146
146
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
147
147
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
148
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
148
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
149
149
  background?: "auto" | "transparent" | "opaque" | undefined;
150
150
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
151
151
  outputCompression?: number | undefined;
@@ -389,6 +389,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
389
389
  call_id: string;
390
390
  name: string;
391
391
  arguments: string;
392
+ async?: boolean | null | undefined;
392
393
  namespace?: string | null | undefined;
393
394
  } | {
394
395
  type: "web_search_call";
@@ -451,6 +452,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
451
452
  call_id: string;
452
453
  name: string;
453
454
  input: string;
455
+ async?: boolean | null | undefined;
454
456
  } | {
455
457
  type: "shell_call";
456
458
  id: string;
@@ -519,6 +521,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
519
521
  name: string;
520
522
  arguments: string;
521
523
  status: "completed";
524
+ async?: boolean | null | undefined;
522
525
  namespace?: string | null | undefined;
523
526
  } | {
524
527
  type: "custom_tool_call";
@@ -527,6 +530,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
527
530
  name: string;
528
531
  input: string;
529
532
  status: "completed";
533
+ async?: boolean | null | undefined;
530
534
  } | {
531
535
  type: "code_interpreter_call";
532
536
  id: string;
@@ -779,6 +783,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
779
783
  type OpenaiResponsesProviderMetadata = {
780
784
  openai: ResponsesProviderMetadata;
781
785
  };
786
+ type ResponsesToolCallProviderMetadata = {
787
+ itemId: string;
788
+ async?: boolean;
789
+ namespace?: string;
790
+ };
791
+ type OpenaiResponsesToolCallProviderMetadata = {
792
+ openai: ResponsesToolCallProviderMetadata;
793
+ };
782
794
  type ResponsesTextProviderMetadata = {
783
795
  itemId: string;
784
796
  phase?: 'commentary' | 'final_answer' | null;
@@ -1109,7 +1121,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1109
1121
  outputCompression?: number | undefined;
1110
1122
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
1111
1123
  partialImages?: number | undefined;
1112
- quality?: "low" | "medium" | "high" | "auto" | undefined;
1124
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | undefined;
1113
1125
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
1114
1126
  }>;
1115
1127
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -1161,9 +1173,10 @@ type ImageGenerationArgs = {
1161
1173
  partialImages?: number;
1162
1174
  /**
1163
1175
  * The quality of the generated image.
1164
- * One of low, medium, high, or auto. Default: auto.
1176
+ * One of low, medium, high, xhigh, max, or auto. Default: auto.
1177
+ * xhigh and max are supported by GPT Image 2.5 models.
1165
1178
  */
1166
- quality?: 'auto' | 'low' | 'medium' | 'high';
1179
+ quality?: 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
1167
1180
  /**
1168
1181
  * The size of the generated image.
1169
1182
  * One of 1024x1024, 1024x1536, 1536x1024, or auto.
@@ -1463,4 +1476,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
1463
1476
  };
1464
1477
  }>;
1465
1478
 
1466
- export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
1479
+ export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -127,7 +127,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
127
127
  declare function hasDefaultResponseFormat(modelId: string): boolean;
128
128
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
129
129
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
130
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
130
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
131
131
  background?: "auto" | "transparent" | "opaque" | undefined;
132
132
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
133
133
  outputCompression?: number | undefined;
@@ -135,7 +135,7 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
135
135
  }>;
136
136
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
137
137
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
138
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
138
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
139
139
  background?: "auto" | "transparent" | "opaque" | undefined;
140
140
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
141
141
  outputCompression?: number | undefined;
@@ -145,7 +145,7 @@ declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySche
145
145
  }>;
146
146
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
147
147
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
148
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
148
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
149
149
  background?: "auto" | "transparent" | "opaque" | undefined;
150
150
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
151
151
  outputCompression?: number | undefined;
@@ -389,6 +389,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
389
389
  call_id: string;
390
390
  name: string;
391
391
  arguments: string;
392
+ async?: boolean | null | undefined;
392
393
  namespace?: string | null | undefined;
393
394
  } | {
394
395
  type: "web_search_call";
@@ -451,6 +452,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
451
452
  call_id: string;
452
453
  name: string;
453
454
  input: string;
455
+ async?: boolean | null | undefined;
454
456
  } | {
455
457
  type: "shell_call";
456
458
  id: string;
@@ -519,6 +521,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
519
521
  name: string;
520
522
  arguments: string;
521
523
  status: "completed";
524
+ async?: boolean | null | undefined;
522
525
  namespace?: string | null | undefined;
523
526
  } | {
524
527
  type: "custom_tool_call";
@@ -527,6 +530,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
527
530
  name: string;
528
531
  input: string;
529
532
  status: "completed";
533
+ async?: boolean | null | undefined;
530
534
  } | {
531
535
  type: "code_interpreter_call";
532
536
  id: string;
@@ -779,6 +783,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
779
783
  type OpenaiResponsesProviderMetadata = {
780
784
  openai: ResponsesProviderMetadata;
781
785
  };
786
+ type ResponsesToolCallProviderMetadata = {
787
+ itemId: string;
788
+ async?: boolean;
789
+ namespace?: string;
790
+ };
791
+ type OpenaiResponsesToolCallProviderMetadata = {
792
+ openai: ResponsesToolCallProviderMetadata;
793
+ };
782
794
  type ResponsesTextProviderMetadata = {
783
795
  itemId: string;
784
796
  phase?: 'commentary' | 'final_answer' | null;
@@ -1109,7 +1121,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1109
1121
  outputCompression?: number | undefined;
1110
1122
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
1111
1123
  partialImages?: number | undefined;
1112
- quality?: "low" | "medium" | "high" | "auto" | undefined;
1124
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | undefined;
1113
1125
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
1114
1126
  }>;
1115
1127
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -1161,9 +1173,10 @@ type ImageGenerationArgs = {
1161
1173
  partialImages?: number;
1162
1174
  /**
1163
1175
  * The quality of the generated image.
1164
- * One of low, medium, high, or auto. Default: auto.
1176
+ * One of low, medium, high, xhigh, max, or auto. Default: auto.
1177
+ * xhigh and max are supported by GPT Image 2.5 models.
1165
1178
  */
1166
- quality?: 'auto' | 'low' | 'medium' | 'high';
1179
+ quality?: 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
1167
1180
  /**
1168
1181
  * The size of the generated image.
1169
1182
  * One of 1024x1024, 1024x1536, 1536x1024, or auto.
@@ -1463,4 +1476,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
1463
1476
  };
1464
1477
  }>;
1465
1478
 
1466
- export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
1479
+ export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -104,6 +104,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
104
104
  supportsFlexProcessing,
105
105
  supportsPriorityProcessing,
106
106
  supportsConfigurationUpdate: isGpt6OrLaterModel,
107
+ supportsAsyncToolCalling: isGpt6OrLaterModel,
107
108
  supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
108
109
  isReasoningModel,
109
110
  systemMessageMode,
@@ -2107,9 +2108,10 @@ var baseImageModelOptionsObject = import_v49.z.object({
2107
2108
  /**
2108
2109
  * Quality of the generated image(s).
2109
2110
  *
2110
- * Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
2111
+ * Valid values: `standard`, `hd`, `low`, `medium`, `high`, `xhigh`, `max`, `auto`.
2112
+ * `xhigh` and `max` are supported by GPT Image 2.5 models.
2111
2113
  */
2112
- quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "auto"]).optional(),
2114
+ quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "xhigh", "max", "auto"]).optional(),
2113
2115
  /**
2114
2116
  * Background behavior for the generated image(s).
2115
2117
  *
@@ -3240,7 +3242,7 @@ async function convertToOpenAIResponsesInput({
3240
3242
  toolSearchToolName,
3241
3243
  customProviderToolNames
3242
3244
  }) {
3243
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
3245
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
3244
3246
  let input = [];
3245
3247
  const warnings = [];
3246
3248
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -3425,6 +3427,7 @@ async function convertToOpenAIResponsesInput({
3425
3427
  }
3426
3428
  const id = (_f = (_c = (_b = part.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? void 0 : _d[providerOptionsName]) == null ? void 0 : _e.itemId;
3427
3429
  const namespace = (_k = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.namespace) != null ? _k : (_j = (_i = part.providerMetadata) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.namespace;
3430
+ const isAsync = (_p = (_m = (_l = part.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.async) != null ? _p : (_o = (_n = part.providerMetadata) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.async;
3428
3431
  if (hasConversation && id != null) {
3429
3432
  break;
3430
3433
  }
@@ -3448,7 +3451,7 @@ async function convertToOpenAIResponsesInput({
3448
3451
  type: "tool_search_call",
3449
3452
  id: id != null ? id : part.toolCallId,
3450
3453
  execution,
3451
- call_id: (_l = parsedInput.call_id) != null ? _l : null,
3454
+ call_id: (_q = parsedInput.call_id) != null ? _q : null,
3452
3455
  status: "completed",
3453
3456
  arguments: parsedInput.arguments
3454
3457
  });
@@ -3462,7 +3465,7 @@ async function convertToOpenAIResponsesInput({
3462
3465
  break;
3463
3466
  }
3464
3467
  }
3465
- const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_m = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _m : false);
3468
+ const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_r = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _r : false);
3466
3469
  if (hasPreviousResponseId && store && id != null && isProviderDefinedToolCall) {
3467
3470
  break;
3468
3471
  }
@@ -3528,6 +3531,7 @@ async function convertToOpenAIResponsesInput({
3528
3531
  call_id: part.toolCallId,
3529
3532
  name: resolvedToolName,
3530
3533
  input: typeof part.input === "string" ? part.input : JSON.stringify(part.input),
3534
+ ...isAsync != null && { async: isAsync },
3531
3535
  id
3532
3536
  });
3533
3537
  break;
@@ -3537,6 +3541,7 @@ async function convertToOpenAIResponsesInput({
3537
3541
  call_id: part.toolCallId,
3538
3542
  name: resolvedToolName,
3539
3543
  arguments: serializeToolCallArguments2(part.input),
3544
+ ...isAsync != null && { async: isAsync },
3540
3545
  ...namespace != null && { namespace }
3541
3546
  });
3542
3547
  break;
@@ -3553,7 +3558,7 @@ async function convertToOpenAIResponsesInput({
3553
3558
  part.toolName
3554
3559
  );
3555
3560
  if (part.toolName === toolSearchToolName) {
3556
- const itemId = (_s = (_r = (_o = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.itemId) != null ? _r : (_q = (_p = part.providerMetadata) == null ? void 0 : _p[providerOptionsName]) == null ? void 0 : _q.itemId) != null ? _s : part.toolCallId;
3561
+ const itemId = (_x = (_w = (_t = (_s = part.providerOptions) == null ? void 0 : _s[providerOptionsName]) == null ? void 0 : _t.itemId) != null ? _w : (_v = (_u = part.providerMetadata) == null ? void 0 : _u[providerOptionsName]) == null ? void 0 : _v.itemId) != null ? _x : part.toolCallId;
3557
3562
  if (store) {
3558
3563
  input.push({ type: "item_reference", id: itemId });
3559
3564
  } else if (part.output.type === "json") {
@@ -3594,7 +3599,7 @@ async function convertToOpenAIResponsesInput({
3594
3599
  break;
3595
3600
  }
3596
3601
  if (store) {
3597
- const itemId = (_v = (_u = (_t = part.providerOptions) == null ? void 0 : _t[providerOptionsName]) == null ? void 0 : _u.itemId) != null ? _v : part.toolCallId;
3602
+ const itemId = (_A = (_z = (_y = part.providerOptions) == null ? void 0 : _y[providerOptionsName]) == null ? void 0 : _z.itemId) != null ? _A : part.toolCallId;
3598
3603
  input.push({ type: "item_reference", id: itemId });
3599
3604
  } else {
3600
3605
  warnings.push({
@@ -3761,7 +3766,7 @@ ${text}`,
3761
3766
  }
3762
3767
  const output = part.output;
3763
3768
  if (output.type === "execution-denied") {
3764
- const approvalId = (_x = (_w = output.providerOptions) == null ? void 0 : _w.openai) == null ? void 0 : _x.approvalId;
3769
+ const approvalId = (_C = (_B = output.providerOptions) == null ? void 0 : _B.openai) == null ? void 0 : _C.approvalId;
3765
3770
  if (approvalId) {
3766
3771
  continue;
3767
3772
  }
@@ -3848,7 +3853,7 @@ ${text}`,
3848
3853
  break;
3849
3854
  case "execution-denied":
3850
3855
  outputValue = convertScalarOutput(
3851
- (_y = output.reason) != null ? _y : "Tool call execution denied."
3856
+ (_D = output.reason) != null ? _D : "Tool call execution denied."
3852
3857
  );
3853
3858
  break;
3854
3859
  case "json":
@@ -4186,6 +4191,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
4186
4191
  call_id: import_v418.z.string(),
4187
4192
  name: import_v418.z.string(),
4188
4193
  arguments: import_v418.z.string(),
4194
+ async: import_v418.z.boolean().nullish(),
4189
4195
  namespace: import_v418.z.string().nullish()
4190
4196
  }),
4191
4197
  import_v418.z.object({
@@ -4261,7 +4267,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
4261
4267
  id: import_v418.z.string(),
4262
4268
  call_id: import_v418.z.string(),
4263
4269
  name: import_v418.z.string(),
4264
- input: import_v418.z.string()
4270
+ input: import_v418.z.string(),
4271
+ async: import_v418.z.boolean().nullish()
4265
4272
  }),
4266
4273
  import_v418.z.object({
4267
4274
  type: import_v418.z.literal("shell_call"),
@@ -4329,6 +4336,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
4329
4336
  call_id: import_v418.z.string(),
4330
4337
  name: import_v418.z.string(),
4331
4338
  arguments: import_v418.z.string(),
4339
+ async: import_v418.z.boolean().nullish(),
4332
4340
  status: import_v418.z.literal("completed"),
4333
4341
  namespace: import_v418.z.string().nullish()
4334
4342
  }),
@@ -4338,6 +4346,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
4338
4346
  call_id: import_v418.z.string(),
4339
4347
  name: import_v418.z.string(),
4340
4348
  input: import_v418.z.string(),
4349
+ async: import_v418.z.boolean().nullish(),
4341
4350
  status: import_v418.z.literal("completed")
4342
4351
  }),
4343
4352
  import_v418.z.object({
@@ -4771,6 +4780,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
4771
4780
  name: import_v418.z.string(),
4772
4781
  arguments: import_v418.z.string(),
4773
4782
  id: import_v418.z.string(),
4783
+ async: import_v418.z.boolean().nullish(),
4774
4784
  namespace: import_v418.z.string().nullish()
4775
4785
  }),
4776
4786
  import_v418.z.object({
@@ -4778,7 +4788,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
4778
4788
  call_id: import_v418.z.string(),
4779
4789
  name: import_v418.z.string(),
4780
4790
  input: import_v418.z.string(),
4781
- id: import_v418.z.string()
4791
+ id: import_v418.z.string(),
4792
+ async: import_v418.z.boolean().nullish()
4782
4793
  }),
4783
4794
  import_v418.z.object({
4784
4795
  type: import_v418.z.literal("computer_call"),
@@ -5316,7 +5327,7 @@ var imageGenerationArgsSchema = (0, import_provider_utils30.lazySchema)(
5316
5327
  outputCompression: import_v422.z.number().int().min(0).max(100).optional(),
5317
5328
  outputFormat: import_v422.z.enum(["png", "jpeg", "webp"]).optional(),
5318
5329
  partialImages: import_v422.z.number().int().min(0).max(3).optional(),
5319
- quality: import_v422.z.enum(["auto", "low", "medium", "high"]).optional(),
5330
+ quality: import_v422.z.enum(["auto", "low", "medium", "high", "xhigh", "max"]).optional(),
5320
5331
  size: import_v422.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
5321
5332
  }).strict()
5322
5333
  )
@@ -5342,6 +5353,7 @@ var customArgsSchema = (0, import_provider_utils31.lazySchema)(
5342
5353
  import_v423.z.object({
5343
5354
  name: import_v423.z.string(),
5344
5355
  description: import_v423.z.string().optional(),
5356
+ async: import_v423.z.boolean().optional(),
5345
5357
  format: import_v423.z.union([
5346
5358
  import_v423.z.object({
5347
5359
  type: import_v423.z.literal("grammar"),
@@ -5534,7 +5546,8 @@ async function prepareResponsesTools({
5534
5546
  toolChoice,
5535
5547
  allowedTools,
5536
5548
  toolNameMapping,
5537
- customProviderToolNames
5549
+ customProviderToolNames,
5550
+ supportsAsyncToolCalling = true
5538
5551
  }) {
5539
5552
  var _a2, _b, _c, _d;
5540
5553
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -5565,7 +5578,13 @@ async function prepareResponsesTools({
5565
5578
  const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
5566
5579
  const openaiFunctionTool = prepareFunctionTool({
5567
5580
  tool,
5568
- options: openaiOptions
5581
+ options: openaiOptions,
5582
+ async: resolveAsyncToolOption({
5583
+ value: openaiOptions == null ? void 0 : openaiOptions.async,
5584
+ supportsAsyncToolCalling,
5585
+ toolName: tool.name,
5586
+ toolWarnings
5587
+ })
5569
5588
  });
5570
5589
  const namespace = openaiOptions == null ? void 0 : openaiOptions.namespace;
5571
5590
  if (namespace == null) {
@@ -5747,6 +5766,12 @@ async function prepareResponsesTools({
5747
5766
  type: "custom",
5748
5767
  name: args.name,
5749
5768
  description: args.description,
5769
+ ...resolveAsyncToolOption({
5770
+ value: args.async,
5771
+ supportsAsyncToolCalling,
5772
+ toolName: args.name,
5773
+ toolWarnings
5774
+ }) != null ? { async: args.async } : {},
5750
5775
  format: args.format
5751
5776
  });
5752
5777
  resolvedCustomProviderToolNames.add(args.name);
@@ -5918,7 +5943,8 @@ function toAllowedToolResolution(tool) {
5918
5943
  }
5919
5944
  function prepareFunctionTool({
5920
5945
  tool,
5921
- options
5946
+ options,
5947
+ async
5922
5948
  }) {
5923
5949
  const deferLoading = options == null ? void 0 : options.deferLoading;
5924
5950
  return {
@@ -5926,10 +5952,27 @@ function prepareFunctionTool({
5926
5952
  name: tool.name,
5927
5953
  description: tool.description,
5928
5954
  parameters: tool.inputSchema,
5955
+ ...async != null ? { async } : {},
5929
5956
  ...tool.strict != null ? { strict: tool.strict } : {},
5930
5957
  ...deferLoading != null ? { defer_loading: deferLoading } : {}
5931
5958
  };
5932
5959
  }
5960
+ function resolveAsyncToolOption({
5961
+ value,
5962
+ supportsAsyncToolCalling,
5963
+ toolName,
5964
+ toolWarnings
5965
+ }) {
5966
+ if (value !== true || supportsAsyncToolCalling) {
5967
+ return value;
5968
+ }
5969
+ toolWarnings.push({
5970
+ type: "unsupported",
5971
+ feature: `async tool calling for "${toolName}"`,
5972
+ details: "Async tool calling is only supported by GPT-6 and later models."
5973
+ });
5974
+ return void 0;
5975
+ }
5933
5976
  function mapShellEnvironment(environment) {
5934
5977
  if (environment.type === "containerReference") {
5935
5978
  const env2 = environment;
@@ -6097,7 +6140,8 @@ var OpenAIResponsesLanguageModel = class {
6097
6140
  toolChoice,
6098
6141
  allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
6099
6142
  toolNameMapping,
6100
- customProviderToolNames
6143
+ customProviderToolNames,
6144
+ supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
6101
6145
  });
6102
6146
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
6103
6147
  prompt,
@@ -6607,6 +6651,7 @@ var OpenAIResponsesLanguageModel = class {
6607
6651
  providerMetadata: {
6608
6652
  [providerOptionsName]: {
6609
6653
  itemId: part.id,
6654
+ ...part.async != null && { async: part.async },
6610
6655
  ...part.namespace != null && { namespace: part.namespace }
6611
6656
  }
6612
6657
  }
@@ -6623,7 +6668,8 @@ var OpenAIResponsesLanguageModel = class {
6623
6668
  input: JSON.stringify(part.input),
6624
6669
  providerMetadata: {
6625
6670
  [providerOptionsName]: {
6626
- itemId: part.id
6671
+ itemId: part.id,
6672
+ ...part.async != null && { async: part.async }
6627
6673
  }
6628
6674
  }
6629
6675
  });
@@ -6911,7 +6957,8 @@ var OpenAIResponsesLanguageModel = class {
6911
6957
  toolName: value.item.name,
6912
6958
  toolCallId: value.item.call_id,
6913
6959
  suppressInputStreaming,
6914
- bufferedInputDeltas: suppressInputStreaming ? [] : void 0
6960
+ bufferedInputDeltas: suppressInputStreaming ? [] : void 0,
6961
+ async: value.item.async
6915
6962
  };
6916
6963
  if (!suppressInputStreaming) {
6917
6964
  controller.enqueue({
@@ -6926,7 +6973,8 @@ var OpenAIResponsesLanguageModel = class {
6926
6973
  );
6927
6974
  ongoingToolCalls[value.output_index] = {
6928
6975
  toolName,
6929
- toolCallId: value.item.call_id
6976
+ toolCallId: value.item.call_id,
6977
+ async: value.item.async
6930
6978
  };
6931
6979
  controller.enqueue({
6932
6980
  type: "tool-input-start",
@@ -7170,6 +7218,7 @@ var OpenAIResponsesLanguageModel = class {
7170
7218
  providerMetadata: {
7171
7219
  [providerOptionsName]: {
7172
7220
  itemId: item.id,
7221
+ ...item.async != null ? { async: item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {},
7173
7222
  ...item.namespace != null && {
7174
7223
  namespace: item.namespace
7175
7224
  }
@@ -7214,6 +7263,7 @@ var OpenAIResponsesLanguageModel = class {
7214
7263
  }
7215
7264
  });
7216
7265
  } else if (value.item.type === "custom_tool_call") {
7266
+ const ongoingToolCall = ongoingToolCalls[value.output_index];
7217
7267
  ongoingToolCalls[value.output_index] = void 0;
7218
7268
  hasFunctionCall = true;
7219
7269
  const toolName = toolNameMapping.toCustomToolName(
@@ -7230,7 +7280,8 @@ var OpenAIResponsesLanguageModel = class {
7230
7280
  input: JSON.stringify(value.item.input),
7231
7281
  providerMetadata: {
7232
7282
  [providerOptionsName]: {
7233
- itemId: value.item.id
7283
+ itemId: value.item.id,
7284
+ ...value.item.async != null ? { async: value.item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {}
7234
7285
  }
7235
7286
  }
7236
7287
  });