@ai-sdk/openai 4.0.62 → 4.0.63

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,14 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 4.0.63
4
+
5
+ ### Patch Changes
6
+
7
+ - 85db433: Include explicit message item types in Azure AI Foundry Responses requests.
8
+ - 5fb2a64: feat(openai): add GPT Image 2.5 Flare and Sunburst model IDs
9
+ - e105b2b: fix(openai): reject denied programmatic tool calls
10
+ - 45f2b6a: fix(openai): report apply patch responses with a tool-calls finish reason
11
+
3
12
  ## 4.0.62
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ declare const openaiEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
47
47
  }>;
48
48
  type OpenAIEmbeddingModelOptions = InferSchema<typeof openaiEmbeddingModelOptions>;
49
49
 
50
- type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'chatgpt-image-latest' | (string & {});
50
+ type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2.5-flare' | 'gpt-image-2.5-flare-2026-09-08' | 'gpt-image-2.5-sunburst' | 'gpt-image-2.5-sunburst-2026-09-08' | 'chatgpt-image-latest' | (string & {});
51
51
  declare const openaiImageModelOptions: _ai_sdk_provider_utils.LazySchema<{
52
52
  quality?: "low" | "medium" | "high" | "xhigh" | "max" | "auto" | "standard" | "hd" | undefined;
53
53
  background?: "auto" | "transparent" | "opaque" | undefined;
@@ -1629,6 +1629,13 @@ type OpenAIConfig = {
1629
1629
  fetch?: FetchFunction;
1630
1630
  webSocket?: WebSocketConstructor;
1631
1631
  generateId?: () => string;
1632
+ /**
1633
+ * Whether Responses API message input items must include an explicit
1634
+ * `type: 'message'` discriminator.
1635
+ *
1636
+ * @see https://github.com/vercel/ai/issues/20180
1637
+ */
1638
+ explicitMessageItemType?: boolean;
1632
1639
  /**
1633
1640
  * This is soft-deprecated. Use provider references (e.g. `{ openai: 'file-abc123' }`)
1634
1641
  * in file part data instead. File ID prefixes used to identify file IDs
package/dist/index.js CHANGED
@@ -2401,6 +2401,10 @@ var modelMaxImagesPerCall = {
2401
2401
  "gpt-image-1-mini": 10,
2402
2402
  "gpt-image-1.5": 10,
2403
2403
  "gpt-image-2": 10,
2404
+ "gpt-image-2.5-flare": 10,
2405
+ "gpt-image-2.5-flare-2026-09-08": 10,
2406
+ "gpt-image-2.5-sunburst": 10,
2407
+ "gpt-image-2.5-sunburst-2026-09-08": 10,
2404
2408
  "chatgpt-image-latest": 10
2405
2409
  };
2406
2410
  var defaultResponseFormatPrefixes = ["chatgpt-image-", "gpt-image-"];
@@ -4999,6 +5003,7 @@ async function convertToOpenAIResponsesInput({
4999
5003
  toolNameMapping,
5000
5004
  systemMessageMode,
5001
5005
  providerOptionsName,
5006
+ explicitMessageItemType = false,
5002
5007
  fileIdPrefixes,
5003
5008
  passThroughUnsupportedFiles = false,
5004
5009
  store,
@@ -5016,6 +5021,7 @@ async function convertToOpenAIResponsesInput({
5016
5021
  let input = [];
5017
5022
  const warnings = [];
5018
5023
  const processedApprovalIds = /* @__PURE__ */ new Set();
5024
+ const programmaticToolCallIds = /* @__PURE__ */ new Set();
5019
5025
  const parallelToolResultGroups = hasConversation || hasPreviousResponseId ? collectCompleteParallelToolResultGroups({
5020
5026
  prompt,
5021
5027
  providerOptionsName
@@ -5032,6 +5038,7 @@ async function convertToOpenAIResponsesInput({
5032
5038
  providerOptionsName
5033
5039
  );
5034
5040
  input.push({
5041
+ ...explicitMessageItemType && { type: "message" },
5035
5042
  role: "system",
5036
5043
  content: promptCacheBreakpoint == null ? content : [
5037
5044
  {
@@ -5049,6 +5056,7 @@ async function convertToOpenAIResponsesInput({
5049
5056
  providerOptionsName
5050
5057
  );
5051
5058
  input.push({
5059
+ ...explicitMessageItemType && { type: "message" },
5052
5060
  role: "developer",
5053
5061
  content: promptCacheBreakpoint == null ? content : [
5054
5062
  {
@@ -5078,6 +5086,7 @@ async function convertToOpenAIResponsesInput({
5078
5086
  }
5079
5087
  case "user": {
5080
5088
  input.push({
5089
+ ...explicitMessageItemType && { type: "message" },
5081
5090
  role: "user",
5082
5091
  content: content.map((part, index) => {
5083
5092
  var _a3, _b2, _c2, _d2, _e2;
@@ -5194,6 +5203,7 @@ async function convertToOpenAIResponsesInput({
5194
5203
  break;
5195
5204
  }
5196
5205
  input.push({
5206
+ ...explicitMessageItemType && { type: "message" },
5197
5207
  role: "assistant",
5198
5208
  content: [{ type: "output_text", text: part.text }],
5199
5209
  id,
@@ -5234,6 +5244,9 @@ async function convertToOpenAIResponsesInput({
5234
5244
  const namespace = (_k = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.namespace) != null ? _k : (_j = (_i = part.providerMetadata) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.namespace;
5235
5245
  const isAsync = (_p = (_m = (_l = part.providerOptions) == null ? void 0 : _l[providerOptionsName]) == null ? void 0 : _m.async) != null ? _p : (_o = (_n = part.providerMetadata) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.async;
5236
5246
  const caller = (_r = (_q = part.providerOptions) == null ? void 0 : _q[providerOptionsName]) == null ? void 0 : _r.caller;
5247
+ if ((caller == null ? void 0 : caller.type) === "program") {
5248
+ programmaticToolCallIds.add(part.toolCallId);
5249
+ }
5237
5250
  if (hasConversation && id != null) {
5238
5251
  break;
5239
5252
  }
@@ -5885,6 +5898,12 @@ ${text}`,
5885
5898
  });
5886
5899
  continue;
5887
5900
  }
5901
+ const resultCaller = (_P = (_O = part.providerOptions) == null ? void 0 : _O[providerOptionsName]) == null ? void 0 : _P.caller;
5902
+ if (output.type === "execution-denied" && ((resultCaller == null ? void 0 : resultCaller.type) === "program" || programmaticToolCallIds.has(part.toolCallId))) {
5903
+ throw new UnsupportedFunctionalityError4({
5904
+ functionality: "execution-denied results for programmatic tool calls"
5905
+ });
5906
+ }
5888
5907
  const contentValue = await convertFunctionToolResultOutput({
5889
5908
  output,
5890
5909
  toolName: part.toolName,
@@ -5897,9 +5916,7 @@ ${text}`,
5897
5916
  providerOptionsName,
5898
5917
  warnings
5899
5918
  });
5900
- const caller = mapToolCaller(
5901
- (_P = (_O = part.providerOptions) == null ? void 0 : _O[providerOptionsName]) == null ? void 0 : _P.caller
5902
- );
5919
+ const caller = mapToolCaller(resultCaller);
5903
5920
  input.push({
5904
5921
  type: "function_call_output",
5905
5922
  call_id: part.toolCallId,
@@ -6963,6 +6980,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6963
6980
  toolNameMapping,
6964
6981
  systemMessageMode: (_d = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _d : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
6965
6982
  providerOptionsName,
6983
+ explicitMessageItemType: config.explicitMessageItemType,
6966
6984
  fileIdPrefixes: config.fileIdPrefixes,
6967
6985
  passThroughUnsupportedFiles: (_e = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _e : false,
6968
6986
  store: (_f = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _f : true,
@@ -7721,6 +7739,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7721
7739
  break;
7722
7740
  }
7723
7741
  case "apply_patch_call": {
7742
+ hasFunctionCall = true;
7724
7743
  content.push({
7725
7744
  type: "tool-call",
7726
7745
  toolCallId: part.call_id,
@@ -8464,6 +8483,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8464
8483
  toolCall.applyPatch.endEmitted = true;
8465
8484
  }
8466
8485
  if (toolCall && value.item.status === "completed") {
8486
+ hasFunctionCall = true;
8467
8487
  controller.enqueue({
8468
8488
  type: "tool-call",
8469
8489
  toolCallId: toolCall.toolCallId,
@@ -11188,7 +11208,7 @@ var OpenAISkills = class {
11188
11208
  };
11189
11209
 
11190
11210
  // src/version.ts
11191
- var VERSION = true ? "4.0.62" : "0.0.0-test";
11211
+ var VERSION = true ? "4.0.63" : "0.0.0-test";
11192
11212
 
11193
11213
  // src/openai-provider.ts
11194
11214
  function createOpenAI(options = {}) {