@ai-sdk/openai 2.0.123 → 2.0.125
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 +12 -0
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +85 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +7 -7
- package/dist/internal/index.d.ts +7 -7
- package/dist/internal/index.js +84 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +84 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -2,13 +2,13 @@ import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2Ca
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { InferValidator, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } 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' | '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' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | (string & {});
|
|
5
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-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' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | (string & {});
|
|
6
6
|
declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
7
7
|
logitBias?: Record<number, number> | undefined;
|
|
8
8
|
logprobs?: number | boolean | undefined;
|
|
9
9
|
parallelToolCalls?: boolean | undefined;
|
|
10
10
|
user?: string | undefined;
|
|
11
|
-
reasoningEffort?: "
|
|
11
|
+
reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
|
|
12
12
|
maxCompletionTokens?: number | undefined;
|
|
13
13
|
store?: boolean | undefined;
|
|
14
14
|
metadata?: Record<string, string> | undefined;
|
|
@@ -126,7 +126,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
|
126
126
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
127
127
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
128
128
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
129
|
-
quality?: "
|
|
129
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
130
130
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
131
131
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
132
132
|
outputCompression?: number | undefined;
|
|
@@ -134,13 +134,13 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
|
134
134
|
}>;
|
|
135
135
|
type OpenAIImageModelOptions = InferValidator<typeof openaiImageModelOptions>;
|
|
136
136
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
137
|
-
quality?: "
|
|
137
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
138
138
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
139
139
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
140
140
|
outputCompression?: number | undefined;
|
|
141
141
|
user?: string | undefined;
|
|
142
142
|
style?: "vivid" | "natural" | undefined;
|
|
143
|
-
moderation?: "
|
|
143
|
+
moderation?: "low" | "auto" | undefined;
|
|
144
144
|
}>;
|
|
145
145
|
type OpenAIImageModelGenerationOptions = InferValidator<typeof openaiImageModelGenerationOptions>;
|
|
146
146
|
|
|
@@ -211,7 +211,7 @@ declare class OpenAISpeechModel implements SpeechModelV2 {
|
|
|
211
211
|
doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
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-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | '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 & {});
|
|
214
|
+
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-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | '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 & {});
|
|
215
215
|
|
|
216
216
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
217
217
|
readonly specificationVersion = "v2";
|
|
@@ -436,7 +436,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
436
436
|
outputCompression?: number | undefined;
|
|
437
437
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
438
438
|
partialImages?: number | undefined;
|
|
439
|
-
quality?: "
|
|
439
|
+
quality?: "low" | "medium" | "high" | "auto" | undefined;
|
|
440
440
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
|
|
441
441
|
}>;
|
|
442
442
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2Ca
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { InferValidator, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } 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' | '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' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | (string & {});
|
|
5
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-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' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | (string & {});
|
|
6
6
|
declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
7
7
|
logitBias?: Record<number, number> | undefined;
|
|
8
8
|
logprobs?: number | boolean | undefined;
|
|
9
9
|
parallelToolCalls?: boolean | undefined;
|
|
10
10
|
user?: string | undefined;
|
|
11
|
-
reasoningEffort?: "
|
|
11
|
+
reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
|
|
12
12
|
maxCompletionTokens?: number | undefined;
|
|
13
13
|
store?: boolean | undefined;
|
|
14
14
|
metadata?: Record<string, string> | undefined;
|
|
@@ -126,7 +126,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
|
126
126
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
127
127
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
128
128
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
129
|
-
quality?: "
|
|
129
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
130
130
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
131
131
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
132
132
|
outputCompression?: number | undefined;
|
|
@@ -134,13 +134,13 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
|
134
134
|
}>;
|
|
135
135
|
type OpenAIImageModelOptions = InferValidator<typeof openaiImageModelOptions>;
|
|
136
136
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazyValidator<{
|
|
137
|
-
quality?: "
|
|
137
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
138
138
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
139
139
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
140
140
|
outputCompression?: number | undefined;
|
|
141
141
|
user?: string | undefined;
|
|
142
142
|
style?: "vivid" | "natural" | undefined;
|
|
143
|
-
moderation?: "
|
|
143
|
+
moderation?: "low" | "auto" | undefined;
|
|
144
144
|
}>;
|
|
145
145
|
type OpenAIImageModelGenerationOptions = InferValidator<typeof openaiImageModelGenerationOptions>;
|
|
146
146
|
|
|
@@ -211,7 +211,7 @@ declare class OpenAISpeechModel implements SpeechModelV2 {
|
|
|
211
211
|
doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
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-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | '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 & {});
|
|
214
|
+
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-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | '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 & {});
|
|
215
215
|
|
|
216
216
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
217
217
|
readonly specificationVersion = "v2";
|
|
@@ -436,7 +436,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
436
436
|
outputCompression?: number | undefined;
|
|
437
437
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
438
438
|
partialImages?: number | undefined;
|
|
439
|
-
quality?: "
|
|
439
|
+
quality?: "low" | "medium" | "high" | "auto" | undefined;
|
|
440
440
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
|
|
441
441
|
}>;
|
|
442
442
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
package/dist/internal/index.js
CHANGED
|
@@ -88,14 +88,17 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
88
88
|
const gptVersion = getGptVersion(modelId);
|
|
89
89
|
const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a2 = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a2.startsWith("chat")) != null ? _b : false);
|
|
90
90
|
const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
|
|
91
|
+
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
|
|
91
92
|
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
92
93
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
93
94
|
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel || modelId === "codex-mini-latest" || modelId === "computer-use-preview";
|
|
94
|
-
const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
|
|
95
|
+
const supportsNonReasoningParameters = !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
|
|
95
96
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
96
97
|
return {
|
|
97
98
|
supportsFlexProcessing,
|
|
98
99
|
supportsPriorityProcessing,
|
|
100
|
+
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
101
|
+
supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
99
102
|
isReasoningModel,
|
|
100
103
|
systemMessageMode,
|
|
101
104
|
supportsNonReasoningParameters
|
|
@@ -780,6 +783,17 @@ var OpenAIChatLanguageModel = class {
|
|
|
780
783
|
);
|
|
781
784
|
warnings.push(...messageWarnings);
|
|
782
785
|
const strictJsonSchema = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
|
|
786
|
+
let resolvedReasoningEffort = openaiOptions.reasoningEffort;
|
|
787
|
+
if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
|
|
788
|
+
resolvedReasoningEffort
|
|
789
|
+
)) {
|
|
790
|
+
warnings.push({
|
|
791
|
+
type: "unsupported-setting",
|
|
792
|
+
setting: "reasoningEffort",
|
|
793
|
+
details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
|
|
794
|
+
});
|
|
795
|
+
resolvedReasoningEffort = void 0;
|
|
796
|
+
}
|
|
783
797
|
const baseArgs = {
|
|
784
798
|
// model id:
|
|
785
799
|
model: this.modelId,
|
|
@@ -813,7 +827,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
813
827
|
store: openaiOptions.store,
|
|
814
828
|
metadata: openaiOptions.metadata,
|
|
815
829
|
prediction: openaiOptions.prediction,
|
|
816
|
-
reasoning_effort:
|
|
830
|
+
reasoning_effort: resolvedReasoningEffort,
|
|
817
831
|
service_tier: openaiOptions.serviceTier,
|
|
818
832
|
prompt_cache_key: openaiOptions.promptCacheKey,
|
|
819
833
|
prompt_cache_options: openaiOptions.promptCacheOptions,
|
|
@@ -822,6 +836,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
822
836
|
// messages:
|
|
823
837
|
messages
|
|
824
838
|
};
|
|
839
|
+
if (modelCapabilities.supportedReasoningEfforts != null && baseArgs.prompt_cache_retention != null) {
|
|
840
|
+
baseArgs.prompt_cache_retention = void 0;
|
|
841
|
+
warnings.push({
|
|
842
|
+
type: "unsupported-setting",
|
|
843
|
+
setting: "promptCacheRetention",
|
|
844
|
+
details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
|
|
845
|
+
});
|
|
846
|
+
}
|
|
825
847
|
if (modelCapabilities.isReasoningModel) {
|
|
826
848
|
if (openaiOptions.reasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
|
|
827
849
|
if (baseArgs.temperature != null) {
|
|
@@ -3316,7 +3338,8 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3316
3338
|
"gpt-5.6",
|
|
3317
3339
|
"gpt-5.6-luna",
|
|
3318
3340
|
"gpt-5.6-sol",
|
|
3319
|
-
"gpt-5.6-terra"
|
|
3341
|
+
"gpt-5.6-terra",
|
|
3342
|
+
"gpt-6-astra"
|
|
3320
3343
|
];
|
|
3321
3344
|
var openaiResponsesModelIds = [
|
|
3322
3345
|
"gpt-4.1",
|
|
@@ -3417,6 +3440,15 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValid
|
|
|
3417
3440
|
* Supported values vary by model.
|
|
3418
3441
|
*/
|
|
3419
3442
|
reasoningEffort: import_v416.z.string().nullish(),
|
|
3443
|
+
/**
|
|
3444
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3445
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
3446
|
+
* request prefix for prompt caching.
|
|
3447
|
+
*
|
|
3448
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3449
|
+
* combined with automatic truncation.
|
|
3450
|
+
*/
|
|
3451
|
+
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3420
3452
|
/**
|
|
3421
3453
|
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3422
3454
|
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
@@ -3852,7 +3884,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3852
3884
|
toolChoice,
|
|
3853
3885
|
responseFormat
|
|
3854
3886
|
}) {
|
|
3855
|
-
var _a2, _b, _c, _d;
|
|
3887
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
3856
3888
|
const warnings = [];
|
|
3857
3889
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
3858
3890
|
if (topK != null) {
|
|
@@ -3896,6 +3928,31 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3896
3928
|
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
3897
3929
|
});
|
|
3898
3930
|
warnings.push(...inputWarnings);
|
|
3931
|
+
let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
|
|
3932
|
+
if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
|
|
3933
|
+
resolvedReasoningEffort
|
|
3934
|
+
)) {
|
|
3935
|
+
warnings.push({
|
|
3936
|
+
type: "unsupported-setting",
|
|
3937
|
+
setting: "reasoningEffort",
|
|
3938
|
+
details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
|
|
3939
|
+
});
|
|
3940
|
+
resolvedReasoningEffort = void 0;
|
|
3941
|
+
}
|
|
3942
|
+
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3943
|
+
const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
|
|
3944
|
+
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
3945
|
+
warnings.push({
|
|
3946
|
+
type: "unsupported-setting",
|
|
3947
|
+
setting: "reasoningEffortUpdate",
|
|
3948
|
+
details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
|
|
3949
|
+
});
|
|
3950
|
+
} else if (reasoningEffortUpdate != null) {
|
|
3951
|
+
input.unshift({
|
|
3952
|
+
type: "configuration_update",
|
|
3953
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
3954
|
+
});
|
|
3955
|
+
}
|
|
3899
3956
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
3900
3957
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
3901
3958
|
function addInclude(key) {
|
|
@@ -3967,10 +4024,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3967
4024
|
top_logprobs: topLogprobs,
|
|
3968
4025
|
truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
|
|
3969
4026
|
// model-specific settings:
|
|
3970
|
-
...modelCapabilities.isReasoningModel && (
|
|
4027
|
+
...modelCapabilities.isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningContext) != null) && {
|
|
3971
4028
|
reasoning: {
|
|
3972
|
-
...
|
|
3973
|
-
effort:
|
|
4029
|
+
...resolvedReasoningEffort != null && {
|
|
4030
|
+
effort: resolvedReasoningEffort
|
|
3974
4031
|
},
|
|
3975
4032
|
...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
|
|
3976
4033
|
summary: openaiOptions.reasoningSummary
|
|
@@ -3984,6 +4041,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3984
4041
|
}
|
|
3985
4042
|
}
|
|
3986
4043
|
};
|
|
4044
|
+
if (modelCapabilities.supportsConfigurationUpdate && baseArgs.prompt_cache_retention != null) {
|
|
4045
|
+
baseArgs.prompt_cache_retention = void 0;
|
|
4046
|
+
warnings.push({
|
|
4047
|
+
type: "unsupported-setting",
|
|
4048
|
+
setting: "promptCacheRetention",
|
|
4049
|
+
details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
3987
4052
|
if (modelCapabilities.isReasoningModel) {
|
|
3988
4053
|
if (!((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
3989
4054
|
if (baseArgs.temperature != null) {
|
|
@@ -4002,6 +4067,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4002
4067
|
details: "topP is not supported for reasoning models"
|
|
4003
4068
|
});
|
|
4004
4069
|
}
|
|
4070
|
+
if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_e = baseArgs.include) == null ? void 0 : _e.includes("message.output_text.logprobs")))) {
|
|
4071
|
+
baseArgs.top_logprobs = void 0;
|
|
4072
|
+
const filteredInclude = (_f = baseArgs.include) == null ? void 0 : _f.filter(
|
|
4073
|
+
(value) => value !== "message.output_text.logprobs"
|
|
4074
|
+
);
|
|
4075
|
+
baseArgs.include = filteredInclude != null && filteredInclude.length > 0 ? filteredInclude : void 0;
|
|
4076
|
+
warnings.push({
|
|
4077
|
+
type: "unsupported-setting",
|
|
4078
|
+
setting: "logprobs",
|
|
4079
|
+
details: "logprobs is not supported for reasoning models"
|
|
4080
|
+
});
|
|
4081
|
+
}
|
|
4005
4082
|
}
|
|
4006
4083
|
} else {
|
|
4007
4084
|
if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
|