@ai-sdk/openai 4.0.57 → 4.0.59

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,7 +4,7 @@ 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;
@@ -15,7 +15,7 @@ declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<
15
15
  store?: boolean | undefined;
16
16
  metadata?: Record<string, string> | undefined;
17
17
  prediction?: Record<string, any> | undefined;
18
- serviceTier?: "default" | "auto" | "flex" | "priority" | "fast" | undefined;
18
+ serviceTier?: "default" | "auto" | "flex" | "priority" | "fast" | "ultrafast" | undefined;
19
19
  strictJsonSchema?: boolean | undefined;
20
20
  textVerbosity?: "low" | "medium" | "high" | undefined;
21
21
  promptCacheKey?: string | undefined;
@@ -217,6 +217,13 @@ 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
228
  delay?: "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
222
229
  include?: string[] | undefined;
@@ -763,6 +770,7 @@ type OpenAIResponsesTool = OpenAIResponsesFunctionTool | {
763
770
  filters: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter | undefined;
764
771
  } | {
765
772
  type: 'image_generation';
773
+ action: 'generate' | 'edit' | 'auto' | undefined;
766
774
  background: 'auto' | 'opaque' | 'transparent' | undefined;
767
775
  input_fidelity: 'low' | 'high' | undefined;
768
776
  input_image_mask: {
@@ -770,12 +778,12 @@ type OpenAIResponsesTool = OpenAIResponsesFunctionTool | {
770
778
  image_url: string | undefined;
771
779
  } | undefined;
772
780
  model: string | undefined;
773
- moderation: 'auto' | undefined;
781
+ moderation: 'auto' | 'low' | undefined;
774
782
  output_compression: number | undefined;
775
783
  output_format: 'png' | 'jpeg' | 'webp' | undefined;
776
784
  partial_images: number | undefined;
777
785
  quality: 'auto' | 'low' | 'medium' | 'high' | undefined;
778
- size: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | undefined;
786
+ size: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {}) | undefined;
779
787
  }
780
788
  /**
781
789
  * Official OpenAI API Specifications: https://platform.openai.com/docs/api-reference/responses/create#responses_create-tools-mcp_tool
@@ -1802,7 +1810,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
1802
1810
  }>;
1803
1811
  }, {}>;
1804
1812
 
1805
- 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 & {});
1813
+ 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 & {});
1806
1814
 
1807
1815
  declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1808
1816
  readonly specificationVersion = "v4";
@@ -1870,7 +1878,7 @@ declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1870
1878
  store: boolean | null | undefined;
1871
1879
  user: string | null | undefined;
1872
1880
  instructions: string | null | undefined;
1873
- service_tier: "default" | "auto" | "flex" | "priority" | "fast" | null | undefined;
1881
+ service_tier: "default" | "auto" | "flex" | "priority" | "fast" | "ultrafast" | null | undefined;
1874
1882
  include: OpenAIResponsesIncludeOptions;
1875
1883
  prompt_cache_key: string | null | undefined;
1876
1884
  prompt_cache_options: {
@@ -2261,6 +2269,7 @@ declare const fileSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{},
2261
2269
  }, {}>;
2262
2270
 
2263
2271
  declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
2272
+ action?: "auto" | "generate" | "edit" | undefined;
2264
2273
  background?: "auto" | "transparent" | "opaque" | undefined;
2265
2274
  inputFidelity?: "low" | "high" | undefined;
2266
2275
  inputImageMask?: {
@@ -2268,17 +2277,21 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
2268
2277
  imageUrl?: string | undefined;
2269
2278
  } | undefined;
2270
2279
  model?: string | undefined;
2271
- moderation?: "auto" | undefined;
2280
+ moderation?: "auto" | "low" | undefined;
2272
2281
  outputCompression?: number | undefined;
2273
2282
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
2274
2283
  partialImages?: number | undefined;
2275
2284
  quality?: "auto" | "low" | "medium" | "high" | undefined;
2276
- size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
2285
+ size?: string | undefined;
2277
2286
  }>;
2278
2287
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
2279
2288
  result: string;
2280
2289
  }>;
2281
2290
  type ImageGenerationArgs = {
2291
+ /**
2292
+ * Whether to generate a new image or edit an existing image. Default: auto.
2293
+ */
2294
+ action?: 'generate' | 'edit' | 'auto';
2282
2295
  /**
2283
2296
  * Background type for the generated image. Default is 'auto'.
2284
2297
  */
@@ -2306,9 +2319,9 @@ type ImageGenerationArgs = {
2306
2319
  */
2307
2320
  model?: string;
2308
2321
  /**
2309
- * Moderation level for the generated image. Default: auto.
2322
+ * Moderation level for the generated image. One of auto or low. Default: auto.
2310
2323
  */
2311
- moderation?: 'auto';
2324
+ moderation?: 'auto' | 'low';
2312
2325
  /**
2313
2326
  * Compression level for the output image. Default: 100.
2314
2327
  */
@@ -2329,10 +2342,11 @@ type ImageGenerationArgs = {
2329
2342
  quality?: 'auto' | 'low' | 'medium' | 'high';
2330
2343
  /**
2331
2344
  * The size of the generated image.
2332
- * One of 1024x1024, 1024x1536, 1536x1024, or auto.
2345
+ * One of 1024x1024, 1024x1536, 1536x1024, or auto. gpt-image-2 also accepts
2346
+ * arbitrary WIDTHxHEIGHT sizes where both are divisible by 16, e.g. 1536x864.
2333
2347
  * Default: auto.
2334
2348
  */
2335
- size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
2349
+ size?: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | (string & {});
2336
2350
  };
2337
2351
  declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
2338
2352
  /**
@@ -828,11 +828,12 @@ var openaiLanguageModelChatOptions = lazySchema2(
828
828
  * - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
829
829
  * - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
830
830
  * - 'fast': OpenAI's newer name for the 'priority' tier. Interchangeable with it.
831
+ * - 'ultrafast': Access-controlled Ultrafast processing. Only available for gpt-5.6-sol.
831
832
  * - 'default': The request will be processed with the standard pricing and performance for the selected model.
832
833
  *
833
834
  * @default 'auto'
834
835
  */
835
- serviceTier: z3.enum(["auto", "flex", "priority", "fast", "default"]).optional(),
836
+ serviceTier: z3.enum(["auto", "flex", "priority", "fast", "ultrafast", "default"]).optional(),
836
837
  /**
837
838
  * Whether to use strict JSON schema validation.
838
839
  *
@@ -2423,18 +2424,28 @@ var openaiTranscriptionResponseSchema = lazySchema9(
2423
2424
  })
2424
2425
  ).nullish(),
2425
2426
  segments: z10.array(
2426
- z10.object({
2427
- id: z10.number(),
2428
- seek: z10.number(),
2429
- start: z10.number(),
2430
- end: z10.number(),
2431
- text: z10.string(),
2432
- tokens: z10.array(z10.number()),
2433
- temperature: z10.number(),
2434
- avg_logprob: z10.number(),
2435
- compression_ratio: z10.number(),
2436
- no_speech_prob: z10.number()
2437
- })
2427
+ z10.union([
2428
+ z10.object({
2429
+ id: z10.number(),
2430
+ seek: z10.number(),
2431
+ start: z10.number(),
2432
+ end: z10.number(),
2433
+ text: z10.string(),
2434
+ tokens: z10.array(z10.number()),
2435
+ temperature: z10.number(),
2436
+ avg_logprob: z10.number(),
2437
+ compression_ratio: z10.number(),
2438
+ no_speech_prob: z10.number()
2439
+ }),
2440
+ z10.object({
2441
+ type: z10.literal("transcript.text.segment"),
2442
+ id: z10.string(),
2443
+ start: z10.number(),
2444
+ end: z10.number(),
2445
+ text: z10.string(),
2446
+ speaker: z10.string()
2447
+ })
2448
+ ])
2438
2449
  ).nullish()
2439
2450
  })
2440
2451
  )
@@ -2471,6 +2482,22 @@ var openAITranscriptionModelOptions = lazySchema10(
2471
2482
  * @default ['segment']
2472
2483
  */
2473
2484
  timestampGranularities: z11.array(z11.enum(["word", "segment"])).default(["segment"]).optional(),
2485
+ /**
2486
+ * The format of the transcription response.
2487
+ */
2488
+ responseFormat: z11.enum(["json", "verbose_json", "diarized_json"]).optional(),
2489
+ /**
2490
+ * Controls how the audio is split into chunks before transcription.
2491
+ */
2492
+ chunkingStrategy: z11.union([
2493
+ z11.literal("auto"),
2494
+ z11.object({
2495
+ type: z11.literal("server_vad"),
2496
+ threshold: z11.number().min(0).max(1).optional(),
2497
+ prefixPaddingMs: z11.number().int().min(0).optional(),
2498
+ silenceDurationMs: z11.number().int().min(0).optional()
2499
+ })
2500
+ ]).optional(),
2474
2501
  /**
2475
2502
  * Options for streaming transcription models such as `gpt-realtime-whisper`.
2476
2503
  */
@@ -2574,6 +2601,7 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2574
2601
  mediaType,
2575
2602
  providerOptions
2576
2603
  }) {
2604
+ var _a2, _b;
2577
2605
  const warnings = [];
2578
2606
  const openAIOptions = await parseProviderOptions5({
2579
2607
  provider: "openai",
@@ -2592,6 +2620,8 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2592
2620
  if (this.modelId === "whisper-1") {
2593
2621
  formData.append("response_format", "verbose_json");
2594
2622
  }
2623
+ const isDiarizationModel = this.modelId === "gpt-4o-transcribe-diarize";
2624
+ const chunkingStrategy = (_a2 = openAIOptions == null ? void 0 : openAIOptions.chunkingStrategy) != null ? _a2 : isDiarizationModel ? "auto" : void 0;
2595
2625
  if (openAIOptions) {
2596
2626
  const isGpt4oTranscribeModel = [
2597
2627
  "gpt-4o-transcribe",
@@ -2604,7 +2634,7 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2604
2634
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
2605
2635
  // prefer verbose_json to get segments for models that support it
2606
2636
  ...this.modelId !== "whisper-1" && {
2607
- response_format: isGpt4oTranscribeModel ? "json" : "verbose_json"
2637
+ response_format: (_b = openAIOptions.responseFormat) != null ? _b : isDiarizationModel ? "diarized_json" : isGpt4oTranscribeModel ? "json" : "verbose_json"
2608
2638
  },
2609
2639
  temperature: openAIOptions.temperature,
2610
2640
  timestamp_granularities: openAIOptions.timestampGranularities
@@ -2620,6 +2650,25 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2620
2650
  }
2621
2651
  }
2622
2652
  }
2653
+ } else if (isDiarizationModel) {
2654
+ formData.append("response_format", "diarized_json");
2655
+ }
2656
+ if (chunkingStrategy != null) {
2657
+ formData.append(
2658
+ "chunking_strategy",
2659
+ typeof chunkingStrategy === "string" ? chunkingStrategy : JSON.stringify({
2660
+ type: chunkingStrategy.type,
2661
+ ...chunkingStrategy.threshold != null && {
2662
+ threshold: chunkingStrategy.threshold
2663
+ },
2664
+ ...chunkingStrategy.prefixPaddingMs != null && {
2665
+ prefix_padding_ms: chunkingStrategy.prefixPaddingMs
2666
+ },
2667
+ ...chunkingStrategy.silenceDurationMs != null && {
2668
+ silence_duration_ms: chunkingStrategy.silenceDurationMs
2669
+ }
2670
+ })
2671
+ );
2623
2672
  }
2624
2673
  return {
2625
2674
  formData,
@@ -2627,7 +2676,7 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2627
2676
  };
2628
2677
  }
2629
2678
  async doGenerate(options) {
2630
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2679
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2631
2680
  if (isRealtimeTranscriptionModelId(this.modelId)) {
2632
2681
  throw new UnsupportedFunctionalityError4({
2633
2682
  functionality: `non-streaming transcription with ${this.modelId}`
@@ -2654,25 +2703,42 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
2654
2703
  fetch: this.config.fetch
2655
2704
  });
2656
2705
  const language = response.language != null && response.language in languageMap ? languageMap[response.language] : void 0;
2706
+ const diarizedSegments = (_f = response.segments) == null ? void 0 : _f.flatMap(
2707
+ (segment) => "speaker" in segment ? [
2708
+ {
2709
+ text: segment.text,
2710
+ startSecond: segment.start,
2711
+ endSecond: segment.end,
2712
+ speaker: segment.speaker
2713
+ }
2714
+ ] : []
2715
+ );
2657
2716
  return {
2658
2717
  text: response.text,
2659
- segments: (_i = (_h = (_f = response.segments) == null ? void 0 : _f.map((segment) => ({
2718
+ segments: (_j = (_i = (_g = response.segments) == null ? void 0 : _g.map((segment) => ({
2660
2719
  text: segment.text,
2661
2720
  startSecond: segment.start,
2662
2721
  endSecond: segment.end
2663
- }))) != null ? _h : (_g = response.words) == null ? void 0 : _g.map((word) => ({
2722
+ }))) != null ? _i : (_h = response.words) == null ? void 0 : _h.map((word) => ({
2664
2723
  text: word.word,
2665
2724
  startSecond: word.start,
2666
2725
  endSecond: word.end
2667
- }))) != null ? _i : [],
2726
+ }))) != null ? _j : [],
2668
2727
  language,
2669
- durationInSeconds: (_j = response.duration) != null ? _j : void 0,
2728
+ durationInSeconds: (_k = response.duration) != null ? _k : void 0,
2670
2729
  warnings,
2671
2730
  response: {
2672
2731
  timestamp: currentDate,
2673
2732
  modelId: this.modelId,
2674
2733
  headers: responseHeaders,
2675
2734
  body: rawResponse
2735
+ },
2736
+ ...diarizedSegments != null && diarizedSegments.length > 0 && {
2737
+ providerMetadata: {
2738
+ openai: {
2739
+ segments: diarizedSegments
2740
+ }
2741
+ }
2676
2742
  }
2677
2743
  };
2678
2744
  }
@@ -5820,7 +5886,8 @@ var openaiResponsesReasoningModelIds = [
5820
5886
  "gpt-5.6",
5821
5887
  "gpt-5.6-luna",
5822
5888
  "gpt-5.6-sol",
5823
- "gpt-5.6-terra"
5889
+ "gpt-5.6-terra",
5890
+ "gpt-6-astra"
5824
5891
  ];
5825
5892
  var openaiResponsesModelIds = [
5826
5893
  "gpt-4.1",
@@ -5968,10 +6035,11 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
5968
6035
  * Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
5969
6036
  * Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
5970
6037
  * Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
6038
+ * Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
5971
6039
  *
5972
6040
  * Defaults to 'auto'.
5973
6041
  */
5974
- serviceTier: z21.enum(["auto", "flex", "priority", "fast", "default"]).nullish(),
6042
+ serviceTier: z21.enum(["auto", "flex", "priority", "fast", "ultrafast", "default"]).nullish(),
5975
6043
  /**
5976
6044
  * Whether to store the generation. Defaults to `true`.
5977
6045
  */
@@ -6178,6 +6246,7 @@ import { z as z24 } from "zod/v4";
6178
6246
  var imageGenerationArgsSchema = lazySchema22(
6179
6247
  () => zodSchema22(
6180
6248
  z24.object({
6249
+ action: z24.enum(["generate", "edit", "auto"]).optional(),
6181
6250
  background: z24.enum(["auto", "opaque", "transparent"]).optional(),
6182
6251
  inputFidelity: z24.enum(["low", "high"]).optional(),
6183
6252
  inputImageMask: z24.object({
@@ -6185,12 +6254,15 @@ var imageGenerationArgsSchema = lazySchema22(
6185
6254
  imageUrl: z24.string().optional()
6186
6255
  }).optional(),
6187
6256
  model: z24.string().optional(),
6188
- moderation: z24.enum(["auto"]).optional(),
6257
+ moderation: z24.enum(["auto", "low"]).optional(),
6189
6258
  outputCompression: z24.number().int().min(0).max(100).optional(),
6190
6259
  outputFormat: z24.enum(["png", "jpeg", "webp"]).optional(),
6191
6260
  partialImages: z24.number().int().min(0).max(3).optional(),
6192
6261
  quality: z24.enum(["auto", "low", "medium", "high"]).optional(),
6193
- size: z24.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
6262
+ size: z24.union([
6263
+ z24.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]),
6264
+ z24.string().regex(/^\d+x\d+$/)
6265
+ ]).optional()
6194
6266
  }).strict()
6195
6267
  )
6196
6268
  );
@@ -6594,6 +6666,7 @@ async function prepareResponsesTools({
6594
6666
  });
6595
6667
  openaiTools.push({
6596
6668
  type: "image_generation",
6669
+ action: args.action,
6597
6670
  background: args.background,
6598
6671
  input_fidelity: args.inputFidelity,
6599
6672
  input_image_mask: args.inputImageMask ? {