@ai-sdk/openai 4.0.58 → 4.0.60

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.
@@ -4,13 +4,13 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
4
  import { InferSchema, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, FetchFunction, WebSocketConstructor, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } from '@ai-sdk/provider-utils';
5
5
  import { z } from 'zod/v4';
6
6
 
7
- 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 & {});
7
+ 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 & {});
8
8
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
9
9
  logitBias?: Record<number, number> | undefined;
10
10
  logprobs?: number | boolean | undefined;
11
11
  parallelToolCalls?: boolean | undefined;
12
12
  user?: string | undefined;
13
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
13
+ reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
14
14
  maxCompletionTokens?: number | undefined;
15
15
  store?: boolean | undefined;
16
16
  metadata?: Record<string, string> | undefined;
@@ -160,7 +160,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
160
160
  declare function hasDefaultResponseFormat(modelId: string): boolean;
161
161
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
162
162
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
163
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
163
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
164
164
  background?: "auto" | "transparent" | "opaque" | undefined;
165
165
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
166
166
  outputCompression?: number | undefined;
@@ -168,17 +168,17 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
168
168
  }>;
169
169
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
170
170
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
171
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
171
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
172
172
  background?: "auto" | "transparent" | "opaque" | undefined;
173
173
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
174
174
  outputCompression?: number | undefined;
175
175
  user?: string | undefined;
176
176
  style?: "vivid" | "natural" | undefined;
177
- moderation?: "auto" | "low" | undefined;
177
+ moderation?: "low" | "auto" | undefined;
178
178
  }>;
179
179
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
180
180
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
181
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
181
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
182
182
  background?: "auto" | "transparent" | "opaque" | undefined;
183
183
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
184
184
  outputCompression?: number | undefined;
@@ -217,8 +217,15 @@ declare const openAITranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema
217
217
  prompt?: string | undefined;
218
218
  temperature?: number | undefined;
219
219
  timestampGranularities?: ("word" | "segment")[] | undefined;
220
+ responseFormat?: "json" | "verbose_json" | "diarized_json" | undefined;
221
+ chunkingStrategy?: "auto" | {
222
+ type: "server_vad";
223
+ threshold?: number | undefined;
224
+ prefixPaddingMs?: number | undefined;
225
+ silenceDurationMs?: number | undefined;
226
+ } | undefined;
220
227
  streaming?: {
221
- delay?: "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
228
+ delay?: "low" | "medium" | "high" | "xhigh" | "minimal" | undefined;
222
229
  include?: string[] | undefined;
223
230
  } | undefined;
224
231
  }>;
@@ -411,7 +418,7 @@ declare const openaiResponsesLocalShellCallSchema: z.ZodObject<{
411
418
  }, z.core.$strip>;
412
419
  }, z.core.$strip>;
413
420
  type OpenAIResponsesInput = Array<OpenAIResponsesInputItem>;
414
- type OpenAIResponsesInputItem = OpenAIResponsesSystemMessage | OpenAIResponsesUserMessage | OpenAIResponsesAssistantMessage | OpenAIResponsesFunctionCall | OpenAIResponsesFunctionCallOutput | OpenAIResponsesProgram | OpenAIResponsesProgramOutput | OpenAIResponsesCustomToolCall | OpenAIResponsesCustomToolCallOutput | OpenAIResponsesMcpApprovalResponse | OpenAIResponsesComputerCall | OpenAIResponsesComputerCallOutput | OpenAIResponsesLocalShellCall | OpenAIResponsesLocalShellCallOutput | OpenAIResponsesShellCall | OpenAIResponsesShellCallOutput | OpenAIResponsesApplyPatchCall | OpenAIResponsesApplyPatchCallOutput | OpenAIResponsesToolSearchCall | OpenAIResponsesToolSearchOutput | OpenAIResponsesReasoning | OpenAIResponsesItemReference | OpenAIResponsesCompactionItem | OpenAIResponsesCompactionTrigger;
421
+ type OpenAIResponsesInputItem = OpenAIResponsesSystemMessage | OpenAIResponsesUserMessage | OpenAIResponsesAssistantMessage | OpenAIResponsesFunctionCall | OpenAIResponsesFunctionCallOutput | OpenAIResponsesProgram | OpenAIResponsesProgramOutput | OpenAIResponsesCustomToolCall | OpenAIResponsesCustomToolCallOutput | OpenAIResponsesMcpApprovalResponse | OpenAIResponsesComputerCall | OpenAIResponsesComputerCallOutput | OpenAIResponsesLocalShellCall | OpenAIResponsesLocalShellCallOutput | OpenAIResponsesShellCall | OpenAIResponsesShellCallOutput | OpenAIResponsesApplyPatchCall | OpenAIResponsesApplyPatchCallOutput | OpenAIResponsesToolSearchCall | OpenAIResponsesToolSearchOutput | OpenAIResponsesReasoning | OpenAIResponsesItemReference | OpenAIResponsesCompactionItem | OpenAIResponsesConfigurationUpdate | OpenAIResponsesCompactionTrigger;
415
422
  type OpenAIResponsesIncludeValue = 'web_search_call.action.sources' | 'web_search_call.results' | 'code_interpreter_call.outputs' | 'computer_call_output.output.image_url' | 'file_search_call.results' | 'message.input_image.image_url' | 'message.output_text.logprobs' | 'reasoning.encrypted_content';
416
423
  type OpenAIResponsesIncludeOptions = Array<OpenAIResponsesIncludeValue> | undefined | null;
417
424
  type OpenAIResponsesSystemMessage = {
@@ -653,6 +660,12 @@ type OpenAIResponsesCompactionItem = {
653
660
  id: string;
654
661
  encrypted_content: string;
655
662
  };
663
+ type OpenAIResponsesConfigurationUpdate = {
664
+ type: 'configuration_update';
665
+ reasoning: {
666
+ effort: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
667
+ };
668
+ };
656
669
  type OpenAIResponsesCompactionTrigger = {
657
670
  type: 'compaction_trigger';
658
671
  };
@@ -1803,7 +1816,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
1803
1816
  }>;
1804
1817
  }, {}>;
1805
1818
 
1806
- 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 & {});
1819
+ 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 & {});
1807
1820
 
1808
1821
  declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1809
1822
  readonly specificationVersion = "v4";
@@ -2270,11 +2283,11 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
2270
2283
  imageUrl?: string | undefined;
2271
2284
  } | undefined;
2272
2285
  model?: string | undefined;
2273
- moderation?: "auto" | "low" | undefined;
2286
+ moderation?: "low" | "auto" | undefined;
2274
2287
  outputCompression?: number | undefined;
2275
2288
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
2276
2289
  partialImages?: number | undefined;
2277
- quality?: "auto" | "low" | "medium" | "high" | undefined;
2290
+ quality?: "low" | "medium" | "high" | "auto" | undefined;
2278
2291
  size?: string | undefined;
2279
2292
  }>;
2280
2293
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -39,14 +39,17 @@ function getOpenAILanguageModelCapabilities(modelId) {
39
39
  const gptVersion = getGptVersion(modelId);
40
40
  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);
41
41
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
42
+ const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
42
43
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
43
44
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
44
45
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
45
- const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
46
+ const supportsNonReasoningParameters = !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
46
47
  const systemMessageMode = isReasoningModel ? "developer" : "system";
47
48
  return {
48
49
  supportsFlexProcessing,
49
50
  supportsPriorityProcessing,
51
+ supportsConfigurationUpdate: isGpt6OrLaterModel,
52
+ supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
50
53
  isReasoningModel,
51
54
  systemMessageMode,
52
55
  supportsNonReasoningParameters
@@ -1011,7 +1014,17 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1011
1014
  schema: openaiLanguageModelChatOptions
1012
1015
  })) != null ? _a2 : {};
1013
1016
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
1014
- const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : isCustomReasoning(reasoning) ? reasoning : void 0;
1017
+ let resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : isCustomReasoning(reasoning) ? reasoning : void 0;
1018
+ if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
1019
+ resolvedReasoningEffort
1020
+ )) {
1021
+ warnings.push({
1022
+ type: "unsupported",
1023
+ feature: "reasoningEffort",
1024
+ details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
1025
+ });
1026
+ resolvedReasoningEffort = void 0;
1027
+ }
1015
1028
  const isReasoningModel = (_c = openaiOptions.forceReasoning) != null ? _c : modelCapabilities.isReasoningModel;
1016
1029
  if (topK != null) {
1017
1030
  warnings.push({ type: "unsupported", feature: "topK" });
@@ -1066,6 +1079,14 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1066
1079
  // messages:
1067
1080
  messages
1068
1081
  };
1082
+ if (modelCapabilities.supportedReasoningEfforts != null && baseArgs.prompt_cache_retention != null) {
1083
+ baseArgs.prompt_cache_retention = void 0;
1084
+ warnings.push({
1085
+ type: "unsupported",
1086
+ feature: "promptCacheRetention",
1087
+ details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
1088
+ });
1089
+ }
1069
1090
  if (isReasoningModel) {
1070
1091
  if (resolvedReasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
1071
1092
  if (baseArgs.temperature != null) {
@@ -2424,18 +2445,28 @@ var openaiTranscriptionResponseSchema = lazySchema9(
2424
2445
  })
2425
2446
  ).nullish(),
2426
2447
  segments: z10.array(
2427
- z10.object({
2428
- id: z10.number(),
2429
- seek: z10.number(),
2430
- start: z10.number(),
2431
- end: z10.number(),
2432
- text: z10.string(),
2433
- tokens: z10.array(z10.number()),
2434
- temperature: z10.number(),
2435
- avg_logprob: z10.number(),
2436
- compression_ratio: z10.number(),
2437
- no_speech_prob: z10.number()
2438
- })
2448
+ z10.union([
2449
+ z10.object({
2450
+ id: z10.number(),
2451
+ seek: z10.number(),
2452
+ start: z10.number(),
2453
+ end: z10.number(),
2454
+ text: z10.string(),
2455
+ tokens: z10.array(z10.number()),
2456
+ temperature: z10.number(),
2457
+ avg_logprob: z10.number(),
2458
+ compression_ratio: z10.number(),
2459
+ no_speech_prob: z10.number()
2460
+ }),
2461
+ z10.object({
2462
+ type: z10.literal("transcript.text.segment"),
2463
+ id: z10.string(),
2464
+ start: z10.number(),
2465
+ end: z10.number(),
2466
+ text: z10.string(),
2467
+ speaker: z10.string()
2468
+ })
2469
+ ])
2439
2470
  ).nullish()
2440
2471
  })
2441
2472
  )
@@ -2472,6 +2503,22 @@ var openAITranscriptionModelOptions = lazySchema10(
2472
2503
  * @default ['segment']
2473
2504
  */
2474
2505
  timestampGranularities: z11.array(z11.enum(["word", "segment"])).default(["segment"]).optional(),
2506
+ /**
2507
+ * The format of the transcription response.
2508
+ */
2509
+ responseFormat: z11.enum(["json", "verbose_json", "diarized_json"]).optional(),
2510
+ /**
2511
+ * Controls how the audio is split into chunks before transcription.
2512
+ */
2513
+ chunkingStrategy: z11.union([
2514
+ z11.literal("auto"),
2515
+ z11.object({
2516
+ type: z11.literal("server_vad"),
2517
+ threshold: z11.number().min(0).max(1).optional(),
2518
+ prefixPaddingMs: z11.number().int().min(0).optional(),
2519
+ silenceDurationMs: z11.number().int().min(0).optional()
2520
+ })
2521
+ ]).optional(),
2475
2522
  /**
2476
2523
  * Options for streaming transcription models such as `gpt-realtime-whisper`.
2477
2524
  */
@@ -2575,6 +2622,7 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2575
2622
  mediaType,
2576
2623
  providerOptions
2577
2624
  }) {
2625
+ var _a2, _b;
2578
2626
  const warnings = [];
2579
2627
  const openAIOptions = await parseProviderOptions5({
2580
2628
  provider: "openai",
@@ -2593,6 +2641,8 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2593
2641
  if (this.modelId === "whisper-1") {
2594
2642
  formData.append("response_format", "verbose_json");
2595
2643
  }
2644
+ const isDiarizationModel = this.modelId === "gpt-4o-transcribe-diarize";
2645
+ const chunkingStrategy = (_a2 = openAIOptions == null ? void 0 : openAIOptions.chunkingStrategy) != null ? _a2 : isDiarizationModel ? "auto" : void 0;
2596
2646
  if (openAIOptions) {
2597
2647
  const isGpt4oTranscribeModel = [
2598
2648
  "gpt-4o-transcribe",
@@ -2605,7 +2655,7 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2605
2655
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
2606
2656
  // prefer verbose_json to get segments for models that support it
2607
2657
  ...this.modelId !== "whisper-1" && {
2608
- response_format: isGpt4oTranscribeModel ? "json" : "verbose_json"
2658
+ response_format: (_b = openAIOptions.responseFormat) != null ? _b : isDiarizationModel ? "diarized_json" : isGpt4oTranscribeModel ? "json" : "verbose_json"
2609
2659
  },
2610
2660
  temperature: openAIOptions.temperature,
2611
2661
  timestamp_granularities: openAIOptions.timestampGranularities
@@ -2621,6 +2671,25 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2621
2671
  }
2622
2672
  }
2623
2673
  }
2674
+ } else if (isDiarizationModel) {
2675
+ formData.append("response_format", "diarized_json");
2676
+ }
2677
+ if (chunkingStrategy != null) {
2678
+ formData.append(
2679
+ "chunking_strategy",
2680
+ typeof chunkingStrategy === "string" ? chunkingStrategy : JSON.stringify({
2681
+ type: chunkingStrategy.type,
2682
+ ...chunkingStrategy.threshold != null && {
2683
+ threshold: chunkingStrategy.threshold
2684
+ },
2685
+ ...chunkingStrategy.prefixPaddingMs != null && {
2686
+ prefix_padding_ms: chunkingStrategy.prefixPaddingMs
2687
+ },
2688
+ ...chunkingStrategy.silenceDurationMs != null && {
2689
+ silence_duration_ms: chunkingStrategy.silenceDurationMs
2690
+ }
2691
+ })
2692
+ );
2624
2693
  }
2625
2694
  return {
2626
2695
  formData,
@@ -2628,7 +2697,7 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2628
2697
  };
2629
2698
  }
2630
2699
  async doGenerate(options) {
2631
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2700
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2632
2701
  if (isRealtimeTranscriptionModelId(this.modelId)) {
2633
2702
  throw new UnsupportedFunctionalityError4({
2634
2703
  functionality: `non-streaming transcription with ${this.modelId}`
@@ -2655,25 +2724,42 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2655
2724
  fetch: this.config.fetch
2656
2725
  });
2657
2726
  const language = response.language != null && response.language in languageMap ? languageMap[response.language] : void 0;
2727
+ const diarizedSegments = (_f = response.segments) == null ? void 0 : _f.flatMap(
2728
+ (segment) => "speaker" in segment ? [
2729
+ {
2730
+ text: segment.text,
2731
+ startSecond: segment.start,
2732
+ endSecond: segment.end,
2733
+ speaker: segment.speaker
2734
+ }
2735
+ ] : []
2736
+ );
2658
2737
  return {
2659
2738
  text: response.text,
2660
- segments: (_i = (_h = (_f = response.segments) == null ? void 0 : _f.map((segment) => ({
2739
+ segments: (_j = (_i = (_g = response.segments) == null ? void 0 : _g.map((segment) => ({
2661
2740
  text: segment.text,
2662
2741
  startSecond: segment.start,
2663
2742
  endSecond: segment.end
2664
- }))) != null ? _h : (_g = response.words) == null ? void 0 : _g.map((word) => ({
2743
+ }))) != null ? _i : (_h = response.words) == null ? void 0 : _h.map((word) => ({
2665
2744
  text: word.word,
2666
2745
  startSecond: word.start,
2667
2746
  endSecond: word.end
2668
- }))) != null ? _i : [],
2747
+ }))) != null ? _j : [],
2669
2748
  language,
2670
- durationInSeconds: (_j = response.duration) != null ? _j : void 0,
2749
+ durationInSeconds: (_k = response.duration) != null ? _k : void 0,
2671
2750
  warnings,
2672
2751
  response: {
2673
2752
  timestamp: currentDate,
2674
2753
  modelId: this.modelId,
2675
2754
  headers: responseHeaders,
2676
2755
  body: rawResponse
2756
+ },
2757
+ ...diarizedSegments != null && diarizedSegments.length > 0 && {
2758
+ providerMetadata: {
2759
+ openai: {
2760
+ segments: diarizedSegments
2761
+ }
2762
+ }
2677
2763
  }
2678
2764
  };
2679
2765
  }
@@ -5821,7 +5907,8 @@ var openaiResponsesReasoningModelIds = [
5821
5907
  "gpt-5.6",
5822
5908
  "gpt-5.6-luna",
5823
5909
  "gpt-5.6-sol",
5824
- "gpt-5.6-terra"
5910
+ "gpt-5.6-terra",
5911
+ "gpt-6-astra"
5825
5912
  ];
5826
5913
  var openaiResponsesModelIds = [
5827
5914
  "gpt-4.1",
@@ -5943,6 +6030,15 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
5943
6030
  * Supported values vary by model.
5944
6031
  */
5945
6032
  reasoningEffort: z21.string().nullish(),
6033
+ /**
6034
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
6035
+ * without changing the request-level reasoning effort. This preserves the
6036
+ * request prefix for prompt caching.
6037
+ *
6038
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
6039
+ * combined with automatic compaction or automatic truncation.
6040
+ */
6041
+ reasoningEffortUpdate: z21.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
5946
6042
  /**
5947
6043
  * Controls how much model work GPT-5.6 performs before returning a final answer.
5948
6044
  * `standard` is the default. `pro` increases quality, latency, and token usage.
@@ -7023,7 +7119,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7023
7119
  toolChoice,
7024
7120
  responseFormat
7025
7121
  }) {
7026
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
7122
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
7027
7123
  const warnings = [];
7028
7124
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
7029
7125
  if (topK != null) {
@@ -7054,7 +7150,17 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7054
7150
  schema: openaiLanguageModelResponsesOptionsSchema
7055
7151
  });
7056
7152
  }
7057
- const resolvedReasoningEffort = (_a2 = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a2 : isCustomReasoning2(reasoning) ? reasoning : void 0;
7153
+ let resolvedReasoningEffort = (_a2 = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a2 : isCustomReasoning2(reasoning) ? reasoning : void 0;
7154
+ if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
7155
+ resolvedReasoningEffort
7156
+ )) {
7157
+ warnings.push({
7158
+ type: "unsupported",
7159
+ feature: "reasoningEffort",
7160
+ details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
7161
+ });
7162
+ resolvedReasoningEffort = void 0;
7163
+ }
7058
7164
  const resolvedReasoningSummary = (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) !== void 0 ? openaiOptions.reasoningSummary : resolvedReasoningEffort != null && resolvedReasoningEffort !== "none" ? "detailed" : void 0;
7059
7165
  const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
7060
7166
  if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
@@ -7114,6 +7220,20 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7114
7220
  outputSchemaToolNames: outputSchemaToolNames.size > 0 ? outputSchemaToolNames : void 0
7115
7221
  });
7116
7222
  warnings.push(...inputWarnings);
7223
+ const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
7224
+ const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.contextManagement) == null && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
7225
+ if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
7226
+ warnings.push({
7227
+ type: "unsupported",
7228
+ feature: "reasoningEffortUpdate",
7229
+ details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic compaction or automatic truncation"
7230
+ });
7231
+ } else if (reasoningEffortUpdate != null) {
7232
+ input.unshift({
7233
+ type: "configuration_update",
7234
+ reasoning: { effort: reasoningEffortUpdate }
7235
+ });
7236
+ }
7117
7237
  if (openaiOptions == null ? void 0 : openaiOptions.compactionTrigger) {
7118
7238
  input.push({ type: "compaction_trigger" });
7119
7239
  }
@@ -7214,6 +7334,14 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7214
7334
  }
7215
7335
  }
7216
7336
  };
7337
+ if (modelCapabilities.supportsConfigurationUpdate && baseArgs.prompt_cache_retention != null) {
7338
+ baseArgs.prompt_cache_retention = void 0;
7339
+ warnings.push({
7340
+ type: "unsupported",
7341
+ feature: "promptCacheRetention",
7342
+ details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
7343
+ });
7344
+ }
7217
7345
  if (isReasoningModel) {
7218
7346
  if (!(resolvedReasoningEffort === "none" && modelCapabilities.supportsNonReasoningParameters)) {
7219
7347
  if (baseArgs.temperature != null) {
@@ -7232,6 +7360,18 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7232
7360
  details: "topP is not supported for reasoning models"
7233
7361
  });
7234
7362
  }
7363
+ if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_j = baseArgs.include) == null ? void 0 : _j.includes("message.output_text.logprobs")))) {
7364
+ baseArgs.top_logprobs = void 0;
7365
+ const filteredInclude = (_k = baseArgs.include) == null ? void 0 : _k.filter(
7366
+ (value) => value !== "message.output_text.logprobs"
7367
+ );
7368
+ baseArgs.include = filteredInclude != null && filteredInclude.length > 0 ? filteredInclude : void 0;
7369
+ warnings.push({
7370
+ type: "unsupported",
7371
+ feature: "logprobs",
7372
+ details: "logprobs is not supported for reasoning models"
7373
+ });
7374
+ }
7235
7375
  }
7236
7376
  } else {
7237
7377
  if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
@@ -7279,9 +7419,9 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7279
7419
  });
7280
7420
  delete baseArgs.service_tier;
7281
7421
  }
7282
- const shellToolEnvType = (_l = (_k = (_j = tools == null ? void 0 : tools.find(
7422
+ const shellToolEnvType = (_n = (_m = (_l = tools == null ? void 0 : tools.find(
7283
7423
  (tool) => tool.type === "provider" && tool.id === "openai.shell"
7284
- )) == null ? void 0 : _j.args) == null ? void 0 : _k.environment) == null ? void 0 : _l.type;
7424
+ )) == null ? void 0 : _l.args) == null ? void 0 : _m.environment) == null ? void 0 : _n.type;
7285
7425
  const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
7286
7426
  return {
7287
7427
  webSearchToolName,