@ai-sdk/openai 3.0.32 → 3.0.34

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.
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | '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-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | '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.1' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | '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-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | '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' | 'gpt-3.5-turbo-16k' | 'chatgpt-4o-latest' | '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.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | (string & {});
6
6
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
@@ -47,7 +47,7 @@ declare class OpenAIChatLanguageModel implements LanguageModelV3 {
47
47
  doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
48
48
  }
49
49
 
50
- type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
50
+ type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | 'gpt-3.5-turbo-instruct-0914' | (string & {});
51
51
  declare const openaiLanguageModelCompletionOptions: _ai_sdk_provider_utils.LazySchema<{
52
52
  echo?: boolean | undefined;
53
53
  logitBias?: Record<string, number> | undefined;
@@ -117,7 +117,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3 {
117
117
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
118
118
  }
119
119
 
120
- type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | (string & {});
120
+ type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'chatgpt-image-latest' | (string & {});
121
121
  declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
122
122
  declare function hasDefaultResponseFormat(modelId: string): boolean;
123
123
 
@@ -136,7 +136,7 @@ declare class OpenAIImageModel implements ImageModelV3 {
136
136
  doGenerate({ prompt, files, mask, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV3['doGenerate']>>>;
137
137
  }
138
138
 
139
- type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {});
139
+ type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-mini-transcribe-2025-03-20' | 'gpt-4o-mini-transcribe-2025-12-15' | 'gpt-4o-transcribe' | 'gpt-4o-transcribe-diarize' | (string & {});
140
140
  declare const openAITranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema<{
141
141
  include?: string[] | undefined;
142
142
  language?: string | undefined;
@@ -166,7 +166,7 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV3 {
166
166
  doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>>;
167
167
  }
168
168
 
169
- type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
169
+ type OpenAISpeechModelId = 'tts-1' | 'tts-1-1106' | 'tts-1-hd' | 'tts-1-hd-1106' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-03-20' | 'gpt-4o-mini-tts-2025-12-15' | (string & {});
170
170
  declare const openaiSpeechModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
171
171
  instructions?: string | null | undefined;
172
172
  speed?: number | null | undefined;
@@ -188,7 +188,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
188
188
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
189
189
  }
190
190
 
191
- 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.1' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-codex' | 'gpt-5.3-codex' | '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 & {});
191
+ 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.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-codex' | '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' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
192
192
 
193
193
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
194
194
  readonly specificationVersion = "v3";
@@ -279,6 +279,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
279
279
  item: {
280
280
  type: "message";
281
281
  id: string;
282
+ phase?: "commentary" | "final_answer" | null | undefined;
282
283
  } | {
283
284
  type: "reasoning";
284
285
  id: string;
@@ -374,6 +375,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
374
375
  item: {
375
376
  type: "message";
376
377
  id: string;
378
+ phase?: "commentary" | "final_answer" | null | undefined;
377
379
  } | {
378
380
  type: "reasoning";
379
381
  id: string;
@@ -634,6 +636,7 @@ type OpenaiResponsesProviderMetadata = {
634
636
  };
635
637
  type ResponsesTextProviderMetadata = {
636
638
  itemId: string;
639
+ phase?: 'commentary' | 'final_answer' | null;
637
640
  annotations?: Array<ResponsesOutputTextAnnotationProviderMetadata>;
638
641
  };
639
642
  type OpenaiResponsesTextProviderMetadata = {
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | '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-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | '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.1' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | '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-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | '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' | 'gpt-3.5-turbo-16k' | 'chatgpt-4o-latest' | '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.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | (string & {});
6
6
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
@@ -47,7 +47,7 @@ declare class OpenAIChatLanguageModel implements LanguageModelV3 {
47
47
  doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
48
48
  }
49
49
 
50
- type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
50
+ type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | 'gpt-3.5-turbo-instruct-0914' | (string & {});
51
51
  declare const openaiLanguageModelCompletionOptions: _ai_sdk_provider_utils.LazySchema<{
52
52
  echo?: boolean | undefined;
53
53
  logitBias?: Record<string, number> | undefined;
@@ -117,7 +117,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV3 {
117
117
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
118
118
  }
119
119
 
120
- type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | (string & {});
120
+ type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'chatgpt-image-latest' | (string & {});
121
121
  declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
122
122
  declare function hasDefaultResponseFormat(modelId: string): boolean;
123
123
 
@@ -136,7 +136,7 @@ declare class OpenAIImageModel implements ImageModelV3 {
136
136
  doGenerate({ prompt, files, mask, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV3['doGenerate']>>>;
137
137
  }
138
138
 
139
- type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {});
139
+ type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-mini-transcribe-2025-03-20' | 'gpt-4o-mini-transcribe-2025-12-15' | 'gpt-4o-transcribe' | 'gpt-4o-transcribe-diarize' | (string & {});
140
140
  declare const openAITranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema<{
141
141
  include?: string[] | undefined;
142
142
  language?: string | undefined;
@@ -166,7 +166,7 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV3 {
166
166
  doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV3['doGenerate']>>>;
167
167
  }
168
168
 
169
- type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
169
+ type OpenAISpeechModelId = 'tts-1' | 'tts-1-1106' | 'tts-1-hd' | 'tts-1-hd-1106' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-03-20' | 'gpt-4o-mini-tts-2025-12-15' | (string & {});
170
170
  declare const openaiSpeechModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
171
171
  instructions?: string | null | undefined;
172
172
  speed?: number | null | undefined;
@@ -188,7 +188,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
188
188
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
189
189
  }
190
190
 
191
- 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.1' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-codex' | 'gpt-5.3-codex' | '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 & {});
191
+ 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.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-codex' | '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' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
192
192
 
193
193
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
194
194
  readonly specificationVersion = "v3";
@@ -279,6 +279,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
279
279
  item: {
280
280
  type: "message";
281
281
  id: string;
282
+ phase?: "commentary" | "final_answer" | null | undefined;
282
283
  } | {
283
284
  type: "reasoning";
284
285
  id: string;
@@ -374,6 +375,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
374
375
  item: {
375
376
  type: "message";
376
377
  id: string;
378
+ phase?: "commentary" | "final_answer" | null | undefined;
377
379
  } | {
378
380
  type: "reasoning";
379
381
  id: string;
@@ -634,6 +636,7 @@ type OpenaiResponsesProviderMetadata = {
634
636
  };
635
637
  type ResponsesTextProviderMetadata = {
636
638
  itemId: string;
639
+ phase?: 'commentary' | 'final_answer' | null;
637
640
  annotations?: Array<ResponsesOutputTextAnnotationProviderMetadata>;
638
641
  };
639
642
  type OpenaiResponsesTextProviderMetadata = {
@@ -1776,9 +1776,11 @@ var modelMaxImagesPerCall = {
1776
1776
  "dall-e-2": 10,
1777
1777
  "gpt-image-1": 10,
1778
1778
  "gpt-image-1-mini": 10,
1779
- "gpt-image-1.5": 10
1779
+ "gpt-image-1.5": 10,
1780
+ "chatgpt-image-latest": 10
1780
1781
  };
1781
1782
  var defaultResponseFormatPrefixes = [
1783
+ "chatgpt-image-",
1782
1784
  "gpt-image-1-mini",
1783
1785
  "gpt-image-1.5",
1784
1786
  "gpt-image-1"
@@ -2564,7 +2566,7 @@ async function convertToOpenAIResponsesInput({
2564
2566
  hasShellTool = false,
2565
2567
  hasApplyPatchTool = false
2566
2568
  }) {
2567
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2569
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2568
2570
  const input = [];
2569
2571
  const warnings = [];
2570
2572
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -2645,7 +2647,9 @@ async function convertToOpenAIResponsesInput({
2645
2647
  for (const part of content) {
2646
2648
  switch (part.type) {
2647
2649
  case "text": {
2648
- const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
2650
+ const providerOpts = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName];
2651
+ const id = providerOpts == null ? void 0 : providerOpts.itemId;
2652
+ const phase = providerOpts == null ? void 0 : providerOpts.phase;
2649
2653
  if (hasConversation && id != null) {
2650
2654
  break;
2651
2655
  }
@@ -2656,12 +2660,13 @@ async function convertToOpenAIResponsesInput({
2656
2660
  input.push({
2657
2661
  role: "assistant",
2658
2662
  content: [{ type: "output_text", text: part.text }],
2659
- id
2663
+ id,
2664
+ ...phase != null && { phase }
2660
2665
  });
2661
2666
  break;
2662
2667
  }
2663
2668
  case "tool-call": {
2664
- const id = (_g = (_d = (_c = part.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.itemId;
2669
+ 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;
2665
2670
  if (hasConversation && id != null) {
2666
2671
  break;
2667
2672
  }
@@ -2772,7 +2777,7 @@ async function convertToOpenAIResponsesInput({
2772
2777
  break;
2773
2778
  }
2774
2779
  if (store) {
2775
- const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2780
+ const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
2776
2781
  input.push({ type: "item_reference", id: itemId });
2777
2782
  } else {
2778
2783
  warnings.push({
@@ -2866,7 +2871,7 @@ async function convertToOpenAIResponsesInput({
2866
2871
  }
2867
2872
  const output = part.output;
2868
2873
  if (output.type === "execution-denied") {
2869
- const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
2874
+ const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
2870
2875
  if (approvalId) {
2871
2876
  continue;
2872
2877
  }
@@ -2925,7 +2930,7 @@ async function convertToOpenAIResponsesInput({
2925
2930
  contentValue = output.value;
2926
2931
  break;
2927
2932
  case "execution-denied":
2928
- contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
2933
+ contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
2929
2934
  break;
2930
2935
  case "json":
2931
2936
  case "error-json":
@@ -3058,7 +3063,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
3058
3063
  item: import_v416.z.discriminatedUnion("type", [
3059
3064
  import_v416.z.object({
3060
3065
  type: import_v416.z.literal("message"),
3061
- id: import_v416.z.string()
3066
+ id: import_v416.z.string(),
3067
+ phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
3062
3068
  }),
3063
3069
  import_v416.z.object({
3064
3070
  type: import_v416.z.literal("reasoning"),
@@ -3175,7 +3181,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
3175
3181
  item: import_v416.z.discriminatedUnion("type", [
3176
3182
  import_v416.z.object({
3177
3183
  type: import_v416.z.literal("message"),
3178
- id: import_v416.z.string()
3184
+ id: import_v416.z.string(),
3185
+ phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
3179
3186
  }),
3180
3187
  import_v416.z.object({
3181
3188
  type: import_v416.z.literal("reasoning"),
@@ -3487,6 +3494,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils23.lazySchema)(
3487
3494
  type: import_v416.z.literal("message"),
3488
3495
  role: import_v416.z.literal("assistant"),
3489
3496
  id: import_v416.z.string(),
3497
+ phase: import_v416.z.enum(["commentary", "final_answer"]).nullish(),
3490
3498
  content: import_v416.z.array(
3491
3499
  import_v416.z.object({
3492
3500
  type: import_v416.z.literal("output_text"),
@@ -4911,6 +4919,7 @@ var OpenAIResponsesLanguageModel = class {
4911
4919
  }
4912
4920
  const providerMetadata2 = {
4913
4921
  itemId: part.id,
4922
+ ...part.phase != null && { phase: part.phase },
4914
4923
  ...contentPart.annotations.length > 0 && {
4915
4924
  annotations: contentPart.annotations
4916
4925
  }
@@ -5225,6 +5234,7 @@ var OpenAIResponsesLanguageModel = class {
5225
5234
  let responseId = null;
5226
5235
  const ongoingToolCalls = {};
5227
5236
  const ongoingAnnotations = [];
5237
+ let activeMessagePhase;
5228
5238
  let hasFunctionCall = false;
5229
5239
  const activeReasoning = {};
5230
5240
  let serviceTier;
@@ -5235,7 +5245,7 @@ var OpenAIResponsesLanguageModel = class {
5235
5245
  controller.enqueue({ type: "stream-start", warnings });
5236
5246
  },
5237
5247
  transform(chunk, controller) {
5238
- var _a, _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;
5248
+ var _a, _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, _E, _F;
5239
5249
  if (options.includeRawChunks) {
5240
5250
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
5241
5251
  }
@@ -5376,12 +5386,16 @@ var OpenAIResponsesLanguageModel = class {
5376
5386
  } else if (value.item.type === "shell_call_output") {
5377
5387
  } else if (value.item.type === "message") {
5378
5388
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
5389
+ activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
5379
5390
  controller.enqueue({
5380
5391
  type: "text-start",
5381
5392
  id: value.item.id,
5382
5393
  providerMetadata: {
5383
5394
  [providerOptionsName]: {
5384
- itemId: value.item.id
5395
+ itemId: value.item.id,
5396
+ ...value.item.phase != null && {
5397
+ phase: value.item.phase
5398
+ }
5385
5399
  }
5386
5400
  }
5387
5401
  });
@@ -5396,19 +5410,22 @@ var OpenAIResponsesLanguageModel = class {
5396
5410
  providerMetadata: {
5397
5411
  [providerOptionsName]: {
5398
5412
  itemId: value.item.id,
5399
- reasoningEncryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
5413
+ reasoningEncryptedContent: (_b = value.item.encrypted_content) != null ? _b : null
5400
5414
  }
5401
5415
  }
5402
5416
  });
5403
5417
  }
5404
5418
  } else if (isResponseOutputItemDoneChunk(value)) {
5405
5419
  if (value.item.type === "message") {
5420
+ const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
5421
+ activeMessagePhase = void 0;
5406
5422
  controller.enqueue({
5407
5423
  type: "text-end",
5408
5424
  id: value.item.id,
5409
5425
  providerMetadata: {
5410
5426
  [providerOptionsName]: {
5411
5427
  itemId: value.item.id,
5428
+ ...phase != null && { phase },
5412
5429
  ...ongoingAnnotations.length > 0 && {
5413
5430
  annotations: ongoingAnnotations
5414
5431
  }
@@ -5473,13 +5490,13 @@ var OpenAIResponsesLanguageModel = class {
5473
5490
  toolName: toolNameMapping.toCustomToolName("file_search"),
5474
5491
  result: {
5475
5492
  queries: value.item.queries,
5476
- results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
5493
+ results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
5477
5494
  attributes: result.attributes,
5478
5495
  fileId: result.file_id,
5479
5496
  filename: result.filename,
5480
5497
  score: result.score,
5481
5498
  text: result.text
5482
- }))) != null ? _c : null
5499
+ }))) != null ? _e : null
5483
5500
  }
5484
5501
  });
5485
5502
  } else if (value.item.type === "code_interpreter_call") {
@@ -5503,10 +5520,10 @@ var OpenAIResponsesLanguageModel = class {
5503
5520
  });
5504
5521
  } else if (value.item.type === "mcp_call") {
5505
5522
  ongoingToolCalls[value.output_index] = void 0;
5506
- const approvalRequestId = (_d = value.item.approval_request_id) != null ? _d : void 0;
5507
- const aliasedToolCallId = approvalRequestId != null ? (_f = (_e = approvalRequestIdToDummyToolCallIdFromStream.get(
5523
+ const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
5524
+ const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
5508
5525
  approvalRequestId
5509
- )) != null ? _e : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _f : value.item.id : value.item.id;
5526
+ )) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
5510
5527
  const toolName = `mcp.${value.item.name}`;
5511
5528
  controller.enqueue({
5512
5529
  type: "tool-call",
@@ -5576,8 +5593,8 @@ var OpenAIResponsesLanguageModel = class {
5576
5593
  ongoingToolCalls[value.output_index] = void 0;
5577
5594
  } else if (value.item.type === "mcp_approval_request") {
5578
5595
  ongoingToolCalls[value.output_index] = void 0;
5579
- const dummyToolCallId = (_i = (_h = (_g = self.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils32.generateId)();
5580
- const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : value.item.id;
5596
+ const dummyToolCallId = (_k = (_j = (_i = self.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : (0, import_provider_utils32.generateId)();
5597
+ const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
5581
5598
  approvalRequestIdToDummyToolCallIdFromStream.set(
5582
5599
  approvalRequestId,
5583
5600
  dummyToolCallId
@@ -5666,7 +5683,7 @@ var OpenAIResponsesLanguageModel = class {
5666
5683
  providerMetadata: {
5667
5684
  [providerOptionsName]: {
5668
5685
  itemId: value.item.id,
5669
- reasoningEncryptedContent: (_k = value.item.encrypted_content) != null ? _k : null
5686
+ reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
5670
5687
  }
5671
5688
  }
5672
5689
  });
@@ -5770,7 +5787,7 @@ var OpenAIResponsesLanguageModel = class {
5770
5787
  id: value.item_id,
5771
5788
  delta: value.delta
5772
5789
  });
5773
- if (((_m = (_l = options.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.logprobs) && value.logprobs) {
5790
+ if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
5774
5791
  logprobs.push(value.logprobs);
5775
5792
  }
5776
5793
  } else if (value.type === "response.reasoning_summary_part.added") {
@@ -5799,7 +5816,7 @@ var OpenAIResponsesLanguageModel = class {
5799
5816
  providerMetadata: {
5800
5817
  [providerOptionsName]: {
5801
5818
  itemId: value.item_id,
5802
- reasoningEncryptedContent: (_o = (_n = activeReasoning[value.item_id]) == null ? void 0 : _n.encryptedContent) != null ? _o : null
5819
+ reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
5803
5820
  }
5804
5821
  }
5805
5822
  });
@@ -5833,10 +5850,10 @@ var OpenAIResponsesLanguageModel = class {
5833
5850
  } else if (isResponseFinishedChunk(value)) {
5834
5851
  finishReason = {
5835
5852
  unified: mapOpenAIResponseFinishReason({
5836
- finishReason: (_p = value.response.incomplete_details) == null ? void 0 : _p.reason,
5853
+ finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
5837
5854
  hasFunctionCall
5838
5855
  }),
5839
- raw: (_r = (_q = value.response.incomplete_details) == null ? void 0 : _q.reason) != null ? _r : void 0
5856
+ raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
5840
5857
  };
5841
5858
  usage = value.response.usage;
5842
5859
  if (typeof value.response.service_tier === "string") {
@@ -5848,7 +5865,7 @@ var OpenAIResponsesLanguageModel = class {
5848
5865
  controller.enqueue({
5849
5866
  type: "source",
5850
5867
  sourceType: "url",
5851
- id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils32.generateId)(),
5868
+ id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils32.generateId)(),
5852
5869
  url: value.annotation.url,
5853
5870
  title: value.annotation.title
5854
5871
  });
@@ -5856,7 +5873,7 @@ var OpenAIResponsesLanguageModel = class {
5856
5873
  controller.enqueue({
5857
5874
  type: "source",
5858
5875
  sourceType: "document",
5859
- id: (_x = (_w = (_v = self.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : (0, import_provider_utils32.generateId)(),
5876
+ id: (_z = (_y = (_x = self.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : (0, import_provider_utils32.generateId)(),
5860
5877
  mediaType: "text/plain",
5861
5878
  title: value.annotation.filename,
5862
5879
  filename: value.annotation.filename,
@@ -5872,7 +5889,7 @@ var OpenAIResponsesLanguageModel = class {
5872
5889
  controller.enqueue({
5873
5890
  type: "source",
5874
5891
  sourceType: "document",
5875
- id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : (0, import_provider_utils32.generateId)(),
5892
+ id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : (0, import_provider_utils32.generateId)(),
5876
5893
  mediaType: "text/plain",
5877
5894
  title: value.annotation.filename,
5878
5895
  filename: value.annotation.filename,
@@ -5888,7 +5905,7 @@ var OpenAIResponsesLanguageModel = class {
5888
5905
  controller.enqueue({
5889
5906
  type: "source",
5890
5907
  sourceType: "document",
5891
- id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils32.generateId)(),
5908
+ id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : (0, import_provider_utils32.generateId)(),
5892
5909
  mediaType: "application/octet-stream",
5893
5910
  title: value.annotation.file_id,
5894
5911
  filename: value.annotation.file_id,