@ai-sdk/openai 3.0.132 → 3.0.133

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.
@@ -46,7 +46,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
46
46
  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);
47
47
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
48
48
  const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
49
- const isGpt6SolOrLuna = modelId === "gpt-6-sol" || modelId === "gpt-6-luna";
49
+ const isGpt6OrLaterModelWithNoneEffort = modelId === "gpt-6-sol" || modelId === "gpt-6-luna" || modelId === "gpt-6.1-terra";
50
50
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
51
51
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
52
52
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
@@ -57,7 +57,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
57
57
  supportsPriorityProcessing,
58
58
  supportsConfigurationUpdate: isGpt6OrLaterModel,
59
59
  supportsAsyncToolCalling: isGpt6OrLaterModel,
60
- supportedReasoningEfforts: isGpt6SolOrLuna ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
60
+ supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
61
61
  isReasoningModel,
62
62
  systemMessageMode,
63
63
  supportsNonReasoningParameters
@@ -2456,7 +2456,12 @@ var openaiTranscriptionResponseSchema = lazySchema10(
2456
2456
  compression_ratio: z10.number(),
2457
2457
  no_speech_prob: z10.number()
2458
2458
  })
2459
- ).nullish()
2459
+ ).nullish(),
2460
+ // Lenient: an unexpected usage shape must not fail the transcription.
2461
+ usage: z10.object({
2462
+ type: z10.string().nullish(),
2463
+ seconds: z10.number().nullish()
2464
+ }).nullish().catch(void 0)
2460
2465
  })
2461
2466
  )
2462
2467
  );
@@ -2592,10 +2597,10 @@ var OpenAITranscriptionModel = class {
2592
2597
  prompt: openAIOptions.prompt,
2593
2598
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
2594
2599
  // prefer verbose_json to get segments for models that support it
2595
- response_format: [
2596
- "gpt-4o-transcribe",
2597
- "gpt-4o-mini-transcribe"
2598
- ].includes(this.modelId) ? "json" : "verbose_json",
2600
+ // gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
2601
+ response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
2602
+ this.modelId
2603
+ ) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
2599
2604
  temperature: openAIOptions.temperature,
2600
2605
  timestamp_granularities: openAIOptions.timestampGranularities
2601
2606
  };
@@ -2617,7 +2622,7 @@ var OpenAITranscriptionModel = class {
2617
2622
  };
2618
2623
  }
2619
2624
  async doGenerate(options) {
2620
- var _a2, _b, _c, _d, _e, _f, _g, _h;
2625
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2621
2626
  const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
2622
2627
  const { formData, warnings } = await this.getArgs(options);
2623
2628
  const {
@@ -2651,7 +2656,8 @@ var OpenAITranscriptionModel = class {
2651
2656
  endSecond: word.end
2652
2657
  }))) != null ? _g : [],
2653
2658
  language,
2654
- durationInSeconds: (_h = response.duration) != null ? _h : void 0,
2659
+ // Duration-billed json responses report the duration only in `usage`:
2660
+ durationInSeconds: (_j = response.duration) != null ? _j : ((_h = response.usage) == null ? void 0 : _h.type) === "duration" ? (_i = response.usage.seconds) != null ? _i : void 0 : void 0,
2655
2661
  warnings,
2656
2662
  response: {
2657
2663
  timestamp: currentDate,
@@ -2910,6 +2916,7 @@ var openaiResponsesReasoningModelIds = [
2910
2916
  "gpt-5.6-terra",
2911
2917
  "gpt-6-astra",
2912
2918
  "gpt-6.1-sol",
2919
+ "gpt-6.1-terra",
2913
2920
  "gpt-6-luna",
2914
2921
  "gpt-6-sol"
2915
2922
  ];