@ai-sdk/openai 4.0.0-beta.13 → 4.0.0-beta.15
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 +14 -0
- package/dist/index.d.mts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +41 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +24 -2
- package/dist/internal/index.d.ts +24 -2
- package/dist/internal/index.js +40 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +40 -6
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +2 -0
- package/package.json +1 -1
- package/src/chat/openai-chat-options.ts +4 -0
- package/src/openai-language-model-capabilities.ts +2 -2
- package/src/responses/openai-responses-api.ts +25 -0
- package/src/responses/openai-responses-language-model.ts +19 -0
- package/src/responses/openai-responses-options.ts +8 -0
package/docs/03-openai.mdx
CHANGED
|
@@ -2303,6 +2303,8 @@ The following optional provider options are available for OpenAI completion mode
|
|
|
2303
2303
|
| --------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
|
2304
2304
|
| `gpt-5.4-pro` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2305
2305
|
| `gpt-5.4` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2306
|
+
| `gpt-5.4-mini` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2307
|
+
| `gpt-5.4-nano` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2306
2308
|
| `gpt-5.3-chat-latest` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2307
2309
|
| `gpt-5.2-pro` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
2308
2310
|
| `gpt-5.2-chat-latest` | <Check size={18} /> | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
package/package.json
CHANGED
|
@@ -54,6 +54,10 @@ export type OpenAIChatModelId =
|
|
|
54
54
|
| 'gpt-5.3-chat-latest'
|
|
55
55
|
| 'gpt-5.4'
|
|
56
56
|
| 'gpt-5.4-2026-03-05'
|
|
57
|
+
| 'gpt-5.4-mini'
|
|
58
|
+
| 'gpt-5.4-mini-2026-03-17'
|
|
59
|
+
| 'gpt-5.4-nano'
|
|
60
|
+
| 'gpt-5.4-nano-2026-03-17'
|
|
57
61
|
| 'gpt-5.4-pro'
|
|
58
62
|
| 'gpt-5.4-pro-2026-03-05'
|
|
59
63
|
| (string & {});
|
|
@@ -20,10 +20,10 @@ export function getOpenAILanguageModelCapabilities(
|
|
|
20
20
|
|
|
21
21
|
const supportsPriorityProcessing =
|
|
22
22
|
modelId.startsWith('gpt-4') ||
|
|
23
|
-
modelId.startsWith('gpt-5-mini') ||
|
|
24
23
|
(modelId.startsWith('gpt-5') &&
|
|
25
24
|
!modelId.startsWith('gpt-5-nano') &&
|
|
26
|
-
!modelId.startsWith('gpt-5-chat')
|
|
25
|
+
!modelId.startsWith('gpt-5-chat') &&
|
|
26
|
+
!modelId.startsWith('gpt-5.4-nano')) ||
|
|
27
27
|
modelId.startsWith('o3') ||
|
|
28
28
|
modelId.startsWith('o4-mini');
|
|
29
29
|
|
|
@@ -503,6 +503,31 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
503
503
|
service_tier: z.string().nullish(),
|
|
504
504
|
}),
|
|
505
505
|
}),
|
|
506
|
+
z.object({
|
|
507
|
+
type: z.literal('response.failed'),
|
|
508
|
+
response: z.object({
|
|
509
|
+
error: z
|
|
510
|
+
.object({
|
|
511
|
+
code: z.string().nullish(),
|
|
512
|
+
message: z.string(),
|
|
513
|
+
})
|
|
514
|
+
.nullish(),
|
|
515
|
+
incomplete_details: z.object({ reason: z.string() }).nullish(),
|
|
516
|
+
usage: z
|
|
517
|
+
.object({
|
|
518
|
+
input_tokens: z.number(),
|
|
519
|
+
input_tokens_details: z
|
|
520
|
+
.object({ cached_tokens: z.number().nullish() })
|
|
521
|
+
.nullish(),
|
|
522
|
+
output_tokens: z.number(),
|
|
523
|
+
output_tokens_details: z
|
|
524
|
+
.object({ reasoning_tokens: z.number().nullish() })
|
|
525
|
+
.nullish(),
|
|
526
|
+
})
|
|
527
|
+
.nullish(),
|
|
528
|
+
service_tier: z.string().nullish(),
|
|
529
|
+
}),
|
|
530
|
+
}),
|
|
506
531
|
z.object({
|
|
507
532
|
type: z.literal('response.created'),
|
|
508
533
|
response: z.object({
|
|
@@ -2044,6 +2044,19 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
|
|
|
2044
2044
|
if (typeof value.response.service_tier === 'string') {
|
|
2045
2045
|
serviceTier = value.response.service_tier;
|
|
2046
2046
|
}
|
|
2047
|
+
} else if (isResponseFailedChunk(value)) {
|
|
2048
|
+
const incompleteReason =
|
|
2049
|
+
value.response.incomplete_details?.reason;
|
|
2050
|
+
finishReason = {
|
|
2051
|
+
unified: incompleteReason
|
|
2052
|
+
? mapOpenAIResponseFinishReason({
|
|
2053
|
+
finishReason: incompleteReason,
|
|
2054
|
+
hasFunctionCall,
|
|
2055
|
+
})
|
|
2056
|
+
: 'error',
|
|
2057
|
+
raw: incompleteReason ?? 'error',
|
|
2058
|
+
};
|
|
2059
|
+
usage = value.response.usage ?? undefined;
|
|
2047
2060
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
2048
2061
|
ongoingAnnotations.push(value.annotation);
|
|
2049
2062
|
if (value.annotation.type === 'url_citation') {
|
|
@@ -2163,6 +2176,12 @@ function isResponseFinishedChunk(
|
|
|
2163
2176
|
);
|
|
2164
2177
|
}
|
|
2165
2178
|
|
|
2179
|
+
function isResponseFailedChunk(
|
|
2180
|
+
chunk: OpenAIResponsesChunk,
|
|
2181
|
+
): chunk is OpenAIResponsesChunk & { type: 'response.failed' } {
|
|
2182
|
+
return chunk.type === 'response.failed';
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2166
2185
|
function isResponseCreatedChunk(
|
|
2167
2186
|
chunk: OpenAIResponsesChunk,
|
|
2168
2187
|
): chunk is OpenAIResponsesChunk & { type: 'response.created' } {
|
|
@@ -41,6 +41,10 @@ export const openaiResponsesReasoningModelIds = [
|
|
|
41
41
|
'gpt-5.3-codex',
|
|
42
42
|
'gpt-5.4',
|
|
43
43
|
'gpt-5.4-2026-03-05',
|
|
44
|
+
'gpt-5.4-mini',
|
|
45
|
+
'gpt-5.4-mini-2026-03-17',
|
|
46
|
+
'gpt-5.4-nano',
|
|
47
|
+
'gpt-5.4-nano-2026-03-17',
|
|
44
48
|
'gpt-5.4-pro',
|
|
45
49
|
'gpt-5.4-pro-2026-03-05',
|
|
46
50
|
] as const;
|
|
@@ -103,6 +107,10 @@ export type OpenAIResponsesModelId =
|
|
|
103
107
|
| 'gpt-5.3-codex'
|
|
104
108
|
| 'gpt-5.4'
|
|
105
109
|
| 'gpt-5.4-2026-03-05'
|
|
110
|
+
| 'gpt-5.4-mini'
|
|
111
|
+
| 'gpt-5.4-mini-2026-03-17'
|
|
112
|
+
| 'gpt-5.4-nano'
|
|
113
|
+
| 'gpt-5.4-nano-2026-03-17'
|
|
106
114
|
| 'gpt-5.4-pro'
|
|
107
115
|
| 'gpt-5.4-pro-2026-03-05'
|
|
108
116
|
| 'gpt-5-2025-08-07'
|