@ai-sdk/openai 2.0.142 → 2.0.143

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/dist/index.mjs CHANGED
@@ -2461,14 +2461,27 @@ import {
2461
2461
  safeValidateTypes,
2462
2462
  validateTypes
2463
2463
  } from "@ai-sdk/provider-utils";
2464
- import { z as z17 } from "zod/v4";
2464
+ import { z as z18 } from "zod/v4";
2465
+
2466
+ // src/responses/openai-responses-text-format.ts
2467
+ import { z as z16 } from "zod/v4";
2468
+ var openaiResponsesTextFormatSchema = () => z16.discriminatedUnion("type", [
2469
+ z16.object({ type: z16.literal("text") }),
2470
+ z16.object({
2471
+ type: z16.literal("json_schema"),
2472
+ name: z16.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/),
2473
+ schema: z16.record(z16.string(), z16.json()),
2474
+ description: z16.string().optional(),
2475
+ strict: z16.boolean().optional()
2476
+ })
2477
+ ]);
2465
2478
 
2466
2479
  // src/responses/openai-responses-options.ts
2467
2480
  import {
2468
2481
  lazyValidator as lazyValidator9,
2469
2482
  zodSchema as zodSchema16
2470
2483
  } from "@ai-sdk/provider-utils";
2471
- import { z as z16 } from "zod/v4";
2484
+ import { z as z17 } from "zod/v4";
2472
2485
  var TOP_LOGPROBS_MAX = 20;
2473
2486
  var openaiResponsesReasoningModelIds = [
2474
2487
  "o1",
@@ -2560,17 +2573,17 @@ var openaiResponsesModelIds = [
2560
2573
  ];
2561
2574
  var openaiResponsesProviderOptionsSchema = lazyValidator9(
2562
2575
  () => zodSchema16(
2563
- z16.object({
2564
- conversation: z16.string().nullish(),
2565
- include: z16.array(
2566
- z16.enum([
2576
+ z17.object({
2577
+ conversation: z17.string().nullish(),
2578
+ include: z17.array(
2579
+ z17.enum([
2567
2580
  "reasoning.encrypted_content",
2568
2581
  // handled internally by default, only needed for unknown reasoning models
2569
2582
  "file_search_call.results",
2570
2583
  "message.output_text.logprobs"
2571
2584
  ])
2572
2585
  ).nullish(),
2573
- instructions: z16.string().nullish(),
2586
+ instructions: z17.string().nullish(),
2574
2587
  /**
2575
2588
  * Return the log probabilities of the tokens.
2576
2589
  *
@@ -2583,25 +2596,26 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2583
2596
  * @see https://platform.openai.com/docs/api-reference/responses/create
2584
2597
  * @see https://cookbook.openai.com/examples/using_logprobs
2585
2598
  */
2586
- logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2599
+ logprobs: z17.union([z17.boolean(), z17.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2587
2600
  /**
2588
2601
  * The maximum number of total calls to built-in tools that can be processed in a response.
2589
2602
  * This maximum number applies across all built-in tool calls, not per individual tool.
2590
2603
  * Any further attempts to call a tool by the model will be ignored.
2591
2604
  */
2592
- maxToolCalls: z16.number().nullish(),
2593
- metadata: z16.any().nullish(),
2594
- parallelToolCalls: z16.boolean().nullish(),
2595
- previousResponseId: z16.string().nullish(),
2596
- promptCacheKey: z16.string().nullish(),
2605
+ maxToolCalls: z17.number().nullish(),
2606
+ metadata: z17.any().nullish(),
2607
+ parallelToolCalls: z17.boolean().nullish(),
2608
+ previousResponseId: z17.string().nullish(),
2609
+ promptCacheKey: z17.string().nullish(),
2597
2610
  /**
2598
2611
  * Prompt cache behavior for GPT-5.6 and later models.
2599
2612
  * `mode` controls whether OpenAI also places an implicit breakpoint.
2600
2613
  * `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
2601
2614
  */
2602
- promptCacheOptions: z16.object({
2603
- mode: z16.enum(["implicit", "explicit"]).optional(),
2604
- ttl: z16.literal("30m").optional()
2615
+ promptCacheOptions: z17.object({
2616
+ comparisonResponseId: z17.string().optional(),
2617
+ mode: z17.enum(["implicit", "explicit"]).optional(),
2618
+ ttl: z17.literal("30m").optional()
2605
2619
  }).optional(),
2606
2620
  /**
2607
2621
  * The retention policy for the prompt cache.
@@ -2613,14 +2627,14 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2613
2627
  *
2614
2628
  * @default 'in_memory'
2615
2629
  */
2616
- promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
2630
+ promptCacheRetention: z17.enum(["in_memory", "24h"]).nullish(),
2617
2631
  /**
2618
2632
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
2619
2633
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
2620
2634
  * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
2621
2635
  * Supported values vary by model.
2622
2636
  */
2623
- reasoningEffort: z16.string().nullish(),
2637
+ reasoningEffort: z17.string().nullish(),
2624
2638
  /**
2625
2639
  * Updates the reasoning effort for GPT-6 and later models starting with this response
2626
2640
  * without changing the request-level reasoning effort. This preserves the
@@ -2629,32 +2643,36 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2629
2643
  * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
2630
2644
  * combined with automatic truncation.
2631
2645
  */
2632
- reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2646
+ reasoningEffortUpdate: z17.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
2633
2647
  /**
2634
2648
  * Controls how much model work GPT-5.6 performs before returning a final answer.
2635
2649
  * `standard` is the default. `pro` increases quality, latency, and token usage.
2636
2650
  */
2637
- reasoningMode: z16.enum(["standard", "pro"]).optional(),
2651
+ reasoningMode: z17.enum(["standard", "pro"]).optional(),
2638
2652
  /**
2639
2653
  * Controls which available reasoning items GPT-5.6 can use.
2640
2654
  * `auto` uses the model default, `current_turn` excludes reasoning from earlier
2641
2655
  * turns, and `all_turns` makes compatible earlier reasoning available.
2642
2656
  */
2643
- reasoningContext: z16.enum(["auto", "current_turn", "all_turns"]).optional(),
2644
- reasoningSummary: z16.string().nullish(),
2645
- safetyIdentifier: z16.string().nullish(),
2646
- serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
2647
- store: z16.boolean().nullish(),
2648
- strictJsonSchema: z16.boolean().nullish(),
2649
- textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
2650
- truncation: z16.enum(["auto", "disabled"]).nullish(),
2651
- user: z16.string().nullish()
2657
+ reasoningContext: z17.enum(["auto", "current_turn", "all_turns"]).optional(),
2658
+ reasoningSummary: z17.string().nullish(),
2659
+ safetyIdentifier: z17.string().nullish(),
2660
+ serviceTier: z17.enum(["auto", "flex", "priority", "default"]).nullish(),
2661
+ store: z17.boolean().nullish(),
2662
+ strictJsonSchema: z17.boolean().nullish(),
2663
+ textVerbosity: z17.enum(["low", "medium", "high"]).nullish(),
2664
+ /** Keep the initial wire format stable while Output validates the current schema. */
2665
+ textFormat: openaiResponsesTextFormatSchema().optional(),
2666
+ truncation: z17.enum(["auto", "disabled"]).nullish(),
2667
+ user: z17.string().nullish()
2652
2668
  })
2653
2669
  )
2654
2670
  );
2655
2671
  var openaiResponsesSystemMessageOptionsSchema = lazyValidator9(
2656
2672
  () => zodSchema16(
2657
- z16.object({
2673
+ z17.object({
2674
+ /** Replace the format at this position; requires empty system content. */
2675
+ textFormatUpdate: openaiResponsesTextFormatSchema().optional(),
2658
2676
  /**
2659
2677
  * Emit a configuration update at this position in Responses history.
2660
2678
  * Requires empty system message content and the same supported
@@ -2663,7 +2681,7 @@ var openaiResponsesSystemMessageOptionsSchema = lazyValidator9(
2663
2681
  *
2664
2682
  * @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
2665
2683
  */
2666
- reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2684
+ reasoningEffortUpdate: z17.enum(["low", "medium", "high", "xhigh", "max"]).optional()
2667
2685
  })
2668
2686
  )
2669
2687
  );
@@ -2758,17 +2776,24 @@ async function convertToOpenAIResponsesInput({
2758
2776
  });
2759
2777
  }
2760
2778
  const effort = options == null ? void 0 : options.reasoningEffortUpdate;
2761
- if (effort != null) {
2762
- const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
2779
+ const textFormat = options == null ? void 0 : options.textFormatUpdate;
2780
+ if (effort != null || textFormat != null) {
2781
+ const feature = effort != null ? "reasoningEffortUpdate" : "textFormatUpdate";
2782
+ const unsupportedReason = content !== "" ? `Message-level ${feature} requires empty system message content.` : configurationUpdateUnsupportedReason;
2763
2783
  if (unsupportedReason != null) {
2764
2784
  throw new UnsupportedFunctionalityError4({
2765
- functionality: "Message-level reasoningEffortUpdate",
2785
+ functionality: `Message-level ${feature}`,
2766
2786
  message: unsupportedReason
2767
2787
  });
2768
2788
  }
2769
2789
  input.push({
2770
2790
  type: "configuration_update",
2771
- reasoning: { effort }
2791
+ ...effort != null && { reasoning: { effort } },
2792
+ ...textFormat != null && {
2793
+ text: {
2794
+ format: textFormat
2795
+ }
2796
+ }
2772
2797
  });
2773
2798
  break;
2774
2799
  }
@@ -3138,9 +3163,9 @@ async function convertToOpenAIResponsesInput({
3138
3163
  }
3139
3164
  var openaiResponsesReasoningProviderOptionsSchema = lazySchema8(
3140
3165
  () => zodSchema17(
3141
- z17.object({
3142
- itemId: z17.string().nullish(),
3143
- reasoningEncryptedContent: z17.string().nullish()
3166
+ z18.object({
3167
+ itemId: z18.string().nullish(),
3168
+ reasoningEncryptedContent: z18.string().nullish()
3144
3169
  })
3145
3170
  )
3146
3171
  );
@@ -3181,301 +3206,308 @@ import {
3181
3206
  lazyValidator as lazyValidator10,
3182
3207
  zodSchema as zodSchema18
3183
3208
  } from "@ai-sdk/provider-utils";
3184
- import { z as z18 } from "zod/v4";
3209
+ import { z as z19 } from "zod/v4";
3210
+ var openaiResponsesPromptCacheDiagnosticsSchema = () => z19.object({
3211
+ type: z19.string(),
3212
+ reason: z19.string().nullish(),
3213
+ cache_missed_tokens: z19.number().nullish(),
3214
+ comparison_reusable_tokens: z19.number().nullish()
3215
+ });
3185
3216
  var openaiResponsesChunkSchema = lazyValidator10(
3186
3217
  () => zodSchema18(
3187
- z18.union([
3188
- z18.object({
3189
- type: z18.literal("response.output_text.delta"),
3190
- item_id: z18.string(),
3191
- delta: z18.string(),
3192
- logprobs: z18.array(
3193
- z18.object({
3194
- token: z18.string(),
3195
- logprob: z18.number(),
3196
- top_logprobs: z18.array(
3197
- z18.object({
3198
- token: z18.string(),
3199
- logprob: z18.number()
3218
+ z19.union([
3219
+ z19.object({
3220
+ type: z19.literal("response.output_text.delta"),
3221
+ item_id: z19.string(),
3222
+ delta: z19.string(),
3223
+ logprobs: z19.array(
3224
+ z19.object({
3225
+ token: z19.string(),
3226
+ logprob: z19.number(),
3227
+ top_logprobs: z19.array(
3228
+ z19.object({
3229
+ token: z19.string(),
3230
+ logprob: z19.number()
3200
3231
  })
3201
3232
  )
3202
3233
  })
3203
3234
  ).nullish()
3204
3235
  }),
3205
- z18.object({
3206
- type: z18.literal("response.refusal.delta"),
3207
- item_id: z18.string(),
3208
- output_index: z18.number().nullish(),
3209
- content_index: z18.number().nullish(),
3210
- delta: z18.string()
3236
+ z19.object({
3237
+ type: z19.literal("response.refusal.delta"),
3238
+ item_id: z19.string(),
3239
+ output_index: z19.number().nullish(),
3240
+ content_index: z19.number().nullish(),
3241
+ delta: z19.string()
3211
3242
  }),
3212
- z18.object({
3213
- type: z18.literal("response.refusal.done"),
3214
- item_id: z18.string(),
3215
- output_index: z18.number().nullish(),
3216
- content_index: z18.number().nullish(),
3217
- refusal: z18.string()
3243
+ z19.object({
3244
+ type: z19.literal("response.refusal.done"),
3245
+ item_id: z19.string(),
3246
+ output_index: z19.number().nullish(),
3247
+ content_index: z19.number().nullish(),
3248
+ refusal: z19.string()
3218
3249
  }),
3219
- z18.object({
3220
- type: z18.enum(["response.completed", "response.incomplete"]),
3221
- response: z18.object({
3222
- incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3223
- usage: z18.object({
3224
- input_tokens: z18.number(),
3225
- input_tokens_details: z18.object({
3226
- cached_tokens: z18.number().nullish(),
3227
- cache_write_tokens: z18.number().nullish(),
3228
- orchestration_input_tokens: z18.number().nullish(),
3229
- orchestration_input_cached_tokens: z18.number().nullish()
3250
+ z19.object({
3251
+ type: z19.enum(["response.completed", "response.incomplete"]),
3252
+ response: z19.object({
3253
+ prompt_cache_diagnostics: openaiResponsesPromptCacheDiagnosticsSchema().nullish(),
3254
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
3255
+ usage: z19.object({
3256
+ input_tokens: z19.number(),
3257
+ input_tokens_details: z19.object({
3258
+ cached_tokens: z19.number().nullish(),
3259
+ cache_write_tokens: z19.number().nullish(),
3260
+ orchestration_input_tokens: z19.number().nullish(),
3261
+ orchestration_input_cached_tokens: z19.number().nullish()
3230
3262
  }).nullish(),
3231
- output_tokens: z18.number(),
3232
- output_tokens_details: z18.object({
3233
- reasoning_tokens: z18.number().nullish(),
3234
- orchestration_output_tokens: z18.number().nullish()
3263
+ output_tokens: z19.number(),
3264
+ output_tokens_details: z19.object({
3265
+ reasoning_tokens: z19.number().nullish(),
3266
+ orchestration_output_tokens: z19.number().nullish()
3235
3267
  }).nullish()
3236
3268
  }),
3237
- reasoning: z18.object({
3238
- context: z18.string().nullish()
3269
+ reasoning: z19.object({
3270
+ context: z19.string().nullish()
3239
3271
  }).nullish(),
3240
- service_tier: z18.string().nullish()
3272
+ service_tier: z19.string().nullish()
3241
3273
  })
3242
3274
  }),
3243
- z18.object({
3244
- type: z18.literal("response.created"),
3245
- response: z18.object({
3246
- id: z18.string(),
3247
- created_at: z18.number(),
3248
- model: z18.string(),
3249
- service_tier: z18.string().nullish()
3275
+ z19.object({
3276
+ type: z19.literal("response.created"),
3277
+ response: z19.object({
3278
+ id: z19.string(),
3279
+ created_at: z19.number(),
3280
+ model: z19.string(),
3281
+ service_tier: z19.string().nullish()
3250
3282
  })
3251
3283
  }),
3252
- z18.object({
3253
- type: z18.literal("response.output_item.added"),
3254
- output_index: z18.number(),
3255
- item: z18.discriminatedUnion("type", [
3256
- z18.object({
3257
- type: z18.literal("message"),
3258
- id: z18.string(),
3259
- phase: z18.enum(["commentary", "final_answer"]).nullish()
3284
+ z19.object({
3285
+ type: z19.literal("response.output_item.added"),
3286
+ output_index: z19.number(),
3287
+ item: z19.discriminatedUnion("type", [
3288
+ z19.object({
3289
+ type: z19.literal("message"),
3290
+ id: z19.string(),
3291
+ phase: z19.enum(["commentary", "final_answer"]).nullish()
3260
3292
  }),
3261
- z18.object({
3262
- type: z18.literal("reasoning"),
3263
- id: z18.string(),
3264
- encrypted_content: z18.string().nullish()
3293
+ z19.object({
3294
+ type: z19.literal("reasoning"),
3295
+ id: z19.string(),
3296
+ encrypted_content: z19.string().nullish()
3265
3297
  }),
3266
- z18.object({
3267
- type: z18.literal("function_call"),
3268
- id: z18.string(),
3269
- call_id: z18.string(),
3270
- name: z18.string(),
3271
- arguments: z18.string(),
3272
- async: z18.boolean().nullish()
3298
+ z19.object({
3299
+ type: z19.literal("function_call"),
3300
+ id: z19.string(),
3301
+ call_id: z19.string(),
3302
+ name: z19.string(),
3303
+ arguments: z19.string(),
3304
+ async: z19.boolean().nullish()
3273
3305
  }),
3274
- z18.object({
3275
- type: z18.literal("web_search_call"),
3276
- id: z18.string(),
3277
- status: z18.string()
3306
+ z19.object({
3307
+ type: z19.literal("web_search_call"),
3308
+ id: z19.string(),
3309
+ status: z19.string()
3278
3310
  }),
3279
- z18.object({
3280
- type: z18.literal("computer_call"),
3281
- id: z18.string(),
3282
- status: z18.string()
3311
+ z19.object({
3312
+ type: z19.literal("computer_call"),
3313
+ id: z19.string(),
3314
+ status: z19.string()
3283
3315
  }),
3284
- z18.object({
3285
- type: z18.literal("file_search_call"),
3286
- id: z18.string()
3316
+ z19.object({
3317
+ type: z19.literal("file_search_call"),
3318
+ id: z19.string()
3287
3319
  }),
3288
- z18.object({
3289
- type: z18.literal("image_generation_call"),
3290
- id: z18.string()
3320
+ z19.object({
3321
+ type: z19.literal("image_generation_call"),
3322
+ id: z19.string()
3291
3323
  }),
3292
- z18.object({
3293
- type: z18.literal("code_interpreter_call"),
3294
- id: z18.string(),
3295
- container_id: z18.string(),
3296
- code: z18.string().nullable(),
3297
- outputs: z18.array(
3298
- z18.discriminatedUnion("type", [
3299
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3300
- z18.object({ type: z18.literal("image"), url: z18.string() })
3324
+ z19.object({
3325
+ type: z19.literal("code_interpreter_call"),
3326
+ id: z19.string(),
3327
+ container_id: z19.string(),
3328
+ code: z19.string().nullable(),
3329
+ outputs: z19.array(
3330
+ z19.discriminatedUnion("type", [
3331
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3332
+ z19.object({ type: z19.literal("image"), url: z19.string() })
3301
3333
  ])
3302
3334
  ).nullable(),
3303
- status: z18.string()
3335
+ status: z19.string()
3304
3336
  })
3305
3337
  ])
3306
3338
  }),
3307
- z18.object({
3308
- type: z18.literal("response.output_item.done"),
3309
- output_index: z18.number(),
3310
- item: z18.discriminatedUnion("type", [
3311
- z18.object({
3312
- type: z18.literal("message"),
3313
- id: z18.string(),
3314
- phase: z18.enum(["commentary", "final_answer"]).nullish()
3339
+ z19.object({
3340
+ type: z19.literal("response.output_item.done"),
3341
+ output_index: z19.number(),
3342
+ item: z19.discriminatedUnion("type", [
3343
+ z19.object({
3344
+ type: z19.literal("message"),
3345
+ id: z19.string(),
3346
+ phase: z19.enum(["commentary", "final_answer"]).nullish()
3315
3347
  }),
3316
- z18.object({
3317
- type: z18.literal("reasoning"),
3318
- id: z18.string(),
3319
- encrypted_content: z18.string().nullish()
3348
+ z19.object({
3349
+ type: z19.literal("reasoning"),
3350
+ id: z19.string(),
3351
+ encrypted_content: z19.string().nullish()
3320
3352
  }),
3321
- z18.object({
3322
- type: z18.literal("function_call"),
3323
- id: z18.string(),
3324
- call_id: z18.string(),
3325
- name: z18.string(),
3326
- arguments: z18.string(),
3327
- async: z18.boolean().nullish(),
3328
- status: z18.enum(["in_progress", "completed", "incomplete"])
3353
+ z19.object({
3354
+ type: z19.literal("function_call"),
3355
+ id: z19.string(),
3356
+ call_id: z19.string(),
3357
+ name: z19.string(),
3358
+ arguments: z19.string(),
3359
+ async: z19.boolean().nullish(),
3360
+ status: z19.enum(["in_progress", "completed", "incomplete"])
3329
3361
  }),
3330
- z18.object({
3331
- type: z18.literal("code_interpreter_call"),
3332
- id: z18.string(),
3333
- code: z18.string().nullable(),
3334
- container_id: z18.string(),
3335
- outputs: z18.array(
3336
- z18.discriminatedUnion("type", [
3337
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3338
- z18.object({ type: z18.literal("image"), url: z18.string() })
3362
+ z19.object({
3363
+ type: z19.literal("code_interpreter_call"),
3364
+ id: z19.string(),
3365
+ code: z19.string().nullable(),
3366
+ container_id: z19.string(),
3367
+ outputs: z19.array(
3368
+ z19.discriminatedUnion("type", [
3369
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3370
+ z19.object({ type: z19.literal("image"), url: z19.string() })
3339
3371
  ])
3340
3372
  ).nullable()
3341
3373
  }),
3342
- z18.object({
3343
- type: z18.literal("image_generation_call"),
3344
- id: z18.string(),
3345
- result: z18.string()
3374
+ z19.object({
3375
+ type: z19.literal("image_generation_call"),
3376
+ id: z19.string(),
3377
+ result: z19.string()
3346
3378
  }),
3347
- z18.object({
3348
- type: z18.literal("web_search_call"),
3349
- id: z18.string(),
3350
- status: z18.string(),
3351
- action: z18.discriminatedUnion("type", [
3352
- z18.object({
3353
- type: z18.literal("search"),
3354
- query: z18.string().nullish(),
3355
- sources: z18.array(
3356
- z18.discriminatedUnion("type", [
3357
- z18.object({ type: z18.literal("url"), url: z18.string() }),
3358
- z18.object({ type: z18.literal("api"), name: z18.string() })
3379
+ z19.object({
3380
+ type: z19.literal("web_search_call"),
3381
+ id: z19.string(),
3382
+ status: z19.string(),
3383
+ action: z19.discriminatedUnion("type", [
3384
+ z19.object({
3385
+ type: z19.literal("search"),
3386
+ query: z19.string().nullish(),
3387
+ sources: z19.array(
3388
+ z19.discriminatedUnion("type", [
3389
+ z19.object({ type: z19.literal("url"), url: z19.string() }),
3390
+ z19.object({ type: z19.literal("api"), name: z19.string() })
3359
3391
  ])
3360
3392
  ).nullish()
3361
3393
  }),
3362
- z18.object({
3363
- type: z18.literal("open_page"),
3364
- url: z18.string().nullish()
3394
+ z19.object({
3395
+ type: z19.literal("open_page"),
3396
+ url: z19.string().nullish()
3365
3397
  }),
3366
- z18.object({
3367
- type: z18.literal("find_in_page"),
3368
- url: z18.string().nullish(),
3369
- pattern: z18.string().nullish()
3398
+ z19.object({
3399
+ type: z19.literal("find_in_page"),
3400
+ url: z19.string().nullish(),
3401
+ pattern: z19.string().nullish()
3370
3402
  })
3371
3403
  ]).nullish()
3372
3404
  }),
3373
- z18.object({
3374
- type: z18.literal("file_search_call"),
3375
- id: z18.string(),
3376
- queries: z18.array(z18.string()),
3377
- results: z18.array(
3378
- z18.object({
3379
- attributes: z18.record(z18.string(), z18.unknown()),
3380
- file_id: z18.string(),
3381
- filename: z18.string(),
3382
- score: z18.number(),
3383
- text: z18.string()
3405
+ z19.object({
3406
+ type: z19.literal("file_search_call"),
3407
+ id: z19.string(),
3408
+ queries: z19.array(z19.string()),
3409
+ results: z19.array(
3410
+ z19.object({
3411
+ attributes: z19.record(z19.string(), z19.unknown()),
3412
+ file_id: z19.string(),
3413
+ filename: z19.string(),
3414
+ score: z19.number(),
3415
+ text: z19.string()
3384
3416
  })
3385
3417
  ).nullish()
3386
3418
  }),
3387
- z18.object({
3388
- type: z18.literal("local_shell_call"),
3389
- id: z18.string(),
3390
- call_id: z18.string(),
3391
- action: z18.object({
3392
- type: z18.literal("exec"),
3393
- command: z18.array(z18.string()),
3394
- timeout_ms: z18.number().optional(),
3395
- user: z18.string().optional(),
3396
- working_directory: z18.string().optional(),
3397
- env: z18.record(z18.string(), z18.string()).optional()
3419
+ z19.object({
3420
+ type: z19.literal("local_shell_call"),
3421
+ id: z19.string(),
3422
+ call_id: z19.string(),
3423
+ action: z19.object({
3424
+ type: z19.literal("exec"),
3425
+ command: z19.array(z19.string()),
3426
+ timeout_ms: z19.number().optional(),
3427
+ user: z19.string().optional(),
3428
+ working_directory: z19.string().optional(),
3429
+ env: z19.record(z19.string(), z19.string()).optional()
3398
3430
  })
3399
3431
  }),
3400
- z18.object({
3401
- type: z18.literal("computer_call"),
3402
- id: z18.string(),
3403
- status: z18.literal("completed")
3432
+ z19.object({
3433
+ type: z19.literal("computer_call"),
3434
+ id: z19.string(),
3435
+ status: z19.literal("completed")
3404
3436
  })
3405
3437
  ])
3406
3438
  }),
3407
- z18.object({
3408
- type: z18.literal("response.function_call_arguments.delta"),
3409
- item_id: z18.string(),
3410
- output_index: z18.number(),
3411
- delta: z18.string()
3439
+ z19.object({
3440
+ type: z19.literal("response.function_call_arguments.delta"),
3441
+ item_id: z19.string(),
3442
+ output_index: z19.number(),
3443
+ delta: z19.string()
3412
3444
  }),
3413
- z18.object({
3414
- type: z18.literal("response.image_generation_call.partial_image"),
3415
- item_id: z18.string(),
3416
- output_index: z18.number(),
3417
- partial_image_b64: z18.string()
3445
+ z19.object({
3446
+ type: z19.literal("response.image_generation_call.partial_image"),
3447
+ item_id: z19.string(),
3448
+ output_index: z19.number(),
3449
+ partial_image_b64: z19.string()
3418
3450
  }),
3419
- z18.object({
3420
- type: z18.literal("response.code_interpreter_call_code.delta"),
3421
- item_id: z18.string(),
3422
- output_index: z18.number(),
3423
- delta: z18.string()
3451
+ z19.object({
3452
+ type: z19.literal("response.code_interpreter_call_code.delta"),
3453
+ item_id: z19.string(),
3454
+ output_index: z19.number(),
3455
+ delta: z19.string()
3424
3456
  }),
3425
- z18.object({
3426
- type: z18.literal("response.code_interpreter_call_code.done"),
3427
- item_id: z18.string(),
3428
- output_index: z18.number(),
3429
- code: z18.string()
3457
+ z19.object({
3458
+ type: z19.literal("response.code_interpreter_call_code.done"),
3459
+ item_id: z19.string(),
3460
+ output_index: z19.number(),
3461
+ code: z19.string()
3430
3462
  }),
3431
- z18.object({
3432
- type: z18.literal("response.output_text.annotation.added"),
3433
- annotation: z18.discriminatedUnion("type", [
3434
- z18.object({
3435
- type: z18.literal("url_citation"),
3436
- start_index: z18.number(),
3437
- end_index: z18.number(),
3438
- url: z18.string(),
3439
- title: z18.string()
3463
+ z19.object({
3464
+ type: z19.literal("response.output_text.annotation.added"),
3465
+ annotation: z19.discriminatedUnion("type", [
3466
+ z19.object({
3467
+ type: z19.literal("url_citation"),
3468
+ start_index: z19.number(),
3469
+ end_index: z19.number(),
3470
+ url: z19.string(),
3471
+ title: z19.string()
3440
3472
  }),
3441
- z18.object({
3442
- type: z18.literal("file_citation"),
3443
- file_id: z18.string(),
3444
- filename: z18.string().nullish(),
3445
- index: z18.number().nullish(),
3446
- start_index: z18.number().nullish(),
3447
- end_index: z18.number().nullish(),
3448
- quote: z18.string().nullish()
3473
+ z19.object({
3474
+ type: z19.literal("file_citation"),
3475
+ file_id: z19.string(),
3476
+ filename: z19.string().nullish(),
3477
+ index: z19.number().nullish(),
3478
+ start_index: z19.number().nullish(),
3479
+ end_index: z19.number().nullish(),
3480
+ quote: z19.string().nullish()
3449
3481
  })
3450
3482
  ])
3451
3483
  }),
3452
- z18.object({
3453
- type: z18.literal("response.reasoning_summary_part.added"),
3454
- item_id: z18.string(),
3455
- summary_index: z18.number()
3484
+ z19.object({
3485
+ type: z19.literal("response.reasoning_summary_part.added"),
3486
+ item_id: z19.string(),
3487
+ summary_index: z19.number()
3456
3488
  }),
3457
- z18.object({
3458
- type: z18.literal("response.reasoning_summary_text.delta"),
3459
- item_id: z18.string(),
3460
- summary_index: z18.number(),
3461
- delta: z18.string()
3489
+ z19.object({
3490
+ type: z19.literal("response.reasoning_summary_text.delta"),
3491
+ item_id: z19.string(),
3492
+ summary_index: z19.number(),
3493
+ delta: z19.string()
3462
3494
  }),
3463
- z18.object({
3464
- type: z18.literal("response.reasoning_summary_part.done"),
3465
- item_id: z18.string(),
3466
- summary_index: z18.number()
3495
+ z19.object({
3496
+ type: z19.literal("response.reasoning_summary_part.done"),
3497
+ item_id: z19.string(),
3498
+ summary_index: z19.number()
3467
3499
  }),
3468
- z18.object({
3469
- type: z18.literal("error"),
3470
- sequence_number: z18.number(),
3471
- error: z18.object({
3472
- type: z18.string(),
3473
- code: z18.string(),
3474
- message: z18.string(),
3475
- param: z18.string().nullish()
3500
+ z19.object({
3501
+ type: z19.literal("error"),
3502
+ sequence_number: z19.number(),
3503
+ error: z19.object({
3504
+ type: z19.string(),
3505
+ code: z19.string(),
3506
+ message: z19.string(),
3507
+ param: z19.string().nullish()
3476
3508
  })
3477
3509
  }),
3478
- z18.object({ type: z18.string() }).loose().transform((value) => ({
3510
+ z19.object({ type: z19.string() }).loose().transform((value) => ({
3479
3511
  type: "unknown_chunk",
3480
3512
  message: value.type
3481
3513
  }))
@@ -3485,202 +3517,203 @@ var openaiResponsesChunkSchema = lazyValidator10(
3485
3517
  );
3486
3518
  var openaiResponsesResponseSchema = lazyValidator10(
3487
3519
  () => zodSchema18(
3488
- z18.object({
3489
- id: z18.string().optional(),
3490
- created_at: z18.number().optional(),
3491
- error: z18.object({
3492
- message: z18.string(),
3493
- type: z18.string(),
3494
- param: z18.string().nullish(),
3495
- code: z18.string()
3520
+ z19.object({
3521
+ id: z19.string().optional(),
3522
+ created_at: z19.number().optional(),
3523
+ error: z19.object({
3524
+ message: z19.string(),
3525
+ type: z19.string(),
3526
+ param: z19.string().nullish(),
3527
+ code: z19.string()
3496
3528
  }).nullish(),
3497
- model: z18.string().optional(),
3498
- output: z18.array(
3499
- z18.discriminatedUnion("type", [
3500
- z18.object({
3501
- type: z18.literal("message"),
3502
- role: z18.literal("assistant"),
3503
- id: z18.string(),
3504
- phase: z18.enum(["commentary", "final_answer"]).nullish(),
3529
+ model: z19.string().optional(),
3530
+ output: z19.array(
3531
+ z19.discriminatedUnion("type", [
3532
+ z19.object({
3533
+ type: z19.literal("message"),
3534
+ role: z19.literal("assistant"),
3535
+ id: z19.string(),
3536
+ phase: z19.enum(["commentary", "final_answer"]).nullish(),
3505
3537
  // the API returns either text or a refusal as content parts:
3506
- content: z18.array(
3507
- z18.discriminatedUnion("type", [
3508
- z18.object({
3509
- type: z18.literal("output_text"),
3510
- text: z18.string(),
3511
- logprobs: z18.array(
3512
- z18.object({
3513
- token: z18.string(),
3514
- logprob: z18.number(),
3515
- top_logprobs: z18.array(
3516
- z18.object({
3517
- token: z18.string(),
3518
- logprob: z18.number()
3538
+ content: z19.array(
3539
+ z19.discriminatedUnion("type", [
3540
+ z19.object({
3541
+ type: z19.literal("output_text"),
3542
+ text: z19.string(),
3543
+ logprobs: z19.array(
3544
+ z19.object({
3545
+ token: z19.string(),
3546
+ logprob: z19.number(),
3547
+ top_logprobs: z19.array(
3548
+ z19.object({
3549
+ token: z19.string(),
3550
+ logprob: z19.number()
3519
3551
  })
3520
3552
  )
3521
3553
  })
3522
3554
  ).nullish(),
3523
- annotations: z18.array(
3524
- z18.discriminatedUnion("type", [
3525
- z18.object({
3526
- type: z18.literal("url_citation"),
3527
- start_index: z18.number(),
3528
- end_index: z18.number(),
3529
- url: z18.string(),
3530
- title: z18.string()
3555
+ annotations: z19.array(
3556
+ z19.discriminatedUnion("type", [
3557
+ z19.object({
3558
+ type: z19.literal("url_citation"),
3559
+ start_index: z19.number(),
3560
+ end_index: z19.number(),
3561
+ url: z19.string(),
3562
+ title: z19.string()
3531
3563
  }),
3532
- z18.object({
3533
- type: z18.literal("file_citation"),
3534
- file_id: z18.string(),
3535
- filename: z18.string().nullish(),
3536
- index: z18.number().nullish(),
3537
- start_index: z18.number().nullish(),
3538
- end_index: z18.number().nullish(),
3539
- quote: z18.string().nullish()
3564
+ z19.object({
3565
+ type: z19.literal("file_citation"),
3566
+ file_id: z19.string(),
3567
+ filename: z19.string().nullish(),
3568
+ index: z19.number().nullish(),
3569
+ start_index: z19.number().nullish(),
3570
+ end_index: z19.number().nullish(),
3571
+ quote: z19.string().nullish()
3540
3572
  }),
3541
- z18.object({
3542
- type: z18.literal("container_file_citation"),
3543
- container_id: z18.string(),
3544
- file_id: z18.string(),
3545
- filename: z18.string().nullish(),
3546
- start_index: z18.number().nullish(),
3547
- end_index: z18.number().nullish(),
3548
- index: z18.number().nullish()
3573
+ z19.object({
3574
+ type: z19.literal("container_file_citation"),
3575
+ container_id: z19.string(),
3576
+ file_id: z19.string(),
3577
+ filename: z19.string().nullish(),
3578
+ start_index: z19.number().nullish(),
3579
+ end_index: z19.number().nullish(),
3580
+ index: z19.number().nullish()
3549
3581
  }),
3550
- z18.object({
3551
- type: z18.literal("file_path"),
3552
- file_id: z18.string(),
3553
- index: z18.number().nullish()
3582
+ z19.object({
3583
+ type: z19.literal("file_path"),
3584
+ file_id: z19.string(),
3585
+ index: z19.number().nullish()
3554
3586
  })
3555
3587
  ])
3556
3588
  )
3557
3589
  }),
3558
- z18.object({
3559
- type: z18.literal("refusal"),
3560
- refusal: z18.string()
3590
+ z19.object({
3591
+ type: z19.literal("refusal"),
3592
+ refusal: z19.string()
3561
3593
  })
3562
3594
  ])
3563
3595
  )
3564
3596
  }),
3565
- z18.object({
3566
- type: z18.literal("web_search_call"),
3567
- id: z18.string(),
3568
- status: z18.string(),
3569
- action: z18.discriminatedUnion("type", [
3570
- z18.object({
3571
- type: z18.literal("search"),
3572
- query: z18.string().nullish(),
3573
- sources: z18.array(
3574
- z18.discriminatedUnion("type", [
3575
- z18.object({ type: z18.literal("url"), url: z18.string() }),
3576
- z18.object({
3577
- type: z18.literal("api"),
3578
- name: z18.string()
3597
+ z19.object({
3598
+ type: z19.literal("web_search_call"),
3599
+ id: z19.string(),
3600
+ status: z19.string(),
3601
+ action: z19.discriminatedUnion("type", [
3602
+ z19.object({
3603
+ type: z19.literal("search"),
3604
+ query: z19.string().nullish(),
3605
+ sources: z19.array(
3606
+ z19.discriminatedUnion("type", [
3607
+ z19.object({ type: z19.literal("url"), url: z19.string() }),
3608
+ z19.object({
3609
+ type: z19.literal("api"),
3610
+ name: z19.string()
3579
3611
  })
3580
3612
  ])
3581
3613
  ).nullish()
3582
3614
  }),
3583
- z18.object({
3584
- type: z18.literal("open_page"),
3585
- url: z18.string().nullish()
3615
+ z19.object({
3616
+ type: z19.literal("open_page"),
3617
+ url: z19.string().nullish()
3586
3618
  }),
3587
- z18.object({
3588
- type: z18.literal("find_in_page"),
3589
- url: z18.string().nullish(),
3590
- pattern: z18.string().nullish()
3619
+ z19.object({
3620
+ type: z19.literal("find_in_page"),
3621
+ url: z19.string().nullish(),
3622
+ pattern: z19.string().nullish()
3591
3623
  })
3592
3624
  ]).nullish()
3593
3625
  }),
3594
- z18.object({
3595
- type: z18.literal("file_search_call"),
3596
- id: z18.string(),
3597
- queries: z18.array(z18.string()),
3598
- results: z18.array(
3599
- z18.object({
3600
- attributes: z18.record(
3601
- z18.string(),
3602
- z18.union([z18.string(), z18.number(), z18.boolean()])
3626
+ z19.object({
3627
+ type: z19.literal("file_search_call"),
3628
+ id: z19.string(),
3629
+ queries: z19.array(z19.string()),
3630
+ results: z19.array(
3631
+ z19.object({
3632
+ attributes: z19.record(
3633
+ z19.string(),
3634
+ z19.union([z19.string(), z19.number(), z19.boolean()])
3603
3635
  ),
3604
- file_id: z18.string(),
3605
- filename: z18.string(),
3606
- score: z18.number(),
3607
- text: z18.string()
3636
+ file_id: z19.string(),
3637
+ filename: z19.string(),
3638
+ score: z19.number(),
3639
+ text: z19.string()
3608
3640
  })
3609
3641
  ).nullish()
3610
3642
  }),
3611
- z18.object({
3612
- type: z18.literal("code_interpreter_call"),
3613
- id: z18.string(),
3614
- code: z18.string().nullable(),
3615
- container_id: z18.string(),
3616
- outputs: z18.array(
3617
- z18.discriminatedUnion("type", [
3618
- z18.object({ type: z18.literal("logs"), logs: z18.string() }),
3619
- z18.object({ type: z18.literal("image"), url: z18.string() })
3643
+ z19.object({
3644
+ type: z19.literal("code_interpreter_call"),
3645
+ id: z19.string(),
3646
+ code: z19.string().nullable(),
3647
+ container_id: z19.string(),
3648
+ outputs: z19.array(
3649
+ z19.discriminatedUnion("type", [
3650
+ z19.object({ type: z19.literal("logs"), logs: z19.string() }),
3651
+ z19.object({ type: z19.literal("image"), url: z19.string() })
3620
3652
  ])
3621
3653
  ).nullable()
3622
3654
  }),
3623
- z18.object({
3624
- type: z18.literal("image_generation_call"),
3625
- id: z18.string(),
3626
- result: z18.string()
3655
+ z19.object({
3656
+ type: z19.literal("image_generation_call"),
3657
+ id: z19.string(),
3658
+ result: z19.string()
3627
3659
  }),
3628
- z18.object({
3629
- type: z18.literal("local_shell_call"),
3630
- id: z18.string(),
3631
- call_id: z18.string(),
3632
- action: z18.object({
3633
- type: z18.literal("exec"),
3634
- command: z18.array(z18.string()),
3635
- timeout_ms: z18.number().optional(),
3636
- user: z18.string().optional(),
3637
- working_directory: z18.string().optional(),
3638
- env: z18.record(z18.string(), z18.string()).optional()
3660
+ z19.object({
3661
+ type: z19.literal("local_shell_call"),
3662
+ id: z19.string(),
3663
+ call_id: z19.string(),
3664
+ action: z19.object({
3665
+ type: z19.literal("exec"),
3666
+ command: z19.array(z19.string()),
3667
+ timeout_ms: z19.number().optional(),
3668
+ user: z19.string().optional(),
3669
+ working_directory: z19.string().optional(),
3670
+ env: z19.record(z19.string(), z19.string()).optional()
3639
3671
  })
3640
3672
  }),
3641
- z18.object({
3642
- type: z18.literal("function_call"),
3643
- call_id: z18.string(),
3644
- name: z18.string(),
3645
- arguments: z18.string(),
3646
- id: z18.string(),
3647
- async: z18.boolean().nullish()
3673
+ z19.object({
3674
+ type: z19.literal("function_call"),
3675
+ call_id: z19.string(),
3676
+ name: z19.string(),
3677
+ arguments: z19.string(),
3678
+ id: z19.string(),
3679
+ async: z19.boolean().nullish()
3648
3680
  }),
3649
- z18.object({
3650
- type: z18.literal("computer_call"),
3651
- id: z18.string(),
3652
- status: z18.string().optional()
3681
+ z19.object({
3682
+ type: z19.literal("computer_call"),
3683
+ id: z19.string(),
3684
+ status: z19.string().optional()
3653
3685
  }),
3654
- z18.object({
3655
- type: z18.literal("reasoning"),
3656
- id: z18.string(),
3657
- encrypted_content: z18.string().nullish(),
3658
- summary: z18.array(
3659
- z18.object({
3660
- type: z18.literal("summary_text"),
3661
- text: z18.string()
3686
+ z19.object({
3687
+ type: z19.literal("reasoning"),
3688
+ id: z19.string(),
3689
+ encrypted_content: z19.string().nullish(),
3690
+ summary: z19.array(
3691
+ z19.object({
3692
+ type: z19.literal("summary_text"),
3693
+ text: z19.string()
3662
3694
  })
3663
3695
  )
3664
3696
  })
3665
3697
  ])
3666
3698
  ).optional(),
3667
- service_tier: z18.string().nullish(),
3668
- reasoning: z18.object({
3669
- context: z18.string().nullish()
3699
+ service_tier: z19.string().nullish(),
3700
+ prompt_cache_diagnostics: openaiResponsesPromptCacheDiagnosticsSchema().nullish(),
3701
+ reasoning: z19.object({
3702
+ context: z19.string().nullish()
3670
3703
  }).nullish(),
3671
- incomplete_details: z18.object({ reason: z18.string() }).nullish(),
3672
- usage: z18.object({
3673
- input_tokens: z18.number(),
3674
- input_tokens_details: z18.object({
3675
- cached_tokens: z18.number().nullish(),
3676
- cache_write_tokens: z18.number().nullish(),
3677
- orchestration_input_tokens: z18.number().nullish(),
3678
- orchestration_input_cached_tokens: z18.number().nullish()
3704
+ incomplete_details: z19.object({ reason: z19.string() }).nullish(),
3705
+ usage: z19.object({
3706
+ input_tokens: z19.number(),
3707
+ input_tokens_details: z19.object({
3708
+ cached_tokens: z19.number().nullish(),
3709
+ cache_write_tokens: z19.number().nullish(),
3710
+ orchestration_input_tokens: z19.number().nullish(),
3711
+ orchestration_input_cached_tokens: z19.number().nullish()
3679
3712
  }).nullish(),
3680
- output_tokens: z18.number(),
3681
- output_tokens_details: z18.object({
3682
- reasoning_tokens: z18.number().nullish(),
3683
- orchestration_output_tokens: z18.number().nullish()
3713
+ output_tokens: z19.number(),
3714
+ output_tokens_details: z19.object({
3715
+ reasoning_tokens: z19.number().nullish(),
3716
+ orchestration_output_tokens: z19.number().nullish()
3684
3717
  }).nullish()
3685
3718
  }).optional()
3686
3719
  })
@@ -3866,10 +3899,10 @@ function getConfigurationUpdateUnsupportedReason({
3866
3899
  options
3867
3900
  }) {
3868
3901
  if (!modelCapabilities.supportsConfigurationUpdate) {
3869
- return "reasoningEffortUpdate is only supported by GPT-6 and later models";
3902
+ return "Configuration updates are only supported by GPT-6 and later models";
3870
3903
  }
3871
3904
  if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
3872
- return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
3905
+ return "Configuration updates require standard reasoning mode without automatic truncation";
3873
3906
  }
3874
3907
  return void 0;
3875
3908
  }
@@ -3901,7 +3934,7 @@ var OpenAIResponsesLanguageModel = class {
3901
3934
  toolChoice,
3902
3935
  responseFormat
3903
3936
  }) {
3904
- var _a2, _b, _c, _d, _e, _f;
3937
+ var _a2, _b, _c, _d, _e, _f, _g;
3905
3938
  const warnings = [];
3906
3939
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
3907
3940
  if (topK != null) {
@@ -3977,7 +4010,7 @@ var OpenAIResponsesLanguageModel = class {
3977
4010
  });
3978
4011
  } else if (reasoningEffortUpdate != null) {
3979
4012
  const firstItem = input[0];
3980
- if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
4013
+ if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || ((_c = firstItem.reasoning) == null ? void 0 : _c.effort) !== reasoningEffortUpdate) {
3981
4014
  input.unshift({
3982
4015
  type: "configuration_update",
3983
4016
  reasoning: { effort: reasoningEffortUpdate }
@@ -3987,11 +4020,13 @@ var OpenAIResponsesLanguageModel = class {
3987
4020
  for (let i = 1; i < input.length; i++) {
3988
4021
  if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
3989
4022
  throw new UnsupportedFunctionalityError6({
3990
- functionality: "Adjacent reasoning effort configuration updates"
4023
+ functionality: "Adjacent configuration updates",
4024
+ message: "Configuration updates cannot be consecutive. Set reasoningEffortUpdate and textFormatUpdate in the same empty system message, and omit request-level reasoningEffortUpdate when using message-level updates."
3991
4025
  });
3992
4026
  }
3993
4027
  }
3994
- const strictJsonSchema = (_c = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _c : false;
4028
+ const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : false;
4029
+ const requestTextFormat = openaiOptions == null ? void 0 : openaiOptions.textFormat;
3995
4030
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
3996
4031
  function addInclude(key) {
3997
4032
  if (include == null) {
@@ -4025,13 +4060,13 @@ var OpenAIResponsesLanguageModel = class {
4025
4060
  temperature,
4026
4061
  top_p: topP,
4027
4062
  max_output_tokens: maxOutputTokens,
4028
- ...((responseFormat == null ? void 0 : responseFormat.type) === "json" || (openaiOptions == null ? void 0 : openaiOptions.textVerbosity)) && {
4063
+ ...((responseFormat == null ? void 0 : responseFormat.type) === "json" || requestTextFormat != null || (openaiOptions == null ? void 0 : openaiOptions.textVerbosity)) && {
4029
4064
  text: {
4030
- ...(responseFormat == null ? void 0 : responseFormat.type) === "json" && {
4065
+ ...requestTextFormat != null ? { format: requestTextFormat } : (responseFormat == null ? void 0 : responseFormat.type) === "json" && {
4031
4066
  format: responseFormat.schema != null ? {
4032
4067
  type: "json_schema",
4033
4068
  strict: strictJsonSchema,
4034
- name: (_d = responseFormat.name) != null ? _d : "response",
4069
+ name: (_e = responseFormat.name) != null ? _e : "response",
4035
4070
  description: responseFormat.description,
4036
4071
  schema: responseFormat.schema
4037
4072
  } : { type: "json_object" }
@@ -4053,7 +4088,11 @@ var OpenAIResponsesLanguageModel = class {
4053
4088
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
4054
4089
  include,
4055
4090
  prompt_cache_key: openaiOptions == null ? void 0 : openaiOptions.promptCacheKey,
4056
- prompt_cache_options: openaiOptions == null ? void 0 : openaiOptions.promptCacheOptions,
4091
+ prompt_cache_options: (openaiOptions == null ? void 0 : openaiOptions.promptCacheOptions) && {
4092
+ mode: openaiOptions.promptCacheOptions.mode,
4093
+ ttl: openaiOptions.promptCacheOptions.ttl,
4094
+ comparison_response_id: openaiOptions.promptCacheOptions.comparisonResponseId
4095
+ },
4057
4096
  prompt_cache_retention: openaiOptions == null ? void 0 : openaiOptions.promptCacheRetention,
4058
4097
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
4059
4098
  top_logprobs: topLogprobs,
@@ -4102,9 +4141,9 @@ var OpenAIResponsesLanguageModel = class {
4102
4141
  details: "topP is not supported for reasoning models"
4103
4142
  });
4104
4143
  }
4105
- if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_e = baseArgs.include) == null ? void 0 : _e.includes("message.output_text.logprobs")))) {
4144
+ if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_f = baseArgs.include) == null ? void 0 : _f.includes("message.output_text.logprobs")))) {
4106
4145
  baseArgs.top_logprobs = void 0;
4107
- const filteredInclude = (_f = baseArgs.include) == null ? void 0 : _f.filter(
4146
+ const filteredInclude = (_g = baseArgs.include) == null ? void 0 : _g.filter(
4108
4147
  (value) => value !== "message.output_text.logprobs"
4109
4148
  );
4110
4149
  baseArgs.include = filteredInclude != null && filteredInclude.length > 0 ? filteredInclude : void 0;
@@ -4480,6 +4519,9 @@ var OpenAIResponsesLanguageModel = class {
4480
4519
  if (logprobs.length > 0) {
4481
4520
  providerMetadata[providerKey].logprobs = logprobs;
4482
4521
  }
4522
+ if (response.prompt_cache_diagnostics != null) {
4523
+ providerMetadata[providerKey].promptCacheDiagnostics = response.prompt_cache_diagnostics;
4524
+ }
4483
4525
  if (typeof response.service_tier === "string") {
4484
4526
  providerMetadata[providerKey].serviceTier = response.service_tier;
4485
4527
  }
@@ -4559,6 +4601,7 @@ var OpenAIResponsesLanguageModel = class {
4559
4601
  const activeReasoning = {};
4560
4602
  let serviceTier;
4561
4603
  let reasoningContext;
4604
+ let promptCacheDiagnostics;
4562
4605
  let responsesUsage;
4563
4606
  return {
4564
4607
  stream: response.pipeThrough(
@@ -4567,7 +4610,7 @@ var OpenAIResponsesLanguageModel = class {
4567
4610
  controller.enqueue({ type: "stream-start", warnings });
4568
4611
  },
4569
4612
  transform(chunk, controller) {
4570
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
4613
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
4571
4614
  if (options.includeRawChunks) {
4572
4615
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
4573
4616
  }
@@ -4960,20 +5003,21 @@ var OpenAIResponsesLanguageModel = class {
4960
5003
  activeReasoning[value.item_id].summaryParts[value.summary_index] = "can-conclude";
4961
5004
  }
4962
5005
  } else if (isResponseFinishedChunk(value)) {
5006
+ promptCacheDiagnostics = (_k = value.response.prompt_cache_diagnostics) != null ? _k : void 0;
4963
5007
  finishReason = mapOpenAIResponseFinishReason({
4964
- finishReason: (_k = value.response.incomplete_details) == null ? void 0 : _k.reason,
5008
+ finishReason: (_l = value.response.incomplete_details) == null ? void 0 : _l.reason,
4965
5009
  hasFunctionCall,
4966
5010
  hasRefusal
4967
5011
  });
4968
5012
  usage.inputTokens = value.response.usage.input_tokens;
4969
5013
  usage.outputTokens = value.response.usage.output_tokens;
4970
5014
  usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
4971
- usage.reasoningTokens = (_m = (_l = value.response.usage.output_tokens_details) == null ? void 0 : _l.reasoning_tokens) != null ? _m : void 0;
4972
- usage.cachedInputTokens = (_o = (_n = value.response.usage.input_tokens_details) == null ? void 0 : _n.cached_tokens) != null ? _o : void 0;
5015
+ usage.reasoningTokens = (_n = (_m = value.response.usage.output_tokens_details) == null ? void 0 : _m.reasoning_tokens) != null ? _n : void 0;
5016
+ usage.cachedInputTokens = (_p = (_o = value.response.usage.input_tokens_details) == null ? void 0 : _o.cached_tokens) != null ? _p : void 0;
4973
5017
  if (typeof value.response.service_tier === "string") {
4974
5018
  serviceTier = value.response.service_tier;
4975
5019
  }
4976
- if (((_p = value.response.reasoning) == null ? void 0 : _p.context) != null) {
5020
+ if (((_q = value.response.reasoning) == null ? void 0 : _q.context) != null) {
4977
5021
  reasoningContext = value.response.reasoning.context;
4978
5022
  }
4979
5023
  responsesUsage = getResponsesUsageMetadata(value.response.usage);
@@ -4983,7 +5027,7 @@ var OpenAIResponsesLanguageModel = class {
4983
5027
  controller.enqueue({
4984
5028
  type: "source",
4985
5029
  sourceType: "url",
4986
- id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : generateId2(),
5030
+ id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2(),
4987
5031
  url: value.annotation.url,
4988
5032
  title: value.annotation.title
4989
5033
  });
@@ -4991,10 +5035,10 @@ var OpenAIResponsesLanguageModel = class {
4991
5035
  controller.enqueue({
4992
5036
  type: "source",
4993
5037
  sourceType: "document",
4994
- id: (_v = (_u = (_t = self.config).generateId) == null ? void 0 : _u.call(_t)) != null ? _v : generateId2(),
5038
+ id: (_w = (_v = (_u = self.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2(),
4995
5039
  mediaType: "text/plain",
4996
- title: (_x = (_w = value.annotation.quote) != null ? _w : value.annotation.filename) != null ? _x : "Document",
4997
- filename: (_y = value.annotation.filename) != null ? _y : value.annotation.file_id,
5040
+ title: (_y = (_x = value.annotation.quote) != null ? _x : value.annotation.filename) != null ? _y : "Document",
5041
+ filename: (_z = value.annotation.filename) != null ? _z : value.annotation.file_id,
4998
5042
  ...value.annotation.file_id ? {
4999
5043
  providerMetadata: {
5000
5044
  [providerKey]: {
@@ -5023,6 +5067,9 @@ var OpenAIResponsesLanguageModel = class {
5023
5067
  if (reasoningContext !== void 0) {
5024
5068
  providerMetadata[providerKey].reasoningContext = reasoningContext;
5025
5069
  }
5070
+ if (promptCacheDiagnostics !== void 0) {
5071
+ providerMetadata[providerKey].promptCacheDiagnostics = promptCacheDiagnostics;
5072
+ }
5026
5073
  if (responsesUsage != null) {
5027
5074
  providerMetadata[providerKey].usage = responsesUsage;
5028
5075
  }
@@ -5138,12 +5185,12 @@ import {
5138
5185
  lazyValidator as lazyValidator11,
5139
5186
  zodSchema as zodSchema19
5140
5187
  } from "@ai-sdk/provider-utils";
5141
- import { z as z19 } from "zod/v4";
5188
+ import { z as z20 } from "zod/v4";
5142
5189
  var openaiSpeechProviderOptionsSchema = lazyValidator11(
5143
5190
  () => zodSchema19(
5144
- z19.object({
5145
- instructions: z19.string().nullish(),
5146
- speed: z19.number().min(0.25).max(4).default(1).nullish()
5191
+ z20.object({
5192
+ instructions: z20.string().nullish(),
5193
+ speed: z20.number().min(0.25).max(4).default(1).nullish()
5147
5194
  })
5148
5195
  )
5149
5196
  );
@@ -5261,38 +5308,38 @@ import {
5261
5308
 
5262
5309
  // src/transcription/openai-transcription-api.ts
5263
5310
  import { lazyValidator as lazyValidator12, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
5264
- import { z as z20 } from "zod/v4";
5311
+ import { z as z21 } from "zod/v4";
5265
5312
  var openaiTranscriptionResponseSchema = lazyValidator12(
5266
5313
  () => zodSchema20(
5267
- z20.object({
5268
- text: z20.string(),
5269
- language: z20.string().nullish(),
5270
- duration: z20.number().nullish(),
5271
- words: z20.array(
5272
- z20.object({
5273
- word: z20.string(),
5274
- start: z20.number(),
5275
- end: z20.number()
5314
+ z21.object({
5315
+ text: z21.string(),
5316
+ language: z21.string().nullish(),
5317
+ duration: z21.number().nullish(),
5318
+ words: z21.array(
5319
+ z21.object({
5320
+ word: z21.string(),
5321
+ start: z21.number(),
5322
+ end: z21.number()
5276
5323
  })
5277
5324
  ).nullish(),
5278
- segments: z20.array(
5279
- z20.object({
5280
- id: z20.number(),
5281
- seek: z20.number(),
5282
- start: z20.number(),
5283
- end: z20.number(),
5284
- text: z20.string(),
5285
- tokens: z20.array(z20.number()),
5286
- temperature: z20.number(),
5287
- avg_logprob: z20.number(),
5288
- compression_ratio: z20.number(),
5289
- no_speech_prob: z20.number()
5325
+ segments: z21.array(
5326
+ z21.object({
5327
+ id: z21.number(),
5328
+ seek: z21.number(),
5329
+ start: z21.number(),
5330
+ end: z21.number(),
5331
+ text: z21.string(),
5332
+ tokens: z21.array(z21.number()),
5333
+ temperature: z21.number(),
5334
+ avg_logprob: z21.number(),
5335
+ compression_ratio: z21.number(),
5336
+ no_speech_prob: z21.number()
5290
5337
  })
5291
5338
  ).nullish(),
5292
5339
  // Lenient: an unexpected usage shape must not fail the transcription.
5293
- usage: z20.object({
5294
- type: z20.string().nullish(),
5295
- seconds: z20.number().nullish()
5340
+ usage: z21.object({
5341
+ type: z21.string().nullish(),
5342
+ seconds: z21.number().nullish()
5296
5343
  }).nullish().catch(void 0)
5297
5344
  })
5298
5345
  )
@@ -5303,42 +5350,42 @@ import {
5303
5350
  lazyValidator as lazyValidator13,
5304
5351
  zodSchema as zodSchema21
5305
5352
  } from "@ai-sdk/provider-utils";
5306
- import { z as z21 } from "zod/v4";
5353
+ import { z as z22 } from "zod/v4";
5307
5354
  var openAITranscriptionProviderOptions = lazyValidator13(
5308
5355
  () => zodSchema21(
5309
- z21.object({
5356
+ z22.object({
5310
5357
  /**
5311
5358
  * Additional information to include in the transcription response.
5312
5359
  */
5313
- include: z21.array(z21.string()).optional(),
5360
+ include: z22.array(z22.string()).optional(),
5314
5361
  /**
5315
5362
  * The language of the input audio in ISO-639-1 format.
5316
5363
  */
5317
- language: z21.string().optional(),
5364
+ language: z22.string().optional(),
5318
5365
  /**
5319
5366
  * Expected languages for REST transcription, e.g. with gpt-transcribe.
5320
5367
  * Use this instead of language. The API validates model support.
5321
5368
  */
5322
- languages: z21.array(z21.string()).optional(),
5369
+ languages: z22.array(z22.string()).optional(),
5323
5370
  /**
5324
5371
  * Vocabulary hints for REST transcription, e.g. names or technical terms.
5325
5372
  * The API validates model support.
5326
5373
  */
5327
- keywords: z21.array(z21.string()).optional(),
5374
+ keywords: z22.array(z22.string()).optional(),
5328
5375
  /**
5329
5376
  * An optional text to guide the model's style or continue a previous audio segment.
5330
5377
  */
5331
- prompt: z21.string().optional(),
5378
+ prompt: z22.string().optional(),
5332
5379
  /**
5333
5380
  * The sampling temperature, between 0 and 1.
5334
5381
  * @default 0
5335
5382
  */
5336
- temperature: z21.number().min(0).max(1).default(0).optional(),
5383
+ temperature: z22.number().min(0).max(1).default(0).optional(),
5337
5384
  /**
5338
5385
  * The timestamp granularities to populate for this transcription.
5339
5386
  * @default ['segment']
5340
5387
  */
5341
- timestampGranularities: z21.array(z21.enum(["word", "segment"])).default(["segment"]).optional()
5388
+ timestampGranularities: z22.array(z22.enum(["word", "segment"])).default(["segment"]).optional()
5342
5389
  })
5343
5390
  )
5344
5391
  );
@@ -5514,7 +5561,7 @@ var OpenAITranscriptionModel = class {
5514
5561
  };
5515
5562
 
5516
5563
  // src/version.ts
5517
- var VERSION = true ? "2.0.142" : "0.0.0-test";
5564
+ var VERSION = true ? "2.0.143" : "0.0.0-test";
5518
5565
 
5519
5566
  // src/openai-provider.ts
5520
5567
  function createOpenAI(options = {}) {