@ai-sdk/openai 4.0.10 → 4.0.13
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 +28 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +392 -127
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +14 -1
- package/dist/internal/index.js +384 -122
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +75 -16
- package/package.json +5 -5
- package/src/chat/convert-openai-chat-usage.ts +5 -2
- package/src/chat/convert-to-openai-chat-messages.ts +114 -7
- package/src/chat/openai-chat-api.ts +2 -0
- package/src/chat/openai-chat-language-model-options.ts +16 -2
- package/src/chat/openai-chat-language-model.ts +1 -0
- package/src/chat/openai-chat-prompt.ts +8 -4
- package/src/openai-provider.ts +7 -4
- package/src/responses/convert-openai-responses-usage.ts +5 -2
- package/src/responses/convert-to-openai-responses-input.ts +123 -6
- package/src/responses/openai-responses-api.ts +77 -11
- package/src/responses/openai-responses-language-model-options.ts +32 -7
- package/src/responses/openai-responses-language-model.ts +37 -1
- package/src/responses/openai-responses-provider-metadata.ts +1 -0
- package/src/transcription/openai-transcription-model.ts +101 -82
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7805e4a: Fix realtime transcription auth header handling: per-call `authorization` headers now override configuration headers regardless of header-key casing (last case-variant wins), and the `Bearer` scheme is matched case-insensitively.
|
|
8
|
+
- cd12954: Reject empty OpenAI, Anthropic, and Replicate base URLs with a helpful AI SDK
|
|
9
|
+
invalid argument error.
|
|
10
|
+
- Updated dependencies [4be62c1]
|
|
11
|
+
- Updated dependencies [7805e4a]
|
|
12
|
+
- Updated dependencies [cd12954]
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.9
|
|
14
|
+
|
|
15
|
+
## 4.0.12
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- e193290: Add `connectToWebSocket` to `@ai-sdk/provider-utils`: a shared WebSocket connect layer (constructor resolution, header hygiene, abort wiring, message decoding) analogous to `postToApi` for HTTP. The openai and xai streaming transcription models now use it instead of hand-rolled connects. For openai and xai this also means WebSocket constructor failures now surface as stream errors instead of throwing synchronously from `doStream`, an already-aborted signal no longer constructs a socket, and the caller's audio stream is cancelled on pre-open failures. Messages are processed in order with close handling deferred behind pending frames, audio send loops apply backpressure via the socket's bufferedAmount, and failed sends cancel the caller's audio stream.
|
|
20
|
+
- e193290: Fix streaming transcription over header-capable WebSocket implementations: the realtime WebSocket handshake sent the api key in both the `openai-insecure-api-key` subprotocol and the `Authorization` header, which OpenAI rejects ("You must only send one of protocol api key and Authorization header"). The Authorization header is now stripped when the subprotocol carries the key.
|
|
21
|
+
- e193290: Strip undefined header values before the streaming transcription WebSocket constructor (header-capable implementations like `ws` throw on undefined values).
|
|
22
|
+
- Updated dependencies [e193290]
|
|
23
|
+
- @ai-sdk/provider-utils@5.0.8
|
|
24
|
+
|
|
25
|
+
## 4.0.11
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- b2b1bb9: feat(provider/openai): add GPT-5.6 reasoning and prompt cache controls
|
|
30
|
+
|
|
3
31
|
## 4.0.10
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
9
9
|
logprobs?: number | boolean | undefined;
|
|
10
10
|
parallelToolCalls?: boolean | undefined;
|
|
11
11
|
user?: string | undefined;
|
|
12
|
-
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
12
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
|
|
13
13
|
maxCompletionTokens?: number | undefined;
|
|
14
14
|
store?: boolean | undefined;
|
|
15
15
|
metadata?: Record<string, string> | undefined;
|
|
@@ -18,6 +18,10 @@ declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<
|
|
|
18
18
|
strictJsonSchema?: boolean | undefined;
|
|
19
19
|
textVerbosity?: "low" | "medium" | "high" | undefined;
|
|
20
20
|
promptCacheKey?: string | undefined;
|
|
21
|
+
promptCacheOptions?: {
|
|
22
|
+
mode?: "explicit" | "implicit" | undefined;
|
|
23
|
+
ttl?: "30m" | undefined;
|
|
24
|
+
} | undefined;
|
|
21
25
|
promptCacheRetention?: "in_memory" | "24h" | undefined;
|
|
22
26
|
safetyIdentifier?: string | undefined;
|
|
23
27
|
systemMessageMode?: "remove" | "system" | "developer" | undefined;
|
|
@@ -244,6 +248,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
244
248
|
output_tokens: number;
|
|
245
249
|
input_tokens_details?: {
|
|
246
250
|
cached_tokens?: number | null | undefined;
|
|
251
|
+
cache_write_tokens?: number | null | undefined;
|
|
247
252
|
orchestration_input_tokens?: number | null | undefined;
|
|
248
253
|
orchestration_input_cached_tokens?: number | null | undefined;
|
|
249
254
|
} | null | undefined;
|
|
@@ -255,6 +260,9 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
255
260
|
incomplete_details?: {
|
|
256
261
|
reason: string;
|
|
257
262
|
} | null | undefined;
|
|
263
|
+
reasoning?: {
|
|
264
|
+
context?: string | null | undefined;
|
|
265
|
+
} | null | undefined;
|
|
258
266
|
service_tier?: string | null | undefined;
|
|
259
267
|
};
|
|
260
268
|
} | {
|
|
@@ -273,6 +281,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
273
281
|
output_tokens: number;
|
|
274
282
|
input_tokens_details?: {
|
|
275
283
|
cached_tokens?: number | null | undefined;
|
|
284
|
+
cache_write_tokens?: number | null | undefined;
|
|
276
285
|
orchestration_input_tokens?: number | null | undefined;
|
|
277
286
|
orchestration_input_cached_tokens?: number | null | undefined;
|
|
278
287
|
} | null | undefined;
|
|
@@ -281,6 +290,9 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
281
290
|
orchestration_output_tokens?: number | null | undefined;
|
|
282
291
|
} | null | undefined;
|
|
283
292
|
} | null | undefined;
|
|
293
|
+
reasoning?: {
|
|
294
|
+
context?: string | null | undefined;
|
|
295
|
+
} | null | undefined;
|
|
284
296
|
service_tier?: string | null | undefined;
|
|
285
297
|
};
|
|
286
298
|
} | {
|
|
@@ -1072,8 +1084,14 @@ declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.
|
|
|
1072
1084
|
parallelToolCalls?: boolean | null | undefined;
|
|
1073
1085
|
previousResponseId?: string | null | undefined;
|
|
1074
1086
|
promptCacheKey?: string | null | undefined;
|
|
1087
|
+
promptCacheOptions?: {
|
|
1088
|
+
mode?: "explicit" | "implicit" | undefined;
|
|
1089
|
+
ttl?: "30m" | undefined;
|
|
1090
|
+
} | undefined;
|
|
1075
1091
|
promptCacheRetention?: "in_memory" | "24h" | null | undefined;
|
|
1076
1092
|
reasoningEffort?: string | null | undefined;
|
|
1093
|
+
reasoningMode?: "standard" | "pro" | undefined;
|
|
1094
|
+
reasoningContext?: "auto" | "current_turn" | "all_turns" | undefined;
|
|
1077
1095
|
reasoningSummary?: string | null | undefined;
|
|
1078
1096
|
safetyIdentifier?: string | null | undefined;
|
|
1079
1097
|
serviceTier?: "default" | "auto" | "flex" | "priority" | null | undefined;
|
|
@@ -1269,6 +1287,7 @@ type ResponsesProviderMetadata = {
|
|
|
1269
1287
|
responseId: string | null | undefined;
|
|
1270
1288
|
logprobs?: Array<OpenAIResponsesLogprobs>;
|
|
1271
1289
|
serviceTier?: string;
|
|
1290
|
+
reasoningContext?: string;
|
|
1272
1291
|
};
|
|
1273
1292
|
type ResponsesReasoningProviderMetadata = {
|
|
1274
1293
|
itemId: string;
|