@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.110
4
+
5
+ ### Patch Changes
6
+
7
+ - 447ba18: feat(openai): add async tool calling
8
+ - 46c6820: Add `xhigh` and `max` quality support for GPT Image 2.5 Flare and Sunburst in image generation, image editing, and the Responses API image generation tool.
9
+
3
10
  ## 3.0.109
4
11
 
5
12
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -48,7 +48,7 @@ type OpenAIEmbeddingModelOptions = InferSchema<typeof openaiEmbeddingModelOption
48
48
 
49
49
  type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
50
50
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
51
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
51
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
52
52
  background?: "auto" | "transparent" | "opaque" | undefined;
53
53
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
54
54
  outputCompression?: number | undefined;
@@ -56,7 +56,7 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
56
56
  }>;
57
57
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
58
58
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
59
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
59
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
60
60
  background?: "auto" | "transparent" | "opaque" | undefined;
61
61
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
62
62
  outputCompression?: number | undefined;
@@ -66,7 +66,7 @@ declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySche
66
66
  }>;
67
67
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
68
68
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
69
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
69
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
70
70
  background?: "auto" | "transparent" | "opaque" | undefined;
71
71
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
72
72
  outputCompression?: number | undefined;
@@ -341,6 +341,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
341
341
  call_id: string;
342
342
  name: string;
343
343
  arguments: string;
344
+ async?: boolean | null | undefined;
344
345
  namespace?: string | null | undefined;
345
346
  } | {
346
347
  type: "web_search_call";
@@ -403,6 +404,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
403
404
  call_id: string;
404
405
  name: string;
405
406
  input: string;
407
+ async?: boolean | null | undefined;
406
408
  } | {
407
409
  type: "shell_call";
408
410
  id: string;
@@ -471,6 +473,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
471
473
  name: string;
472
474
  arguments: string;
473
475
  status: "completed";
476
+ async?: boolean | null | undefined;
474
477
  namespace?: string | null | undefined;
475
478
  } | {
476
479
  type: "custom_tool_call";
@@ -479,6 +482,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
479
482
  name: string;
480
483
  input: string;
481
484
  status: "completed";
485
+ async?: boolean | null | undefined;
482
486
  } | {
483
487
  type: "code_interpreter_call";
484
488
  id: string;
@@ -720,6 +724,11 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
720
724
  * An optional description of what the tool does.
721
725
  */
722
726
  description?: string;
727
+ /**
728
+ * Whether the model can continue generating after calling this tool
729
+ * without waiting for its result.
730
+ */
731
+ async?: boolean;
723
732
  /**
724
733
  * The output format specification for the tool.
725
734
  * Omit for unconstrained text output.
@@ -786,6 +795,7 @@ declare const openaiTools: {
786
795
  *
787
796
  * @param name - The name of the custom tool.
788
797
  * @param description - An optional description of the tool.
798
+ * @param async - Whether the model can continue without waiting for the tool result.
789
799
  * @param format - The output format constraint (grammar type, syntax, and definition).
790
800
  */
791
801
  customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
@@ -853,7 +863,7 @@ declare const openaiTools: {
853
863
  * @param outputCompression - Compression level for the output image (0-100).
854
864
  * @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
855
865
  * @param partialImages - Number of partial images to generate in streaming mode (0-3).
856
- * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
866
+ * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', 'high', 'xhigh', or 'max'. 'xhigh' and 'max' require a GPT Image 2.5 model.
857
867
  * @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
858
868
  */
859
869
  imageGeneration: (args?: {
@@ -868,7 +878,7 @@ declare const openaiTools: {
868
878
  outputCompression?: number;
869
879
  outputFormat?: "png" | "jpeg" | "webp";
870
880
  partialImages?: number;
871
- quality?: "auto" | "low" | "medium" | "high";
881
+ quality?: "auto" | "low" | "medium" | "high" | "xhigh" | "max";
872
882
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
873
883
  }) => _ai_sdk_provider_utils.Tool<{}, {
874
884
  result: string;
@@ -986,19 +996,7 @@ declare const openaiTools: {
986
996
  type: "approximate";
987
997
  country?: string;
988
998
  city?: string;
989
- region
990
- /**
991
- * Local shell is a tool that allows agents to run shell commands locally
992
- * on a machine you or the user provides.
993
- *
994
- * Supported models: `gpt-5-codex`
995
- */
996
- ? /**
997
- * Local shell is a tool that allows agents to run shell commands locally
998
- * on a machine you or the user provides.
999
- *
1000
- * Supported models: `gpt-5-codex`
1001
- */: string;
999
+ region?: string;
1002
1000
  timezone?: string;
1003
1001
  };
1004
1002
  }>;
@@ -1244,6 +1242,19 @@ declare function createOpenAI(options?: OpenAIProviderSettings): OpenAIProvider;
1244
1242
  */
1245
1243
  declare const openai: OpenAIProvider;
1246
1244
 
1245
+ type OpenAIToolOptions = {
1246
+ /**
1247
+ * Whether the model can continue generating after calling this tool without
1248
+ * waiting for its result.
1249
+ */
1250
+ async?: boolean;
1251
+ deferLoading?: boolean;
1252
+ namespace?: {
1253
+ name: string;
1254
+ description: string;
1255
+ };
1256
+ };
1257
+
1247
1258
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1248
1259
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
1249
1260
  type: 'response.output_text.annotation.added';
@@ -1264,6 +1275,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
1264
1275
  type OpenaiResponsesProviderMetadata = {
1265
1276
  openai: ResponsesProviderMetadata;
1266
1277
  };
1278
+ type ResponsesToolCallProviderMetadata = {
1279
+ itemId: string;
1280
+ async?: boolean;
1281
+ namespace?: string;
1282
+ };
1283
+ type OpenaiResponsesToolCallProviderMetadata = {
1284
+ openai: ResponsesToolCallProviderMetadata;
1285
+ };
1267
1286
  type ResponsesTextProviderMetadata = {
1268
1287
  itemId: string;
1269
1288
  phase?: 'commentary' | 'final_answer' | null;
@@ -1291,4 +1310,4 @@ type OpenaiResponsesSourceDocumentProviderMetadata = {
1291
1310
 
1292
1311
  declare const VERSION: string;
1293
1312
 
1294
- export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai };
1313
+ export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAIToolOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, VERSION, createOpenAI, openai };
package/dist/index.d.ts CHANGED
@@ -48,7 +48,7 @@ type OpenAIEmbeddingModelOptions = InferSchema<typeof openaiEmbeddingModelOption
48
48
 
49
49
  type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
50
50
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
51
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
51
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
52
52
  background?: "auto" | "transparent" | "opaque" | undefined;
53
53
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
54
54
  outputCompression?: number | undefined;
@@ -56,7 +56,7 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
56
56
  }>;
57
57
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
58
58
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
59
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
59
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
60
60
  background?: "auto" | "transparent" | "opaque" | undefined;
61
61
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
62
62
  outputCompression?: number | undefined;
@@ -66,7 +66,7 @@ declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySche
66
66
  }>;
67
67
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
68
68
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
69
- quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
69
+ quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
70
70
  background?: "auto" | "transparent" | "opaque" | undefined;
71
71
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
72
72
  outputCompression?: number | undefined;
@@ -341,6 +341,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
341
341
  call_id: string;
342
342
  name: string;
343
343
  arguments: string;
344
+ async?: boolean | null | undefined;
344
345
  namespace?: string | null | undefined;
345
346
  } | {
346
347
  type: "web_search_call";
@@ -403,6 +404,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
403
404
  call_id: string;
404
405
  name: string;
405
406
  input: string;
407
+ async?: boolean | null | undefined;
406
408
  } | {
407
409
  type: "shell_call";
408
410
  id: string;
@@ -471,6 +473,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
471
473
  name: string;
472
474
  arguments: string;
473
475
  status: "completed";
476
+ async?: boolean | null | undefined;
474
477
  namespace?: string | null | undefined;
475
478
  } | {
476
479
  type: "custom_tool_call";
@@ -479,6 +482,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
479
482
  name: string;
480
483
  input: string;
481
484
  status: "completed";
485
+ async?: boolean | null | undefined;
482
486
  } | {
483
487
  type: "code_interpreter_call";
484
488
  id: string;
@@ -720,6 +724,11 @@ declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<stri
720
724
  * An optional description of what the tool does.
721
725
  */
722
726
  description?: string;
727
+ /**
728
+ * Whether the model can continue generating after calling this tool
729
+ * without waiting for its result.
730
+ */
731
+ async?: boolean;
723
732
  /**
724
733
  * The output format specification for the tool.
725
734
  * Omit for unconstrained text output.
@@ -786,6 +795,7 @@ declare const openaiTools: {
786
795
  *
787
796
  * @param name - The name of the custom tool.
788
797
  * @param description - An optional description of the tool.
798
+ * @param async - Whether the model can continue without waiting for the tool result.
789
799
  * @param format - The output format constraint (grammar type, syntax, and definition).
790
800
  */
791
801
  customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown>;
@@ -853,7 +863,7 @@ declare const openaiTools: {
853
863
  * @param outputCompression - Compression level for the output image (0-100).
854
864
  * @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
855
865
  * @param partialImages - Number of partial images to generate in streaming mode (0-3).
856
- * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
866
+ * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', 'high', 'xhigh', or 'max'. 'xhigh' and 'max' require a GPT Image 2.5 model.
857
867
  * @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
858
868
  */
859
869
  imageGeneration: (args?: {
@@ -868,7 +878,7 @@ declare const openaiTools: {
868
878
  outputCompression?: number;
869
879
  outputFormat?: "png" | "jpeg" | "webp";
870
880
  partialImages?: number;
871
- quality?: "auto" | "low" | "medium" | "high";
881
+ quality?: "auto" | "low" | "medium" | "high" | "xhigh" | "max";
872
882
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
873
883
  }) => _ai_sdk_provider_utils.Tool<{}, {
874
884
  result: string;
@@ -986,19 +996,7 @@ declare const openaiTools: {
986
996
  type: "approximate";
987
997
  country?: string;
988
998
  city?: string;
989
- region
990
- /**
991
- * Local shell is a tool that allows agents to run shell commands locally
992
- * on a machine you or the user provides.
993
- *
994
- * Supported models: `gpt-5-codex`
995
- */
996
- ? /**
997
- * Local shell is a tool that allows agents to run shell commands locally
998
- * on a machine you or the user provides.
999
- *
1000
- * Supported models: `gpt-5-codex`
1001
- */: string;
999
+ region?: string;
1002
1000
  timezone?: string;
1003
1001
  };
1004
1002
  }>;
@@ -1244,6 +1242,19 @@ declare function createOpenAI(options?: OpenAIProviderSettings): OpenAIProvider;
1244
1242
  */
1245
1243
  declare const openai: OpenAIProvider;
1246
1244
 
1245
+ type OpenAIToolOptions = {
1246
+ /**
1247
+ * Whether the model can continue generating after calling this tool without
1248
+ * waiting for its result.
1249
+ */
1250
+ async?: boolean;
1251
+ deferLoading?: boolean;
1252
+ namespace?: {
1253
+ name: string;
1254
+ description: string;
1255
+ };
1256
+ };
1257
+
1247
1258
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1248
1259
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
1249
1260
  type: 'response.output_text.annotation.added';
@@ -1264,6 +1275,14 @@ type OpenaiResponsesReasoningProviderMetadata = {
1264
1275
  type OpenaiResponsesProviderMetadata = {
1265
1276
  openai: ResponsesProviderMetadata;
1266
1277
  };
1278
+ type ResponsesToolCallProviderMetadata = {
1279
+ itemId: string;
1280
+ async?: boolean;
1281
+ namespace?: string;
1282
+ };
1283
+ type OpenaiResponsesToolCallProviderMetadata = {
1284
+ openai: ResponsesToolCallProviderMetadata;
1285
+ };
1267
1286
  type ResponsesTextProviderMetadata = {
1268
1287
  itemId: string;
1269
1288
  phase?: 'commentary' | 'final_answer' | null;
@@ -1291,4 +1310,4 @@ type OpenaiResponsesSourceDocumentProviderMetadata = {
1291
1310
 
1292
1311
  declare const VERSION: string;
1293
1312
 
1294
- export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai };
1313
+ export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAIToolOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, VERSION, createOpenAI, openai };
package/dist/index.js CHANGED
@@ -69,6 +69,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
69
69
  supportsFlexProcessing,
70
70
  supportsPriorityProcessing,
71
71
  supportsConfigurationUpdate: isGpt6OrLaterModel,
72
+ supportsAsyncToolCalling: isGpt6OrLaterModel,
72
73
  supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
73
74
  isReasoningModel,
74
75
  systemMessageMode,
@@ -2072,9 +2073,10 @@ var baseImageModelOptionsObject = import_v49.z.object({
2072
2073
  /**
2073
2074
  * Quality of the generated image(s).
2074
2075
  *
2075
- * Valid values: `standard`, `hd`, `low`, `medium`, `high`, `auto`.
2076
+ * Valid values: `standard`, `hd`, `low`, `medium`, `high`, `xhigh`, `max`, `auto`.
2077
+ * `xhigh` and `max` are supported by GPT Image 2.5 models.
2076
2078
  */
2077
- quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "auto"]).optional(),
2079
+ quality: import_v49.z.enum(["standard", "hd", "low", "medium", "high", "xhigh", "max", "auto"]).optional(),
2078
2080
  /**
2079
2081
  * Background behavior for the generated image(s).
2080
2082
  *
@@ -2435,6 +2437,7 @@ var customArgsSchema = (0, import_provider_utils17.lazySchema)(
2435
2437
  import_v412.z.object({
2436
2438
  name: import_v412.z.string(),
2437
2439
  description: import_v412.z.string().optional(),
2440
+ async: import_v412.z.boolean().optional(),
2438
2441
  format: import_v412.z.union([
2439
2442
  import_v412.z.object({
2440
2443
  type: import_v412.z.literal("grammar"),
@@ -2521,7 +2524,7 @@ var imageGenerationArgsSchema = (0, import_provider_utils19.lazySchema)(
2521
2524
  outputCompression: import_v414.z.number().int().min(0).max(100).optional(),
2522
2525
  outputFormat: import_v414.z.enum(["png", "jpeg", "webp"]).optional(),
2523
2526
  partialImages: import_v414.z.number().int().min(0).max(3).optional(),
2524
- quality: import_v414.z.enum(["auto", "low", "medium", "high"]).optional(),
2527
+ quality: import_v414.z.enum(["auto", "low", "medium", "high", "xhigh", "max"]).optional(),
2525
2528
  size: import_v414.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2526
2529
  }).strict()
2527
2530
  )
@@ -2881,6 +2884,7 @@ var openaiTools = {
2881
2884
  *
2882
2885
  * @param name - The name of the custom tool.
2883
2886
  * @param description - An optional description of the tool.
2887
+ * @param async - Whether the model can continue without waiting for the tool result.
2884
2888
  * @param format - The output format constraint (grammar type, syntax, and definition).
2885
2889
  */
2886
2890
  customTool,
@@ -2916,7 +2920,7 @@ var openaiTools = {
2916
2920
  * @param outputCompression - Compression level for the output image (0-100).
2917
2921
  * @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
2918
2922
  * @param partialImages - Number of partial images to generate in streaming mode (0-3).
2919
- * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
2923
+ * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', 'high', 'xhigh', or 'max'. 'xhigh' and 'max' require a GPT Image 2.5 model.
2920
2924
  * @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
2921
2925
  */
2922
2926
  imageGeneration,
@@ -3296,7 +3300,7 @@ async function convertToOpenAIResponsesInput({
3296
3300
  toolSearchToolName,
3297
3301
  customProviderToolNames
3298
3302
  }) {
3299
- 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;
3303
+ 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;
3300
3304
  let input = [];
3301
3305
  const warnings = [];
3302
3306
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -3481,6 +3485,7 @@ async function convertToOpenAIResponsesInput({
3481
3485
  }
3482
3486
  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;
3483
3487
  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;
3488
+ 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;
3484
3489
  if (hasConversation && id != null) {
3485
3490
  break;
3486
3491
  }
@@ -3504,7 +3509,7 @@ async function convertToOpenAIResponsesInput({
3504
3509
  type: "tool_search_call",
3505
3510
  id: id != null ? id : part.toolCallId,
3506
3511
  execution,
3507
- call_id: (_l = parsedInput.call_id) != null ? _l : null,
3512
+ call_id: (_q = parsedInput.call_id) != null ? _q : null,
3508
3513
  status: "completed",
3509
3514
  arguments: parsedInput.arguments
3510
3515
  });
@@ -3518,7 +3523,7 @@ async function convertToOpenAIResponsesInput({
3518
3523
  break;
3519
3524
  }
3520
3525
  }
3521
- const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_m = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _m : false);
3526
+ const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_r = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _r : false);
3522
3527
  if (hasPreviousResponseId && store && id != null && isProviderDefinedToolCall) {
3523
3528
  break;
3524
3529
  }
@@ -3584,6 +3589,7 @@ async function convertToOpenAIResponsesInput({
3584
3589
  call_id: part.toolCallId,
3585
3590
  name: resolvedToolName,
3586
3591
  input: typeof part.input === "string" ? part.input : JSON.stringify(part.input),
3592
+ ...isAsync != null && { async: isAsync },
3587
3593
  id
3588
3594
  });
3589
3595
  break;
@@ -3593,6 +3599,7 @@ async function convertToOpenAIResponsesInput({
3593
3599
  call_id: part.toolCallId,
3594
3600
  name: resolvedToolName,
3595
3601
  arguments: serializeToolCallArguments2(part.input),
3602
+ ...isAsync != null && { async: isAsync },
3596
3603
  ...namespace != null && { namespace }
3597
3604
  });
3598
3605
  break;
@@ -3609,7 +3616,7 @@ async function convertToOpenAIResponsesInput({
3609
3616
  part.toolName
3610
3617
  );
3611
3618
  if (part.toolName === toolSearchToolName) {
3612
- 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;
3619
+ 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;
3613
3620
  if (store) {
3614
3621
  input.push({ type: "item_reference", id: itemId });
3615
3622
  } else if (part.output.type === "json") {
@@ -3650,7 +3657,7 @@ async function convertToOpenAIResponsesInput({
3650
3657
  break;
3651
3658
  }
3652
3659
  if (store) {
3653
- const itemId = (_v = (_u = (_t = part.providerOptions) == null ? void 0 : _t[providerOptionsName]) == null ? void 0 : _u.itemId) != null ? _v : part.toolCallId;
3660
+ const itemId = (_A = (_z = (_y = part.providerOptions) == null ? void 0 : _y[providerOptionsName]) == null ? void 0 : _z.itemId) != null ? _A : part.toolCallId;
3654
3661
  input.push({ type: "item_reference", id: itemId });
3655
3662
  } else {
3656
3663
  warnings.push({
@@ -3817,7 +3824,7 @@ ${text}`,
3817
3824
  }
3818
3825
  const output = part.output;
3819
3826
  if (output.type === "execution-denied") {
3820
- const approvalId = (_x = (_w = output.providerOptions) == null ? void 0 : _w.openai) == null ? void 0 : _x.approvalId;
3827
+ const approvalId = (_C = (_B = output.providerOptions) == null ? void 0 : _B.openai) == null ? void 0 : _C.approvalId;
3821
3828
  if (approvalId) {
3822
3829
  continue;
3823
3830
  }
@@ -3904,7 +3911,7 @@ ${text}`,
3904
3911
  break;
3905
3912
  case "execution-denied":
3906
3913
  outputValue = convertScalarOutput(
3907
- (_y = output.reason) != null ? _y : "Tool call execution denied."
3914
+ (_D = output.reason) != null ? _D : "Tool call execution denied."
3908
3915
  );
3909
3916
  break;
3910
3917
  case "json":
@@ -4242,6 +4249,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils28.lazySchema)(
4242
4249
  call_id: import_v422.z.string(),
4243
4250
  name: import_v422.z.string(),
4244
4251
  arguments: import_v422.z.string(),
4252
+ async: import_v422.z.boolean().nullish(),
4245
4253
  namespace: import_v422.z.string().nullish()
4246
4254
  }),
4247
4255
  import_v422.z.object({
@@ -4317,7 +4325,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils28.lazySchema)(
4317
4325
  id: import_v422.z.string(),
4318
4326
  call_id: import_v422.z.string(),
4319
4327
  name: import_v422.z.string(),
4320
- input: import_v422.z.string()
4328
+ input: import_v422.z.string(),
4329
+ async: import_v422.z.boolean().nullish()
4321
4330
  }),
4322
4331
  import_v422.z.object({
4323
4332
  type: import_v422.z.literal("shell_call"),
@@ -4385,6 +4394,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils28.lazySchema)(
4385
4394
  call_id: import_v422.z.string(),
4386
4395
  name: import_v422.z.string(),
4387
4396
  arguments: import_v422.z.string(),
4397
+ async: import_v422.z.boolean().nullish(),
4388
4398
  status: import_v422.z.literal("completed"),
4389
4399
  namespace: import_v422.z.string().nullish()
4390
4400
  }),
@@ -4394,6 +4404,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils28.lazySchema)(
4394
4404
  call_id: import_v422.z.string(),
4395
4405
  name: import_v422.z.string(),
4396
4406
  input: import_v422.z.string(),
4407
+ async: import_v422.z.boolean().nullish(),
4397
4408
  status: import_v422.z.literal("completed")
4398
4409
  }),
4399
4410
  import_v422.z.object({
@@ -4827,6 +4838,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils28.lazySchema)(
4827
4838
  name: import_v422.z.string(),
4828
4839
  arguments: import_v422.z.string(),
4829
4840
  id: import_v422.z.string(),
4841
+ async: import_v422.z.boolean().nullish(),
4830
4842
  namespace: import_v422.z.string().nullish()
4831
4843
  }),
4832
4844
  import_v422.z.object({
@@ -4834,7 +4846,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils28.lazySchema)(
4834
4846
  call_id: import_v422.z.string(),
4835
4847
  name: import_v422.z.string(),
4836
4848
  input: import_v422.z.string(),
4837
- id: import_v422.z.string()
4849
+ id: import_v422.z.string(),
4850
+ async: import_v422.z.boolean().nullish()
4838
4851
  }),
4839
4852
  import_v422.z.object({
4840
4853
  type: import_v422.z.literal("computer_call"),
@@ -5266,7 +5279,8 @@ async function prepareResponsesTools({
5266
5279
  toolChoice,
5267
5280
  allowedTools,
5268
5281
  toolNameMapping,
5269
- customProviderToolNames
5282
+ customProviderToolNames,
5283
+ supportsAsyncToolCalling = true
5270
5284
  }) {
5271
5285
  var _a2, _b, _c, _d;
5272
5286
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
@@ -5297,7 +5311,13 @@ async function prepareResponsesTools({
5297
5311
  const openaiOptions = (_a2 = tool.providerOptions) == null ? void 0 : _a2.openai;
5298
5312
  const openaiFunctionTool = prepareFunctionTool({
5299
5313
  tool,
5300
- options: openaiOptions
5314
+ options: openaiOptions,
5315
+ async: resolveAsyncToolOption({
5316
+ value: openaiOptions == null ? void 0 : openaiOptions.async,
5317
+ supportsAsyncToolCalling,
5318
+ toolName: tool.name,
5319
+ toolWarnings
5320
+ })
5301
5321
  });
5302
5322
  const namespace = openaiOptions == null ? void 0 : openaiOptions.namespace;
5303
5323
  if (namespace == null) {
@@ -5479,6 +5499,12 @@ async function prepareResponsesTools({
5479
5499
  type: "custom",
5480
5500
  name: args.name,
5481
5501
  description: args.description,
5502
+ ...resolveAsyncToolOption({
5503
+ value: args.async,
5504
+ supportsAsyncToolCalling,
5505
+ toolName: args.name,
5506
+ toolWarnings
5507
+ }) != null ? { async: args.async } : {},
5482
5508
  format: args.format
5483
5509
  });
5484
5510
  resolvedCustomProviderToolNames.add(args.name);
@@ -5650,7 +5676,8 @@ function toAllowedToolResolution(tool) {
5650
5676
  }
5651
5677
  function prepareFunctionTool({
5652
5678
  tool,
5653
- options
5679
+ options,
5680
+ async
5654
5681
  }) {
5655
5682
  const deferLoading = options == null ? void 0 : options.deferLoading;
5656
5683
  return {
@@ -5658,10 +5685,27 @@ function prepareFunctionTool({
5658
5685
  name: tool.name,
5659
5686
  description: tool.description,
5660
5687
  parameters: tool.inputSchema,
5688
+ ...async != null ? { async } : {},
5661
5689
  ...tool.strict != null ? { strict: tool.strict } : {},
5662
5690
  ...deferLoading != null ? { defer_loading: deferLoading } : {}
5663
5691
  };
5664
5692
  }
5693
+ function resolveAsyncToolOption({
5694
+ value,
5695
+ supportsAsyncToolCalling,
5696
+ toolName,
5697
+ toolWarnings
5698
+ }) {
5699
+ if (value !== true || supportsAsyncToolCalling) {
5700
+ return value;
5701
+ }
5702
+ toolWarnings.push({
5703
+ type: "unsupported",
5704
+ feature: `async tool calling for "${toolName}"`,
5705
+ details: "Async tool calling is only supported by GPT-6 and later models."
5706
+ });
5707
+ return void 0;
5708
+ }
5665
5709
  function mapShellEnvironment(environment) {
5666
5710
  if (environment.type === "containerReference") {
5667
5711
  const env2 = environment;
@@ -5829,7 +5873,8 @@ var OpenAIResponsesLanguageModel = class {
5829
5873
  toolChoice,
5830
5874
  allowedTools: (_b = openaiOptions == null ? void 0 : openaiOptions.allowedTools) != null ? _b : void 0,
5831
5875
  toolNameMapping,
5832
- customProviderToolNames
5876
+ customProviderToolNames,
5877
+ supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
5833
5878
  });
5834
5879
  const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
5835
5880
  prompt,
@@ -6339,6 +6384,7 @@ var OpenAIResponsesLanguageModel = class {
6339
6384
  providerMetadata: {
6340
6385
  [providerOptionsName]: {
6341
6386
  itemId: part.id,
6387
+ ...part.async != null && { async: part.async },
6342
6388
  ...part.namespace != null && { namespace: part.namespace }
6343
6389
  }
6344
6390
  }
@@ -6355,7 +6401,8 @@ var OpenAIResponsesLanguageModel = class {
6355
6401
  input: JSON.stringify(part.input),
6356
6402
  providerMetadata: {
6357
6403
  [providerOptionsName]: {
6358
- itemId: part.id
6404
+ itemId: part.id,
6405
+ ...part.async != null && { async: part.async }
6359
6406
  }
6360
6407
  }
6361
6408
  });
@@ -6643,7 +6690,8 @@ var OpenAIResponsesLanguageModel = class {
6643
6690
  toolName: value.item.name,
6644
6691
  toolCallId: value.item.call_id,
6645
6692
  suppressInputStreaming,
6646
- bufferedInputDeltas: suppressInputStreaming ? [] : void 0
6693
+ bufferedInputDeltas: suppressInputStreaming ? [] : void 0,
6694
+ async: value.item.async
6647
6695
  };
6648
6696
  if (!suppressInputStreaming) {
6649
6697
  controller.enqueue({
@@ -6658,7 +6706,8 @@ var OpenAIResponsesLanguageModel = class {
6658
6706
  );
6659
6707
  ongoingToolCalls[value.output_index] = {
6660
6708
  toolName,
6661
- toolCallId: value.item.call_id
6709
+ toolCallId: value.item.call_id,
6710
+ async: value.item.async
6662
6711
  };
6663
6712
  controller.enqueue({
6664
6713
  type: "tool-input-start",
@@ -6902,6 +6951,7 @@ var OpenAIResponsesLanguageModel = class {
6902
6951
  providerMetadata: {
6903
6952
  [providerOptionsName]: {
6904
6953
  itemId: item.id,
6954
+ ...item.async != null ? { async: item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {},
6905
6955
  ...item.namespace != null && {
6906
6956
  namespace: item.namespace
6907
6957
  }
@@ -6946,6 +6996,7 @@ var OpenAIResponsesLanguageModel = class {
6946
6996
  }
6947
6997
  });
6948
6998
  } else if (value.item.type === "custom_tool_call") {
6999
+ const ongoingToolCall = ongoingToolCalls[value.output_index];
6949
7000
  ongoingToolCalls[value.output_index] = void 0;
6950
7001
  hasFunctionCall = true;
6951
7002
  const toolName = toolNameMapping.toCustomToolName(
@@ -6962,7 +7013,8 @@ var OpenAIResponsesLanguageModel = class {
6962
7013
  input: JSON.stringify(value.item.input),
6963
7014
  providerMetadata: {
6964
7015
  [providerOptionsName]: {
6965
- itemId: value.item.id
7016
+ itemId: value.item.id,
7017
+ ...value.item.async != null ? { async: value.item.async } : (ongoingToolCall == null ? void 0 : ongoingToolCall.async) != null ? { async: ongoingToolCall.async } : {}
6966
7018
  }
6967
7019
  }
6968
7020
  });
@@ -8040,7 +8092,7 @@ var OpenAITranscriptionModel = class {
8040
8092
  };
8041
8093
 
8042
8094
  // src/version.ts
8043
- var VERSION = true ? "3.0.109" : "0.0.0-test";
8095
+ var VERSION = true ? "3.0.110" : "0.0.0-test";
8044
8096
 
8045
8097
  // src/openai-provider.ts
8046
8098
  function createOpenAI(options = {}) {