@ai-sdk/openai 4.0.0-canary.72 → 4.0.0

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.
@@ -298,7 +298,7 @@ The following OpenAI-specific metadata may be returned:
298
298
 
299
299
  #### Reasoning Output
300
300
 
301
- For reasoning models like `gpt-5`, you can enable reasoning summaries to see the model's thought process. Different models support different summarizers—for example, `o4-mini` supports detailed summaries. Set `reasoningSummary: "auto"` to automatically receive the richest level available.
301
+ For reasoning models like `gpt-5`, you can enable reasoning summaries to see the model's thought process. Different models support different summarizers—for example, `o4-mini` supports detailed summaries. Set `reasoningSummary: "auto"` to automatically receive the richest level available. When `reasoningEffort` is set to a value other than `'none'`, the OpenAI Responses provider defaults `reasoningSummary` to `'detailed'`; set `reasoningSummary: null` to omit reasoning summaries.
302
302
 
303
303
  ```ts highlight="8-9,16"
304
304
  import {
@@ -2646,7 +2646,7 @@ const model = openai.transcription('whisper-1');
2646
2646
  You can also pass additional provider-specific options using the `providerOptions` argument. For example, supplying the input language in ISO-639-1 (e.g. `en`) format will improve accuracy and latency.
2647
2647
 
2648
2648
  ```ts highlight="6"
2649
- import { experimental_transcribe as transcribe } from 'ai';
2649
+ import { transcribe } from 'ai';
2650
2650
  import { openai, type OpenAITranscriptionModelOptions } from '@ai-sdk/openai';
2651
2651
 
2652
2652
  const result = await transcribe({
@@ -2661,7 +2661,7 @@ const result = await transcribe({
2661
2661
  To get word-level timestamps, specify the granularity:
2662
2662
 
2663
2663
  ```ts highlight="8-9"
2664
- import { experimental_transcribe as transcribe } from 'ai';
2664
+ import { transcribe } from 'ai';
2665
2665
  import { openai, type OpenAITranscriptionModelOptions } from '@ai-sdk/openai';
2666
2666
 
2667
2667
  const result = await transcribe({
@@ -2725,7 +2725,7 @@ const model = openai.speech('tts-1');
2725
2725
  The `voice` argument can be set to one of OpenAI's available voices: `alloy`, `ash`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, or `shimmer`.
2726
2726
 
2727
2727
  ```ts highlight="6"
2728
- import { experimental_generateSpeech as generateSpeech } from 'ai';
2728
+ import { generateSpeech } from 'ai';
2729
2729
  import { openai } from '@ai-sdk/openai';
2730
2730
 
2731
2731
  const result = await generateSpeech({
@@ -2738,7 +2738,7 @@ const result = await generateSpeech({
2738
2738
  You can also pass additional provider-specific options using the `providerOptions` argument:
2739
2739
 
2740
2740
  ```ts highlight="7-9"
2741
- import { experimental_generateSpeech as generateSpeech } from 'ai';
2741
+ import { generateSpeech } from 'ai';
2742
2742
  import { openai, type OpenAISpeechModelOptions } from '@ai-sdk/openai';
2743
2743
 
2744
2744
  const result = await generateSpeech({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/openai",
3
- "version": "4.0.0-canary.72",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,15 +35,15 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.0-canary.18",
39
- "@ai-sdk/provider-utils": "5.0.0-canary.47"
38
+ "@ai-sdk/provider-utils": "5.0.0",
39
+ "@ai-sdk/provider": "4.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "22.19.19",
43
43
  "tsup": "^8.5.1",
44
44
  "typescript": "5.8.3",
45
45
  "zod": "3.25.76",
46
- "@ai-sdk/test-server": "2.0.0-canary.6",
46
+ "@ai-sdk/test-server": "2.0.0",
47
47
  "@vercel/ai-tsconfig": "0.0.0"
48
48
  },
49
49
  "peerDependencies": {
@@ -5,9 +5,12 @@ export type OpenAIResponsesUsage = {
5
5
  output_tokens: number;
6
6
  input_tokens_details?: {
7
7
  cached_tokens?: number | null;
8
+ orchestration_input_tokens?: number | null;
9
+ orchestration_input_cached_tokens?: number | null;
8
10
  } | null;
9
11
  output_tokens_details?: {
10
12
  reasoning_tokens?: number | null;
13
+ orchestration_output_tokens?: number | null;
11
14
  } | null;
12
15
  };
13
16
 
@@ -531,11 +531,18 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
531
531
  usage: z.object({
532
532
  input_tokens: z.number(),
533
533
  input_tokens_details: z
534
- .object({ cached_tokens: z.number().nullish() })
534
+ .object({
535
+ cached_tokens: z.number().nullish(),
536
+ orchestration_input_tokens: z.number().nullish(),
537
+ orchestration_input_cached_tokens: z.number().nullish(),
538
+ })
535
539
  .nullish(),
536
540
  output_tokens: z.number(),
537
541
  output_tokens_details: z
538
- .object({ reasoning_tokens: z.number().nullish() })
542
+ .object({
543
+ reasoning_tokens: z.number().nullish(),
544
+ orchestration_output_tokens: z.number().nullish(),
545
+ })
539
546
  .nullish(),
540
547
  }),
541
548
  service_tier: z.string().nullish(),
@@ -556,11 +563,18 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
556
563
  .object({
557
564
  input_tokens: z.number(),
558
565
  input_tokens_details: z
559
- .object({ cached_tokens: z.number().nullish() })
566
+ .object({
567
+ cached_tokens: z.number().nullish(),
568
+ orchestration_input_tokens: z.number().nullish(),
569
+ orchestration_input_cached_tokens: z.number().nullish(),
570
+ })
560
571
  .nullish(),
561
572
  output_tokens: z.number(),
562
573
  output_tokens_details: z
563
- .object({ reasoning_tokens: z.number().nullish() })
574
+ .object({
575
+ reasoning_tokens: z.number().nullish(),
576
+ orchestration_output_tokens: z.number().nullish(),
577
+ })
564
578
  .nullish(),
565
579
  })
566
580
  .nullish(),
@@ -1416,11 +1430,18 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
1416
1430
  .object({
1417
1431
  input_tokens: z.number(),
1418
1432
  input_tokens_details: z
1419
- .object({ cached_tokens: z.number().nullish() })
1433
+ .object({
1434
+ cached_tokens: z.number().nullish(),
1435
+ orchestration_input_tokens: z.number().nullish(),
1436
+ orchestration_input_cached_tokens: z.number().nullish(),
1437
+ })
1420
1438
  .nullish(),
1421
1439
  output_tokens: z.number(),
1422
1440
  output_tokens_details: z
1423
- .object({ reasoning_tokens: z.number().nullish() })
1441
+ .object({
1442
+ reasoning_tokens: z.number().nullish(),
1443
+ orchestration_output_tokens: z.number().nullish(),
1444
+ })
1424
1445
  .nullish(),
1425
1446
  })
1426
1447
  .optional(),
@@ -198,6 +198,12 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
198
198
  const resolvedReasoningEffort =
199
199
  openaiOptions?.reasoningEffort ??
200
200
  (isCustomReasoning(reasoning) ? reasoning : undefined);
201
+ const resolvedReasoningSummary =
202
+ openaiOptions?.reasoningSummary !== undefined
203
+ ? openaiOptions.reasoningSummary
204
+ : resolvedReasoningEffort != null && resolvedReasoningEffort !== 'none'
205
+ ? 'detailed'
206
+ : undefined;
201
207
 
202
208
  const isReasoningModel =
203
209
  openaiOptions?.forceReasoning ?? modelCapabilities.isReasoningModel;
@@ -377,13 +383,13 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
377
383
  // model-specific settings:
378
384
  ...(isReasoningModel &&
379
385
  (resolvedReasoningEffort != null ||
380
- openaiOptions?.reasoningSummary != null) && {
386
+ resolvedReasoningSummary != null) && {
381
387
  reasoning: {
382
388
  ...(resolvedReasoningEffort != null && {
383
389
  effort: resolvedReasoningEffort,
384
390
  }),
385
- ...(openaiOptions?.reasoningSummary != null && {
386
- summary: openaiOptions.reasoningSummary,
391
+ ...(resolvedReasoningSummary != null && {
392
+ summary: resolvedReasoningSummary,
387
393
  }),
388
394
  },
389
395
  }),