@ai-sdk/openai 3.0.108 → 3.0.109

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.
@@ -8,7 +8,7 @@ declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<
8
8
  logprobs?: number | boolean | undefined;
9
9
  parallelToolCalls?: boolean | undefined;
10
10
  user?: string | undefined;
11
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11
+ reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
12
12
  maxCompletionTokens?: number | undefined;
13
13
  store?: boolean | undefined;
14
14
  metadata?: Record<string, string> | undefined;
@@ -127,7 +127,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
127
127
  declare function hasDefaultResponseFormat(modelId: string): boolean;
128
128
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
129
129
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
130
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
130
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
131
131
  background?: "auto" | "transparent" | "opaque" | undefined;
132
132
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
133
133
  outputCompression?: number | undefined;
@@ -135,17 +135,17 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
135
135
  }>;
136
136
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
137
137
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
138
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
138
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
139
139
  background?: "auto" | "transparent" | "opaque" | undefined;
140
140
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
141
141
  outputCompression?: number | undefined;
142
142
  user?: string | undefined;
143
143
  style?: "vivid" | "natural" | undefined;
144
- moderation?: "auto" | "low" | undefined;
144
+ moderation?: "low" | "auto" | undefined;
145
145
  }>;
146
146
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
147
147
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
148
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
148
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
149
149
  background?: "auto" | "transparent" | "opaque" | undefined;
150
150
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
151
151
  outputCompression?: number | undefined;
@@ -1109,7 +1109,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1109
1109
  outputCompression?: number | undefined;
1110
1110
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
1111
1111
  partialImages?: number | undefined;
1112
- quality?: "auto" | "low" | "medium" | "high" | undefined;
1112
+ quality?: "low" | "medium" | "high" | "auto" | undefined;
1113
1113
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
1114
1114
  }>;
1115
1115
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -8,7 +8,7 @@ declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<
8
8
  logprobs?: number | boolean | undefined;
9
9
  parallelToolCalls?: boolean | undefined;
10
10
  user?: string | undefined;
11
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11
+ reasoningEffort?: "low" | "medium" | "high" | "xhigh" | "max" | "none" | "minimal" | undefined;
12
12
  maxCompletionTokens?: number | undefined;
13
13
  store?: boolean | undefined;
14
14
  metadata?: Record<string, string> | undefined;
@@ -127,7 +127,7 @@ declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
127
127
  declare function hasDefaultResponseFormat(modelId: string): boolean;
128
128
  declare function getMaxImagesPerCall(modelId: OpenAIImageModelId): number;
129
129
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
130
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
130
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
131
131
  background?: "auto" | "transparent" | "opaque" | undefined;
132
132
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
133
133
  outputCompression?: number | undefined;
@@ -135,17 +135,17 @@ declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
135
135
  }>;
136
136
  type OpenAIImageModelOptions = InferSchema<typeof openaiImageModelOptions>;
137
137
  declare const openaiImageModelGenerationOptions: _ai_sdk_provider_utils.LazySchema<{
138
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
138
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
139
139
  background?: "auto" | "transparent" | "opaque" | undefined;
140
140
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
141
141
  outputCompression?: number | undefined;
142
142
  user?: string | undefined;
143
143
  style?: "vivid" | "natural" | undefined;
144
- moderation?: "auto" | "low" | undefined;
144
+ moderation?: "low" | "auto" | undefined;
145
145
  }>;
146
146
  type OpenAIImageModelGenerationOptions = InferSchema<typeof openaiImageModelGenerationOptions>;
147
147
  declare const openaiImageModelEditOptions: _ai_sdk_provider_utils.LazySchema<{
148
- quality?: "auto" | "low" | "medium" | "high" | "standard" | "hd" | undefined;
148
+ quality?: "low" | "medium" | "high" | "auto" | "standard" | "hd" | undefined;
149
149
  background?: "auto" | "transparent" | "opaque" | undefined;
150
150
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
151
151
  outputCompression?: number | undefined;
@@ -1109,7 +1109,7 @@ declare const imageGenerationArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1109
1109
  outputCompression?: number | undefined;
1110
1110
  outputFormat?: "png" | "jpeg" | "webp" | undefined;
1111
1111
  partialImages?: number | undefined;
1112
- quality?: "auto" | "low" | "medium" | "high" | undefined;
1112
+ quality?: "low" | "medium" | "high" | "auto" | undefined;
1113
1113
  size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024" | undefined;
1114
1114
  }>;
1115
1115
  declare const imageGenerationOutputSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -94,14 +94,17 @@ function getOpenAILanguageModelCapabilities(modelId) {
94
94
  const gptVersion = getGptVersion(modelId);
95
95
  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);
96
96
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
97
+ const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
97
98
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
98
99
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
99
100
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
100
- const supportsNonReasoningParameters = gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
101
+ const supportsNonReasoningParameters = !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && ((_e = gptVersion.minor) != null ? _e : 0) >= 1);
101
102
  const systemMessageMode = isReasoningModel ? "developer" : "system";
102
103
  return {
103
104
  supportsFlexProcessing,
104
105
  supportsPriorityProcessing,
106
+ supportsConfigurationUpdate: isGpt6OrLaterModel,
107
+ supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
105
108
  isReasoningModel,
106
109
  systemMessageMode,
107
110
  supportsNonReasoningParameters
@@ -775,6 +778,7 @@ var openaiLanguageModelChatOptions = (0, import_provider_utils4.lazySchema)(
775
778
  user: import_v43.z.string().optional(),
776
779
  /**
777
780
  * Reasoning effort for reasoning models. Defaults to `medium`.
781
+ * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
778
782
  */
779
783
  reasoningEffort: import_v43.z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]).optional(),
780
784
  /**
@@ -971,6 +975,17 @@ var OpenAIChatLanguageModel = class {
971
975
  })) != null ? _a2 : {};
972
976
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
973
977
  const isReasoningModel = (_b = openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
978
+ let resolvedReasoningEffort = openaiOptions.reasoningEffort;
979
+ if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
980
+ resolvedReasoningEffort
981
+ )) {
982
+ warnings.push({
983
+ type: "unsupported",
984
+ feature: "reasoningEffort",
985
+ details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
986
+ });
987
+ resolvedReasoningEffort = void 0;
988
+ }
974
989
  if (topK != null) {
975
990
  warnings.push({ type: "unsupported", feature: "topK" });
976
991
  }
@@ -1015,7 +1030,7 @@ var OpenAIChatLanguageModel = class {
1015
1030
  store: openaiOptions.store,
1016
1031
  metadata: openaiOptions.metadata,
1017
1032
  prediction: openaiOptions.prediction,
1018
- reasoning_effort: openaiOptions.reasoningEffort,
1033
+ reasoning_effort: resolvedReasoningEffort,
1019
1034
  service_tier: openaiOptions.serviceTier,
1020
1035
  prompt_cache_key: openaiOptions.promptCacheKey,
1021
1036
  prompt_cache_options: openaiOptions.promptCacheOptions,
@@ -1024,6 +1039,14 @@ var OpenAIChatLanguageModel = class {
1024
1039
  // messages:
1025
1040
  messages
1026
1041
  };
1042
+ if (modelCapabilities.supportedReasoningEfforts != null && baseArgs.prompt_cache_retention != null) {
1043
+ baseArgs.prompt_cache_retention = void 0;
1044
+ warnings.push({
1045
+ type: "unsupported",
1046
+ feature: "promptCacheRetention",
1047
+ details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
1048
+ });
1049
+ }
1027
1050
  if (isReasoningModel) {
1028
1051
  if (openaiOptions.reasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
1029
1052
  if (baseArgs.temperature != null) {
@@ -5064,9 +5087,19 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazy
5064
5087
  * Reasoning effort for reasoning models. Defaults to `medium`. If you use
5065
5088
  * `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
5066
5089
  * GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5090
+ * GPT-6 and later models support 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
5067
5091
  * Supported values vary by model.
5068
5092
  */
5069
5093
  reasoningEffort: import_v419.z.string().nullish(),
5094
+ /**
5095
+ * Updates the reasoning effort for GPT-6 and later models starting with this response
5096
+ * without changing the request-level reasoning effort. This preserves the
5097
+ * request prefix for prompt caching.
5098
+ *
5099
+ * Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
5100
+ * combined with automatic truncation.
5101
+ */
5102
+ reasoningEffortUpdate: import_v419.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
5070
5103
  /**
5071
5104
  * Controls how much model work GPT-5.6 performs before returning a final answer.
5072
5105
  * `standard` is the default. `pro` increases quality, latency, and token usage.
@@ -5988,7 +6021,7 @@ var OpenAIResponsesLanguageModel = class {
5988
6021
  toolChoice,
5989
6022
  responseFormat
5990
6023
  }) {
5991
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
6024
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
5992
6025
  const warnings = [];
5993
6026
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
5994
6027
  if (topK != null) {
@@ -6020,6 +6053,17 @@ var OpenAIResponsesLanguageModel = class {
6020
6053
  });
6021
6054
  }
6022
6055
  const isReasoningModel = (_a2 = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _a2 : modelCapabilities.isReasoningModel;
6056
+ let resolvedReasoningEffort = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort;
6057
+ if (resolvedReasoningEffort != null && modelCapabilities.supportedReasoningEfforts != null && !modelCapabilities.supportedReasoningEfforts.includes(
6058
+ resolvedReasoningEffort
6059
+ )) {
6060
+ warnings.push({
6061
+ type: "unsupported",
6062
+ feature: "reasoningEffort",
6063
+ details: `${this.modelId} only supports the following reasoning efforts: ${modelCapabilities.supportedReasoningEfforts.join(", ")}`
6064
+ });
6065
+ resolvedReasoningEffort = void 0;
6066
+ }
6023
6067
  if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
6024
6068
  warnings.push({
6025
6069
  type: "unsupported",
@@ -6072,6 +6116,20 @@ var OpenAIResponsesLanguageModel = class {
6072
6116
  customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
6073
6117
  });
6074
6118
  warnings.push(...inputWarnings);
6119
+ const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
6120
+ const configurationUpdateIsSupported = reasoningEffortUpdate == null || modelCapabilities.supportsConfigurationUpdate && (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) !== "pro" && (openaiOptions == null ? void 0 : openaiOptions.truncation) !== "auto";
6121
+ if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
6122
+ warnings.push({
6123
+ type: "unsupported",
6124
+ feature: "reasoningEffortUpdate",
6125
+ details: !modelCapabilities.supportsConfigurationUpdate ? "reasoningEffortUpdate is only supported by GPT-6 and later models" : "reasoningEffortUpdate requires standard reasoning mode without automatic truncation"
6126
+ });
6127
+ } else if (reasoningEffortUpdate != null) {
6128
+ input.unshift({
6129
+ type: "configuration_update",
6130
+ reasoning: { effort: reasoningEffortUpdate }
6131
+ });
6132
+ }
6075
6133
  const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
6076
6134
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
6077
6135
  function addInclude(key) {
@@ -6145,10 +6203,10 @@ var OpenAIResponsesLanguageModel = class {
6145
6203
  top_logprobs: topLogprobs,
6146
6204
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
6147
6205
  // model-specific settings:
6148
- ...isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningContext) != null) && {
6206
+ ...isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningMode) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningContext) != null) && {
6149
6207
  reasoning: {
6150
- ...(openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null && {
6151
- effort: openaiOptions.reasoningEffort
6208
+ ...resolvedReasoningEffort != null && {
6209
+ effort: resolvedReasoningEffort
6152
6210
  },
6153
6211
  ...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
6154
6212
  summary: openaiOptions.reasoningSummary
@@ -6162,6 +6220,14 @@ var OpenAIResponsesLanguageModel = class {
6162
6220
  }
6163
6221
  }
6164
6222
  };
6223
+ if (modelCapabilities.supportsConfigurationUpdate && baseArgs.prompt_cache_retention != null) {
6224
+ baseArgs.prompt_cache_retention = void 0;
6225
+ warnings.push({
6226
+ type: "unsupported",
6227
+ feature: "promptCacheRetention",
6228
+ details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
6229
+ });
6230
+ }
6165
6231
  if (isReasoningModel) {
6166
6232
  if (!((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) === "none" && modelCapabilities.supportsNonReasoningParameters)) {
6167
6233
  if (baseArgs.temperature != null) {
@@ -6181,6 +6247,18 @@ var OpenAIResponsesLanguageModel = class {
6181
6247
  });
6182
6248
  }
6183
6249
  }
6250
+ if (modelCapabilities.supportedReasoningEfforts != null && (baseArgs.top_logprobs != null || ((_i = baseArgs.include) == null ? void 0 : _i.includes("message.output_text.logprobs")))) {
6251
+ baseArgs.top_logprobs = void 0;
6252
+ const filteredInclude = (_j = baseArgs.include) == null ? void 0 : _j.filter(
6253
+ (value) => value !== "message.output_text.logprobs"
6254
+ );
6255
+ baseArgs.include = filteredInclude != null && filteredInclude.length > 0 ? filteredInclude : void 0;
6256
+ warnings.push({
6257
+ type: "unsupported",
6258
+ feature: "logprobs",
6259
+ details: "logprobs is not supported for reasoning models"
6260
+ });
6261
+ }
6184
6262
  } else {
6185
6263
  if ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null) {
6186
6264
  warnings.push({
@@ -6227,9 +6305,9 @@ var OpenAIResponsesLanguageModel = class {
6227
6305
  });
6228
6306
  delete baseArgs.service_tier;
6229
6307
  }
6230
- const shellToolEnvType = (_k = (_j = (_i = tools == null ? void 0 : tools.find(
6308
+ const shellToolEnvType = (_m = (_l = (_k = tools == null ? void 0 : tools.find(
6231
6309
  (tool) => tool.type === "provider" && tool.id === "openai.shell"
6232
- )) == null ? void 0 : _i.args) == null ? void 0 : _j.environment) == null ? void 0 : _k.type;
6310
+ )) == null ? void 0 : _k.args) == null ? void 0 : _l.environment) == null ? void 0 : _m.type;
6233
6311
  const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
6234
6312
  return {
6235
6313
  webSearchToolName,