@ai-sdk/openai 3.0.107 → 3.0.109
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 +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +89 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +8 -8
- package/dist/internal/index.d.ts +8 -8
- package/dist/internal/index.js +88 -9
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +88 -9
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +68 -1
- package/package.json +1 -1
- package/src/chat/openai-chat-language-model.ts +31 -1
- package/src/chat/openai-chat-options.ts +2 -0
- package/src/openai-language-model-capabilities.ts +8 -0
- package/src/responses/openai-responses-api.ts +9 -1
- package/src/responses/openai-responses-language-model.ts +75 -3
- package/src/responses/openai-responses-options.ts +15 -0
|
@@ -2,13 +2,13 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { InferSchema, 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' | '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-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | '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' | '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.5' | 'gpt-5.5-2026-04-23' | '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' | '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-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | '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' | '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.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | (string & {});
|
|
6
6
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
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;
|
|
@@ -127,7 +127,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
|
127
127
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
128
128
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
129
129
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
130
|
-
quality?: "
|
|
130
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
131
131
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
132
132
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
133
133
|
outputCompression?: number | undefined;
|
|
@@ -135,17 +135,17 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
135
135
|
}>;
|
|
136
136
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
137
137
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
138
|
-
quality?: "
|
|
138
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
139
139
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
140
140
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
141
141
|
outputCompression?: number | undefined;
|
|
142
142
|
user?: string | undefined;
|
|
143
143
|
style?: "vivid" | "natural" | undefined;
|
|
144
|
-
moderation?: "
|
|
144
|
+
moderation?: "low" | "auto" | undefined;
|
|
145
145
|
}>;
|
|
146
146
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
147
147
|
declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
148
|
-
quality?: "
|
|
148
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
149
149
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
150
150
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
151
151
|
outputCompression?: number | undefined;
|
|
@@ -221,7 +221,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
|
|
|
221
221
|
doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-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-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-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.5' | 'gpt-5.5-2026-04-23' | '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' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
224
|
+
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-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-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-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.5' | 'gpt-5.5-2026-04-23' | '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' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
225
225
|
|
|
226
226
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
227
227
|
readonly specificationVersion = "v3";
|
|
@@ -1109,7 +1109,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
1109
1109
|
outputCompression?: number | undefined;
|
|
1110
1110
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
1111
1111
|
partialImages?: number | undefined;
|
|
1112
|
-
quality?: "
|
|
1112
|
+
quality?: "low" | "medium" | "high" | "auto" | undefined;
|
|
1113
1113
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
|
|
1114
1114
|
}>;
|
|
1115
1115
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { InferSchema, 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' | '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-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | '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' | '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.5' | 'gpt-5.5-2026-04-23' | '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' | '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-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | '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' | '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.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | (string & {});
|
|
6
6
|
declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
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;
|
|
@@ -127,7 +127,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
|
127
127
|
declare function hasDefaultResponseFormat(modelId: string): boolean;
|
|
128
128
|
declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
|
|
129
129
|
declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
130
|
-
quality?: "
|
|
130
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
131
131
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
132
132
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
133
133
|
outputCompression?: number | undefined;
|
|
@@ -135,17 +135,17 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
135
135
|
}>;
|
|
136
136
|
type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
|
|
137
137
|
declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
138
|
-
quality?: "
|
|
138
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
139
139
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
140
140
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
141
141
|
outputCompression?: number | undefined;
|
|
142
142
|
user?: string | undefined;
|
|
143
143
|
style?: "vivid" | "natural" | undefined;
|
|
144
|
-
moderation?: "
|
|
144
|
+
moderation?: "low" | "auto" | undefined;
|
|
145
145
|
}>;
|
|
146
146
|
type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
|
|
147
147
|
declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
148
|
-
quality?: "
|
|
148
|
+
quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
|
|
149
149
|
background?: "auto" | "transparent" | "opaque" | undefined;
|
|
150
150
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
151
151
|
outputCompression?: number | undefined;
|
|
@@ -221,7 +221,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
|
|
|
221
221
|
doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-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-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-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.5' | 'gpt-5.5-2026-04-23' | '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' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
224
|
+
type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-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-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-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.5' | 'gpt-5.5-2026-04-23' | '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' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
|
|
225
225
|
|
|
226
226
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
|
|
227
227
|
readonly specificationVersion = "v3";
|
|
@@ -1109,7 +1109,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
1109
1109
|
outputCompression?: number | undefined;
|
|
1110
1110
|
outputFormat?: "png" | "jpeg" | "webp" | undefined;
|
|
1111
1111
|
partialImages?: number | undefined;
|
|
1112
|
-
quality?: "
|
|
1112
|
+
quality?: "low" | "medium" | "high" | "auto" | undefined;
|
|
1113
1113
|
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
|
|
1114
1114
|
}>;
|
|
1115
1115
|
declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
|
package/dist/internal/index.js
CHANGED
|
@@ -94,14 +94,17 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
94
94
|
const gptVersion = getGptVersion(modelId);
|
|
95
95
|
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);
|
|
96
96
|
const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
|
|
97
|
+
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
|
|
97
98
|
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
98
99
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
99
100
|
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
100
|
-
const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
|
|
101
|
+
const supportsNonReasoningParameters = !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
|
|
101
102
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
102
103
|
return {
|
|
103
104
|
supportsFlexProcessing,
|
|
104
105
|
supportsPriorityProcessing,
|
|
106
|
+
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
107
|
+
supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
105
108
|
isReasoningModel,
|
|
106
109
|
systemMessageMode,
|
|
107
110
|
supportsNonReasoningParameters
|
|
@@ -775,6 +778,7 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
775
778
|
user: import_v43.z.string().optional(),
|
|
776
779
|
/**
|
|
777
780
|
* Reasoning effort for reasoning models. Defaults to `medium`.
|
|
781
|
+
* GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
778
782
|
*/
|
|
779
783
|
reasoningEffort: import_v43.z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]).optional(),
|
|
780
784
|
/**
|
|
@@ -971,6 +975,17 @@ var OpenAIChatLanguageModel = class {
|
|
|
971
975
|
})) != null ? _a2 : {};
|
|
972
976
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
973
977
|
const isReasoningModel = (_b = openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
978
|
+
let resolvedReasoningEffort = openaiOptions.reasoningEffort;
|
|
979
|
+
if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
|
|
980
|
+
resolvedReasoningEffort
|
|
981
|
+
)) {
|
|
982
|
+
warnings.push({
|
|
983
|
+
type: "unsupported",
|
|
984
|
+
feature: "reasoningEffort",
|
|
985
|
+
details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
|
|
986
|
+
});
|
|
987
|
+
resolvedReasoningEffort = void 0;
|
|
988
|
+
}
|
|
974
989
|
if (topK != null) {
|
|
975
990
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
976
991
|
}
|
|
@@ -1015,7 +1030,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1015
1030
|
store: openaiOptions.store,
|
|
1016
1031
|
metadata: openaiOptions.metadata,
|
|
1017
1032
|
prediction: openaiOptions.prediction,
|
|
1018
|
-
reasoning_effort:
|
|
1033
|
+
reasoning_effort: resolvedReasoningEffort,
|
|
1019
1034
|
service_tier: openaiOptions.serviceTier,
|
|
1020
1035
|
prompt_cache_key: openaiOptions.promptCacheKey,
|
|
1021
1036
|
prompt_cache_options: openaiOptions.promptCacheOptions,
|
|
@@ -1024,6 +1039,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
1024
1039
|
// messages:
|
|
1025
1040
|
messages
|
|
1026
1041
|
};
|
|
1042
|
+
if (modelCapabilities.supportedReasoningEfforts != null && baseArgs.prompt_cache_retention != null) {
|
|
1043
|
+
baseArgs.prompt_cache_retention = void 0;
|
|
1044
|
+
warnings.push({
|
|
1045
|
+
type: "unsupported",
|
|
1046
|
+
feature: "promptCacheRetention",
|
|
1047
|
+
details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1027
1050
|
if (isReasoningModel) {
|
|
1028
1051
|
if (openaiOptions.reasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
|
|
1029
1052
|
if (baseArgs.temperature != null) {
|
|
@@ -4944,7 +4967,8 @@ var openaiResponsesReasoningModelIds = [
|
|
|
4944
4967
|
"gpt-5.6",
|
|
4945
4968
|
"gpt-5.6-luna",
|
|
4946
4969
|
"gpt-5.6-sol",
|
|
4947
|
-
"gpt-5.6-terra"
|
|
4970
|
+
"gpt-5.6-terra",
|
|
4971
|
+
"gpt-6-astra"
|
|
4948
4972
|
];
|
|
4949
4973
|
var openaiResponsesModelIds = [
|
|
4950
4974
|
"gpt-4.1",
|
|
@@ -5063,9 +5087,19 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
|
|
|
5063
5087
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
5064
5088
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
5065
5089
|
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
5090
|
+
* GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
5066
5091
|
* Supported values vary by model.
|
|
5067
5092
|
*/
|
|
5068
5093
|
reasoningEffort: import_v419.z.string().nullish(),
|
|
5094
|
+
/**
|
|
5095
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
5096
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
5097
|
+
* request prefix for prompt caching.
|
|
5098
|
+
*
|
|
5099
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
5100
|
+
* combined with automatic truncation.
|
|
5101
|
+
*/
|
|
5102
|
+
reasoningEffortUpdate: import_v419.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
5069
5103
|
/**
|
|
5070
5104
|
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
5071
5105
|
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
@@ -5987,7 +6021,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5987
6021
|
toolChoice,
|
|
5988
6022
|
responseFormat
|
|
5989
6023
|
}) {
|
|
5990
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
6024
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
5991
6025
|
const warnings = [];
|
|
5992
6026
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
5993
6027
|
if (topK != null) {
|
|
@@ -6019,6 +6053,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6019
6053
|
});
|
|
6020
6054
|
}
|
|
6021
6055
|
const isReasoningModel = (_a2 = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _a2 : modelCapabilities.isReasoningModel;
|
|
6056
|
+
let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
|
|
6057
|
+
if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
|
|
6058
|
+
resolvedReasoningEffort
|
|
6059
|
+
)) {
|
|
6060
|
+
warnings.push({
|
|
6061
|
+
type: "unsupported",
|
|
6062
|
+
feature: "reasoningEffort",
|
|
6063
|
+
details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
|
|
6064
|
+
});
|
|
6065
|
+
resolvedReasoningEffort = void 0;
|
|
6066
|
+
}
|
|
6022
6067
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
6023
6068
|
warnings.push({
|
|
6024
6069
|
type: "unsupported",
|
|
@@ -6071,6 +6116,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6071
6116
|
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
6072
6117
|
});
|
|
6073
6118
|
warnings.push(...inputWarnings);
|
|
6119
|
+
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
6120
|
+
const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
|
|
6121
|
+
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
6122
|
+
warnings.push({
|
|
6123
|
+
type: "unsupported",
|
|
6124
|
+
feature: "reasoningEffortUpdate",
|
|
6125
|
+
details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
|
|
6126
|
+
});
|
|
6127
|
+
} else if (reasoningEffortUpdate != null) {
|
|
6128
|
+
input.unshift({
|
|
6129
|
+
type: "configuration_update",
|
|
6130
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
6131
|
+
});
|
|
6132
|
+
}
|
|
6074
6133
|
const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
|
|
6075
6134
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
6076
6135
|
function addInclude(key) {
|
|
@@ -6144,10 +6203,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6144
6203
|
top_logprobs: topLogprobs,
|
|
6145
6204
|
truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
|
|
6146
6205
|
// model-specific settings:
|
|
6147
|
-
...isReasoningModel && (
|
|
6206
|
+
...isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningContext) != null) && {
|
|
6148
6207
|
reasoning: {
|
|
6149
|
-
...
|
|
6150
|
-
effort:
|
|
6208
|
+
...resolvedReasoningEffort != null && {
|
|
6209
|
+
effort: resolvedReasoningEffort
|
|
6151
6210
|
},
|
|
6152
6211
|
...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
|
|
6153
6212
|
summary: openaiOptions.reasoningSummary
|
|
@@ -6161,6 +6220,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6161
6220
|
}
|
|
6162
6221
|
}
|
|
6163
6222
|
};
|
|
6223
|
+
if (modelCapabilities.supportsConfigurationUpdate && baseArgs.prompt_cache_retention != null) {
|
|
6224
|
+
baseArgs.prompt_cache_retention = void 0;
|
|
6225
|
+
warnings.push({
|
|
6226
|
+
type: "unsupported",
|
|
6227
|
+
feature: "promptCacheRetention",
|
|
6228
|
+
details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
|
|
6229
|
+
});
|
|
6230
|
+
}
|
|
6164
6231
|
if (isReasoningModel) {
|
|
6165
6232
|
if (!((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
6166
6233
|
if (baseArgs.temperature != null) {
|
|
@@ -6180,6 +6247,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6180
6247
|
});
|
|
6181
6248
|
}
|
|
6182
6249
|
}
|
|
6250
|
+
if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_i = baseArgs.include) == null ? void 0 : _i.includes("message.output_text.logprobs")))) {
|
|
6251
|
+
baseArgs.top_logprobs = void 0;
|
|
6252
|
+
const filteredInclude = (_j = baseArgs.include) == null ? void 0 : _j.filter(
|
|
6253
|
+
(value) => value !== "message.output_text.logprobs"
|
|
6254
|
+
);
|
|
6255
|
+
baseArgs.include = filteredInclude != null && filteredInclude.length > 0 ? filteredInclude : void 0;
|
|
6256
|
+
warnings.push({
|
|
6257
|
+
type: "unsupported",
|
|
6258
|
+
feature: "logprobs",
|
|
6259
|
+
details: "logprobs is not supported for reasoning models"
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6183
6262
|
} else {
|
|
6184
6263
|
if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
|
|
6185
6264
|
warnings.push({
|
|
@@ -6226,9 +6305,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6226
6305
|
});
|
|
6227
6306
|
delete baseArgs.service_tier;
|
|
6228
6307
|
}
|
|
6229
|
-
const shellToolEnvType = (
|
|
6308
|
+
const shellToolEnvType = (_m = (_l = (_k = tools == null ? void 0 : tools.find(
|
|
6230
6309
|
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
6231
|
-
)) == null ? void 0 :
|
|
6310
|
+
)) == null ? void 0 : _k.args) == null ? void 0 : _l.environment) == null ? void 0 : _m.type;
|
|
6232
6311
|
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
6233
6312
|
return {
|
|
6234
6313
|
webSearchToolName,
|