@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.
package/dist/index.mjs CHANGED
@@ -54,7 +54,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
54
54
  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);
55
55
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
56
56
  const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
57
- const isGpt6SolOrLuna = modelId === "gpt-6-sol" || modelId === "gpt-6-luna";
57
+ const isGpt6OrLaterModelWithNoneEffort = modelId === "gpt-6-sol" || modelId === "gpt-6-luna" || modelId === "gpt-6.1-terra";
58
58
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
59
59
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
60
60
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
@@ -65,7 +65,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
65
65
  supportsPriorityProcessing,
66
66
  supportsConfigurationUpdate: isGpt6OrLaterModel,
67
67
  supportsAsyncToolCalling: isGpt6OrLaterModel,
68
- supportedReasoningEfforts: isGpt6SolOrLuna ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
68
+ supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
69
69
  isReasoningModel,
70
70
  systemMessageMode,
71
71
  supportsNonReasoningParameters
@@ -3237,6 +3237,7 @@ var openaiResponsesReasoningModelIds = [
3237
3237
  "gpt-5.6-terra",
3238
3238
  "gpt-6-astra",
3239
3239
  "gpt-6.1-sol",
3240
+ "gpt-6.1-terra",
3240
3241
  "gpt-6-luna",
3241
3242
  "gpt-6-sol"
3242
3243
  ];
@@ -8252,7 +8253,12 @@ var openaiTranscriptionResponseSchema = lazySchema25(
8252
8253
  compression_ratio: z25.number(),
8253
8254
  no_speech_prob: z25.number()
8254
8255
  })
8255
- ).nullish()
8256
+ ).nullish(),
8257
+ // Lenient: an unexpected usage shape must not fail the transcription.
8258
+ usage: z25.object({
8259
+ type: z25.string().nullish(),
8260
+ seconds: z25.number().nullish()
8261
+ }).nullish().catch(void 0)
8256
8262
  })
8257
8263
  )
8258
8264
  );
@@ -8388,10 +8394,10 @@ var OpenAITranscriptionModel = class {
8388
8394
  prompt: openAIOptions.prompt,
8389
8395
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
8390
8396
  // prefer verbose_json to get segments for models that support it
8391
- response_format: [
8392
- "gpt-4o-transcribe",
8393
- "gpt-4o-mini-transcribe"
8394
- ].includes(this.modelId) ? "json" : "verbose_json",
8397
+ // gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
8398
+ response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
8399
+ this.modelId
8400
+ ) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
8395
8401
  temperature: openAIOptions.temperature,
8396
8402
  timestamp_granularities: openAIOptions.timestampGranularities
8397
8403
  };
@@ -8413,7 +8419,7 @@ var OpenAITranscriptionModel = class {
8413
8419
  };
8414
8420
  }
8415
8421
  async doGenerate(options) {
8416
- var _a2, _b, _c, _d, _e, _f, _g, _h;
8422
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8417
8423
  const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
8418
8424
  const { formData, warnings } = await this.getArgs(options);
8419
8425
  const {
@@ -8447,7 +8453,8 @@ var OpenAITranscriptionModel = class {
8447
8453
  endSecond: word.end
8448
8454
  }))) != null ? _g : [],
8449
8455
  language,
8450
- durationInSeconds: (_h = response.duration) != null ? _h : void 0,
8456
+ // Duration-billed json responses report the duration only in `usage`:
8457
+ 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,
8451
8458
  warnings,
8452
8459
  response: {
8453
8460
  timestamp: currentDate,
@@ -8460,7 +8467,7 @@ var OpenAITranscriptionModel = class {
8460
8467
  };
8461
8468
 
8462
8469
  // src/version.ts
8463
- var VERSION = true ? "3.0.132" : "0.0.0-test";
8470
+ var VERSION = true ? "3.0.133" : "0.0.0-test";
8464
8471
 
8465
8472
  // src/openai-provider.ts
8466
8473
  function createOpenAI(options = {}) {