@ai-sdk/openai 3.0.87 → 3.0.88

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.88
4
+
5
+ ### Patch Changes
6
+
7
+ - 8100830: Apply reasoning, service tier, and image defaults to recognizable future OpenAI model family versions.
8
+
3
9
  ## 3.0.87
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -54,10 +54,15 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
54
54
 
55
55
  // src/openai-language-model-capabilities.ts
56
56
  function getOpenAILanguageModelCapabilities(modelId) {
57
- const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
58
- const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
59
- const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
60
- const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4") || modelId.startsWith("gpt-5.5") || modelId.startsWith("gpt-5.6");
57
+ var _a, _b, _c, _d, _e;
58
+ const oSeriesVersion = getOSeriesVersion(modelId);
59
+ const gptVersion = getGptVersion(modelId);
60
+ const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a.startsWith("chat")) != null ? _b : false);
61
+ const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
62
+ const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
63
+ const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
64
+ const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
65
+ const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
61
66
  const systemMessageMode = isReasoningModel ? "developer" : "system";
62
67
  return {
63
68
  supportsFlexProcessing,
@@ -67,6 +72,21 @@ function getOpenAILanguageModelCapabilities(modelId) {
67
72
  supportsNonReasoningParameters
68
73
  };
69
74
  }
75
+ function getOSeriesVersion(modelId) {
76
+ const match = /^o(\d+)(?:-|$)/.exec(modelId);
77
+ return match == null ? void 0 : Number(match[1]);
78
+ }
79
+ function getGptVersion(modelId) {
80
+ const match = /^gpt-(\d+)(?:\.(\d+))?(?:-(.+))?$/.exec(modelId);
81
+ if (match == null) {
82
+ return void 0;
83
+ }
84
+ return {
85
+ major: Number(match[1]),
86
+ minor: match[2] == null ? void 0 : Number(match[2]),
87
+ variant: match[3]
88
+ };
89
+ }
70
90
 
71
91
  // src/openai-stream-error.ts
72
92
  var import_provider = require("@ai-sdk/provider");
@@ -1986,18 +2006,16 @@ var modelMaxImagesPerCall = {
1986
2006
  "gpt-image-2": 10,
1987
2007
  "chatgpt-image-latest": 10
1988
2008
  };
1989
- var defaultResponseFormatPrefixes = [
1990
- "chatgpt-image-",
1991
- "gpt-image-1-mini",
1992
- "gpt-image-1.5",
1993
- "gpt-image-1",
1994
- "gpt-image-2"
1995
- ];
2009
+ var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
1996
2010
  function hasDefaultResponseFormat(modelId) {
1997
2011
  return defaultResponseFormatPrefixes.some(
1998
2012
  (prefix) => modelId.startsWith(prefix)
1999
2013
  );
2000
2014
  }
2015
+ function getMaxImagesPerCall(modelId) {
2016
+ var _a;
2017
+ return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
2018
+ }
2001
2019
  var baseImageModelOptionsObject = import_v49.z.object({
2002
2020
  /**
2003
2021
  * Quality of the generated image(s).
@@ -2066,8 +2084,7 @@ var OpenAIImageModel = class {
2066
2084
  this.specificationVersion = "v3";
2067
2085
  }
2068
2086
  get maxImagesPerCall() {
2069
- var _a;
2070
- return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
2087
+ return getMaxImagesPerCall(this.modelId);
2071
2088
  }
2072
2089
  get provider() {
2073
2090
  return this.config.provider;
@@ -7330,7 +7347,7 @@ var OpenAITranscriptionModel = class {
7330
7347
  };
7331
7348
 
7332
7349
  // src/version.ts
7333
- var VERSION = true ? "3.0.87" : "0.0.0-test";
7350
+ var VERSION = true ? "3.0.88" : "0.0.0-test";
7334
7351
 
7335
7352
  // src/openai-provider.ts
7336
7353
  function createOpenAI(options = {}) {