@ai-sdk/openai 2.1.0-beta.8 → 3.0.0-beta.17

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.
@@ -1,4 +1,4 @@
1
- import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3CallOptions, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
4
  import { z } from 'zod/v4';
@@ -129,7 +129,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3<string> {
129
129
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3<string>['doEmbed']>>>;
130
130
  }
131
131
 
132
- type OpenAIImageModelId = 'gpt-image-1' | 'dall-e-3' | 'dall-e-2' | (string & {});
132
+ type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | (string & {});
133
133
  declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
134
134
  declare const hasDefaultResponseFormat: Set<string>;
135
135
 
@@ -161,7 +161,7 @@ declare const openAITranscriptionProviderOptions: z.ZodObject<{
161
161
  }, z.core.$strip>;
162
162
  type OpenAITranscriptionProviderOptions = z.infer<typeof openAITranscriptionProviderOptions>;
163
163
 
164
- type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV2CallOptions, 'providerOptions'> & {
164
+ type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV3CallOptions, 'providerOptions'> & {
165
165
  providerOptions?: {
166
166
  openai?: OpenAITranscriptionProviderOptions;
167
167
  };
@@ -171,14 +171,14 @@ interface OpenAITranscriptionModelConfig extends OpenAIConfig {
171
171
  currentDate?: () => Date;
172
172
  };
173
173
  }
174
- declare class OpenAITranscriptionModel implements TranscriptionModelV2 {
174
+ declare class OpenAITranscriptionModel implements TranscriptionModelV3 {
175
175
  readonly modelId: OpenAITranscriptionModelId;
176
176
  private readonly config;
177
- readonly specificationVersion = "v2";
177
+ readonly specificationVersion = "v3";
178
178
  get provider(): string;
179
179
  constructor(modelId: OpenAITranscriptionModelId, config: OpenAITranscriptionModelConfig);
180
180
  private getArgs;
181
- doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV2['doGenerate']>>>;
181
+ doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>>;
182
182
  }
183
183
 
184
184
  type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
@@ -193,17 +193,17 @@ interface OpenAISpeechModelConfig extends OpenAIConfig {
193
193
  currentDate?: () => Date;
194
194
  };
195
195
  }
196
- declare class OpenAISpeechModel implements SpeechModelV2 {
196
+ declare class OpenAISpeechModel implements SpeechModelV3 {
197
197
  readonly modelId: OpenAISpeechModelId;
198
198
  private readonly config;
199
- readonly specificationVersion = "v2";
199
+ readonly specificationVersion = "v3";
200
200
  get provider(): string;
201
201
  constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
202
202
  private getArgs;
203
- doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
203
+ doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
204
204
  }
205
205
 
206
- type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
206
+ type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
207
207
 
208
208
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
209
209
  readonly specificationVersion = "v3";
@@ -458,4 +458,108 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithO
458
458
  filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
459
459
  }>;
460
460
 
461
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
461
+ declare const imageGenerationArgsSchema: z.ZodObject<{
462
+ background: z.ZodOptional<z.ZodEnum<{
463
+ auto: "auto";
464
+ opaque: "opaque";
465
+ transparent: "transparent";
466
+ }>>;
467
+ inputFidelity: z.ZodOptional<z.ZodEnum<{
468
+ low: "low";
469
+ high: "high";
470
+ }>>;
471
+ inputImageMask: z.ZodOptional<z.ZodObject<{
472
+ fileId: z.ZodOptional<z.ZodString>;
473
+ imageUrl: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strip>>;
475
+ model: z.ZodOptional<z.ZodString>;
476
+ moderation: z.ZodOptional<z.ZodEnum<{
477
+ auto: "auto";
478
+ }>>;
479
+ outputCompression: z.ZodOptional<z.ZodNumber>;
480
+ outputFormat: z.ZodOptional<z.ZodEnum<{
481
+ png: "png";
482
+ jpeg: "jpeg";
483
+ webp: "webp";
484
+ }>>;
485
+ partialImages: z.ZodOptional<z.ZodNumber>;
486
+ quality: z.ZodOptional<z.ZodEnum<{
487
+ low: "low";
488
+ medium: "medium";
489
+ high: "high";
490
+ auto: "auto";
491
+ }>>;
492
+ size: z.ZodOptional<z.ZodEnum<{
493
+ auto: "auto";
494
+ "1024x1024": "1024x1024";
495
+ "1024x1536": "1024x1536";
496
+ "1536x1024": "1536x1024";
497
+ }>>;
498
+ }, z.core.$strict>;
499
+ declare const imageGenerationOutputSchema: z.ZodObject<{
500
+ result: z.ZodString;
501
+ }, z.core.$strip>;
502
+ type ImageGenerationArgs = {
503
+ /**
504
+ * Background type for the generated image. Default is 'auto'.
505
+ */
506
+ background?: 'auto' | 'opaque' | 'transparent';
507
+ /**
508
+ * Input fidelity for the generated image. Default is 'low'.
509
+ */
510
+ inputFidelity?: 'low' | 'high';
511
+ /**
512
+ * Optional mask for inpainting.
513
+ * Contains image_url (string, optional) and file_id (string, optional).
514
+ */
515
+ inputImageMask?: {
516
+ /**
517
+ * File ID for the mask image.
518
+ */
519
+ fileId?: string;
520
+ /**
521
+ * Base64-encoded mask image.
522
+ */
523
+ imageUrl?: string;
524
+ };
525
+ /**
526
+ * The image generation model to use. Default: gpt-image-1.
527
+ */
528
+ model?: string;
529
+ /**
530
+ * Moderation level for the generated image. Default: auto.
531
+ */
532
+ moderation?: 'auto';
533
+ /**
534
+ * Compression level for the output image. Default: 100.
535
+ */
536
+ outputCompression?: number;
537
+ /**
538
+ * The output format of the generated image. One of png, webp, or jpeg.
539
+ * Default: png
540
+ */
541
+ outputFormat?: 'png' | 'jpeg' | 'webp';
542
+ /**
543
+ * Number of partial images to generate in streaming mode, from 0 (default value) to 3.
544
+ */
545
+ partialImages?: number;
546
+ /**
547
+ * The quality of the generated image.
548
+ * One of low, medium, high, or auto. Default: auto.
549
+ */
550
+ quality?: 'auto' | 'low' | 'medium' | 'high';
551
+ /**
552
+ * The size of the generated image.
553
+ * One of 1024x1024, 1024x1536, 1536x1024, or auto.
554
+ * Default: auto.
555
+ */
556
+ size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
557
+ };
558
+ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.Tool<{}, {
559
+ /**
560
+ * The generated image encoded in base64.
561
+ */
562
+ result: string;
563
+ }>;
564
+
565
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
@@ -1,4 +1,4 @@
1
- import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
1
+ import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3CallOptions, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
4
  import { z } from 'zod/v4';
@@ -129,7 +129,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3<string> {
129
129
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3<string>['doEmbed']>>>;
130
130
  }
131
131
 
132
- type OpenAIImageModelId = 'gpt-image-1' | 'dall-e-3' | 'dall-e-2' | (string & {});
132
+ type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | (string & {});
133
133
  declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
134
134
  declare const hasDefaultResponseFormat: Set<string>;
135
135
 
@@ -161,7 +161,7 @@ declare const openAITranscriptionProviderOptions: z.ZodObject<{
161
161
  }, z.core.$strip>;
162
162
  type OpenAITranscriptionProviderOptions = z.infer<typeof openAITranscriptionProviderOptions>;
163
163
 
164
- type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV2CallOptions, 'providerOptions'> & {
164
+ type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV3CallOptions, 'providerOptions'> & {
165
165
  providerOptions?: {
166
166
  openai?: OpenAITranscriptionProviderOptions;
167
167
  };
@@ -171,14 +171,14 @@ interface OpenAITranscriptionModelConfig extends OpenAIConfig {
171
171
  currentDate?: () => Date;
172
172
  };
173
173
  }
174
- declare class OpenAITranscriptionModel implements TranscriptionModelV2 {
174
+ declare class OpenAITranscriptionModel implements TranscriptionModelV3 {
175
175
  readonly modelId: OpenAITranscriptionModelId;
176
176
  private readonly config;
177
- readonly specificationVersion = "v2";
177
+ readonly specificationVersion = "v3";
178
178
  get provider(): string;
179
179
  constructor(modelId: OpenAITranscriptionModelId, config: OpenAITranscriptionModelConfig);
180
180
  private getArgs;
181
- doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV2['doGenerate']>>>;
181
+ doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>>;
182
182
  }
183
183
 
184
184
  type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
@@ -193,17 +193,17 @@ interface OpenAISpeechModelConfig extends OpenAIConfig {
193
193
  currentDate?: () => Date;
194
194
  };
195
195
  }
196
- declare class OpenAISpeechModel implements SpeechModelV2 {
196
+ declare class OpenAISpeechModel implements SpeechModelV3 {
197
197
  readonly modelId: OpenAISpeechModelId;
198
198
  private readonly config;
199
- readonly specificationVersion = "v2";
199
+ readonly specificationVersion = "v3";
200
200
  get provider(): string;
201
201
  constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
202
202
  private getArgs;
203
- doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
203
+ doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
204
204
  }
205
205
 
206
- type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
206
+ type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
207
207
 
208
208
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
209
209
  readonly specificationVersion = "v3";
@@ -458,4 +458,108 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithO
458
458
  filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
459
459
  }>;
460
460
 
461
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
461
+ declare const imageGenerationArgsSchema: z.ZodObject<{
462
+ background: z.ZodOptional<z.ZodEnum<{
463
+ auto: "auto";
464
+ opaque: "opaque";
465
+ transparent: "transparent";
466
+ }>>;
467
+ inputFidelity: z.ZodOptional<z.ZodEnum<{
468
+ low: "low";
469
+ high: "high";
470
+ }>>;
471
+ inputImageMask: z.ZodOptional<z.ZodObject<{
472
+ fileId: z.ZodOptional<z.ZodString>;
473
+ imageUrl: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strip>>;
475
+ model: z.ZodOptional<z.ZodString>;
476
+ moderation: z.ZodOptional<z.ZodEnum<{
477
+ auto: "auto";
478
+ }>>;
479
+ outputCompression: z.ZodOptional<z.ZodNumber>;
480
+ outputFormat: z.ZodOptional<z.ZodEnum<{
481
+ png: "png";
482
+ jpeg: "jpeg";
483
+ webp: "webp";
484
+ }>>;
485
+ partialImages: z.ZodOptional<z.ZodNumber>;
486
+ quality: z.ZodOptional<z.ZodEnum<{
487
+ low: "low";
488
+ medium: "medium";
489
+ high: "high";
490
+ auto: "auto";
491
+ }>>;
492
+ size: z.ZodOptional<z.ZodEnum<{
493
+ auto: "auto";
494
+ "1024x1024": "1024x1024";
495
+ "1024x1536": "1024x1536";
496
+ "1536x1024": "1536x1024";
497
+ }>>;
498
+ }, z.core.$strict>;
499
+ declare const imageGenerationOutputSchema: z.ZodObject<{
500
+ result: z.ZodString;
501
+ }, z.core.$strip>;
502
+ type ImageGenerationArgs = {
503
+ /**
504
+ * Background type for the generated image. Default is 'auto'.
505
+ */
506
+ background?: 'auto' | 'opaque' | 'transparent';
507
+ /**
508
+ * Input fidelity for the generated image. Default is 'low'.
509
+ */
510
+ inputFidelity?: 'low' | 'high';
511
+ /**
512
+ * Optional mask for inpainting.
513
+ * Contains image_url (string, optional) and file_id (string, optional).
514
+ */
515
+ inputImageMask?: {
516
+ /**
517
+ * File ID for the mask image.
518
+ */
519
+ fileId?: string;
520
+ /**
521
+ * Base64-encoded mask image.
522
+ */
523
+ imageUrl?: string;
524
+ };
525
+ /**
526
+ * The image generation model to use. Default: gpt-image-1.
527
+ */
528
+ model?: string;
529
+ /**
530
+ * Moderation level for the generated image. Default: auto.
531
+ */
532
+ moderation?: 'auto';
533
+ /**
534
+ * Compression level for the output image. Default: 100.
535
+ */
536
+ outputCompression?: number;
537
+ /**
538
+ * The output format of the generated image. One of png, webp, or jpeg.
539
+ * Default: png
540
+ */
541
+ outputFormat?: 'png' | 'jpeg' | 'webp';
542
+ /**
543
+ * Number of partial images to generate in streaming mode, from 0 (default value) to 3.
544
+ */
545
+ partialImages?: number;
546
+ /**
547
+ * The quality of the generated image.
548
+ * One of low, medium, high, or auto. Default: auto.
549
+ */
550
+ quality?: 'auto' | 'low' | 'medium' | 'high';
551
+ /**
552
+ * The size of the generated image.
553
+ * One of 1024x1024, 1024x1536, 1536x1024, or auto.
554
+ * Default: auto.
555
+ */
556
+ size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
557
+ };
558
+ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.Tool<{}, {
559
+ /**
560
+ * The generated image encoded in base64.
561
+ */
562
+ result: string;
563
+ }>;
564
+
565
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions };
@@ -36,6 +36,9 @@ __export(internal_exports, {
36
36
  fileSearchArgsSchema: () => fileSearchArgsSchema,
37
37
  fileSearchOutputSchema: () => fileSearchOutputSchema,
38
38
  hasDefaultResponseFormat: () => hasDefaultResponseFormat,
39
+ imageGeneration: () => imageGeneration,
40
+ imageGenerationArgsSchema: () => imageGenerationArgsSchema,
41
+ imageGenerationOutputSchema: () => imageGenerationOutputSchema,
39
42
  modelMaxImagesPerCall: () => modelMaxImagesPerCall,
40
43
  openAITranscriptionProviderOptions: () => openAITranscriptionProviderOptions,
41
44
  openaiChatLanguageModelOptions: () => openaiChatLanguageModelOptions,
@@ -75,6 +78,7 @@ function convertToOpenAIChatMessages({
75
78
  prompt,
76
79
  systemMessageMode = "system"
77
80
  }) {
81
+ var _a;
78
82
  const messages = [];
79
83
  const warnings = [];
80
84
  for (const { role, content } of prompt) {
@@ -113,7 +117,7 @@ function convertToOpenAIChatMessages({
113
117
  messages.push({
114
118
  role: "user",
115
119
  content: content.map((part, index) => {
116
- var _a, _b, _c;
120
+ var _a2, _b, _c;
117
121
  switch (part.type) {
118
122
  case "text": {
119
123
  return { type: "text", text: part.text };
@@ -126,7 +130,7 @@ function convertToOpenAIChatMessages({
126
130
  image_url: {
127
131
  url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
128
132
  // OpenAI specific extension: image detail
129
- detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
133
+ detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
130
134
  }
131
135
  };
132
136
  } else if (part.mediaType.startsWith("audio/")) {
@@ -223,6 +227,9 @@ function convertToOpenAIChatMessages({
223
227
  case "error-text":
224
228
  contentValue = output.value;
225
229
  break;
230
+ case "execution-denied":
231
+ contentValue = (_a = output.reason) != null ? _a : "Tool execution denied.";
232
+ break;
226
233
  case "content":
227
234
  case "json":
228
235
  case "error-json":
@@ -1605,9 +1612,13 @@ var import_v48 = require("zod/v4");
1605
1612
  var modelMaxImagesPerCall = {
1606
1613
  "dall-e-3": 1,
1607
1614
  "dall-e-2": 10,
1608
- "gpt-image-1": 10
1615
+ "gpt-image-1": 10,
1616
+ "gpt-image-1-mini": 10
1609
1617
  };
1610
- var hasDefaultResponseFormat = /* @__PURE__ */ new Set(["gpt-image-1"]);
1618
+ var hasDefaultResponseFormat = /* @__PURE__ */ new Set([
1619
+ "gpt-image-1",
1620
+ "gpt-image-1-mini"
1621
+ ]);
1611
1622
 
1612
1623
  // src/image/openai-image-model.ts
1613
1624
  var OpenAIImageModel = class {
@@ -1788,7 +1799,7 @@ var OpenAITranscriptionModel = class {
1788
1799
  constructor(modelId, config) {
1789
1800
  this.modelId = modelId;
1790
1801
  this.config = config;
1791
- this.specificationVersion = "v2";
1802
+ this.specificationVersion = "v3";
1792
1803
  }
1793
1804
  get provider() {
1794
1805
  return this.config.provider;
@@ -1928,7 +1939,7 @@ var OpenAISpeechModel = class {
1928
1939
  constructor(modelId, config) {
1929
1940
  this.modelId = modelId;
1930
1941
  this.config = config;
1931
- this.specificationVersion = "v2";
1942
+ this.specificationVersion = "v3";
1932
1943
  }
1933
1944
  get provider() {
1934
1945
  return this.config.provider;
@@ -2069,7 +2080,7 @@ async function convertToOpenAIResponsesInput({
2069
2080
  store,
2070
2081
  hasLocalShellTool = false
2071
2082
  }) {
2072
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2083
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2073
2084
  const input = [];
2074
2085
  const warnings = [];
2075
2086
  for (const { role, content } of prompt) {
@@ -2272,6 +2283,9 @@ async function convertToOpenAIResponsesInput({
2272
2283
  case "error-text":
2273
2284
  contentValue = output.value;
2274
2285
  break;
2286
+ case "execution-denied":
2287
+ contentValue = (_j = output.reason) != null ? _j : "Tool execution denied.";
2288
+ break;
2275
2289
  case "content":
2276
2290
  case "json":
2277
2291
  case "error-json":
@@ -2506,6 +2520,7 @@ var imageGenerationArgsSchema = import_v418.z.object({
2506
2520
  moderation: import_v418.z.enum(["auto"]).optional(),
2507
2521
  outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
2508
2522
  outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
2523
+ partialImages: import_v418.z.number().int().min(0).max(3).optional(),
2509
2524
  quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
2510
2525
  size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
2511
2526
  }).strict();
@@ -2518,6 +2533,9 @@ var imageGenerationToolFactory = (0, import_provider_utils15.createProviderDefin
2518
2533
  inputSchema: import_v418.z.object({}),
2519
2534
  outputSchema: imageGenerationOutputSchema
2520
2535
  });
2536
+ var imageGeneration = (args = {}) => {
2537
+ return imageGenerationToolFactory(args);
2538
+ };
2521
2539
 
2522
2540
  // src/responses/openai-responses-prepare-tools.ts
2523
2541
  function prepareResponsesTools({
@@ -2602,11 +2620,12 @@ function prepareResponsesTools({
2602
2620
  image_url: args.inputImageMask.imageUrl
2603
2621
  } : void 0,
2604
2622
  model: args.model,
2605
- size: args.size,
2606
- quality: args.quality,
2607
2623
  moderation: args.moderation,
2624
+ partial_images: args.partialImages,
2625
+ quality: args.quality,
2626
+ output_compression: args.outputCompression,
2608
2627
  output_format: args.outputFormat,
2609
- output_compression: args.outputCompression
2628
+ size: args.size
2610
2629
  });
2611
2630
  break;
2612
2631
  }
@@ -3342,7 +3361,8 @@ var OpenAIResponsesLanguageModel = class {
3342
3361
  controller.enqueue({
3343
3362
  type: "tool-input-start",
3344
3363
  id: value.item.id,
3345
- toolName: webSearchToolName != null ? webSearchToolName : "web_search"
3364
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3365
+ providerExecuted: true
3346
3366
  });
3347
3367
  } else if (value.item.type === "computer_call") {
3348
3368
  ongoingToolCalls[value.output_index] = {
@@ -3352,7 +3372,8 @@ var OpenAIResponsesLanguageModel = class {
3352
3372
  controller.enqueue({
3353
3373
  type: "tool-input-start",
3354
3374
  id: value.item.id,
3355
- toolName: "computer_use"
3375
+ toolName: "computer_use",
3376
+ providerExecuted: true
3356
3377
  });
3357
3378
  } else if (value.item.type === "code_interpreter_call") {
3358
3379
  ongoingToolCalls[value.output_index] = {
@@ -3365,7 +3386,8 @@ var OpenAIResponsesLanguageModel = class {
3365
3386
  controller.enqueue({
3366
3387
  type: "tool-input-start",
3367
3388
  id: value.item.id,
3368
- toolName: "code_interpreter"
3389
+ toolName: "code_interpreter",
3390
+ providerExecuted: true
3369
3391
  });
3370
3392
  controller.enqueue({
3371
3393
  type: "tool-input-delta",
@@ -3565,6 +3587,17 @@ var OpenAIResponsesLanguageModel = class {
3565
3587
  delta: value.delta
3566
3588
  });
3567
3589
  }
3590
+ } else if (isResponseImageGenerationCallPartialImageChunk(value)) {
3591
+ controller.enqueue({
3592
+ type: "tool-result",
3593
+ toolCallId: value.item_id,
3594
+ toolName: "image_generation",
3595
+ result: {
3596
+ result: value.partial_image_b64
3597
+ },
3598
+ providerExecuted: true,
3599
+ preliminary: true
3600
+ });
3568
3601
  } else if (isResponseCodeInterpreterCallCodeDeltaChunk(value)) {
3569
3602
  const toolCall = ongoingToolCalls[value.output_index];
3570
3603
  if (toolCall != null) {
@@ -3837,6 +3870,12 @@ var responseFunctionCallArgumentsDeltaSchema = import_v419.z.object({
3837
3870
  output_index: import_v419.z.number(),
3838
3871
  delta: import_v419.z.string()
3839
3872
  });
3873
+ var responseImageGenerationCallPartialImageSchema = import_v419.z.object({
3874
+ type: import_v419.z.literal("response.image_generation_call.partial_image"),
3875
+ item_id: import_v419.z.string(),
3876
+ output_index: import_v419.z.number(),
3877
+ partial_image_b64: import_v419.z.string()
3878
+ });
3840
3879
  var responseCodeInterpreterCallCodeDeltaSchema = import_v419.z.object({
3841
3880
  type: import_v419.z.literal("response.code_interpreter_call_code.delta"),
3842
3881
  item_id: import_v419.z.string(),
@@ -3886,6 +3925,7 @@ var openaiResponsesChunkSchema = import_v419.z.union([
3886
3925
  responseOutputItemAddedSchema,
3887
3926
  responseOutputItemDoneSchema,
3888
3927
  responseFunctionCallArgumentsDeltaSchema,
3928
+ responseImageGenerationCallPartialImageSchema,
3889
3929
  responseCodeInterpreterCallCodeDeltaSchema,
3890
3930
  responseCodeInterpreterCallCodeDoneSchema,
3891
3931
  responseAnnotationAddedSchema,
@@ -3913,6 +3953,9 @@ function isResponseCreatedChunk(chunk) {
3913
3953
  function isResponseFunctionCallArgumentsDeltaChunk(chunk) {
3914
3954
  return chunk.type === "response.function_call_arguments.delta";
3915
3955
  }
3956
+ function isResponseImageGenerationCallPartialImageChunk(chunk) {
3957
+ return chunk.type === "response.image_generation_call.partial_image";
3958
+ }
3916
3959
  function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
3917
3960
  return chunk.type === "response.code_interpreter_call_code.delta";
3918
3961
  }
@@ -4030,6 +4073,9 @@ var openaiResponsesProviderOptionsSchema = import_v419.z.object({
4030
4073
  fileSearchArgsSchema,
4031
4074
  fileSearchOutputSchema,
4032
4075
  hasDefaultResponseFormat,
4076
+ imageGeneration,
4077
+ imageGenerationArgsSchema,
4078
+ imageGenerationOutputSchema,
4033
4079
  modelMaxImagesPerCall,
4034
4080
  openAITranscriptionProviderOptions,
4035
4081
  openaiChatLanguageModelOptions,