@ai-sdk/openai 2.0.0-canary.6 → 2.0.0-canary.8

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.
@@ -25,6 +25,7 @@ __export(internal_exports, {
25
25
  OpenAIEmbeddingModel: () => OpenAIEmbeddingModel,
26
26
  OpenAIImageModel: () => OpenAIImageModel,
27
27
  OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
28
+ OpenAISpeechModel: () => OpenAISpeechModel,
28
29
  OpenAITranscriptionModel: () => OpenAITranscriptionModel,
29
30
  modelMaxImagesPerCall: () => modelMaxImagesPerCall,
30
31
  openaiProviderOptions: () => openaiProviderOptions
@@ -583,10 +584,23 @@ var OpenAIChatLanguageModel = class {
583
584
  abortSignal: options.abortSignal,
584
585
  fetch: this.config.fetch
585
586
  });
586
- const { messages: rawPrompt, ...rawSettings } = body;
587
587
  const choice = response.choices[0];
588
- const completionTokenDetails = (_a = response.usage) == null ? void 0 : _a.completion_tokens_details;
589
- const promptTokenDetails = (_b = response.usage) == null ? void 0 : _b.prompt_tokens_details;
588
+ const content = [];
589
+ const text = choice.message.content;
590
+ if (text != null && text.length > 0) {
591
+ content.push({ type: "text", text });
592
+ }
593
+ for (const toolCall of (_a = choice.message.tool_calls) != null ? _a : []) {
594
+ content.push({
595
+ type: "tool-call",
596
+ toolCallType: "function",
597
+ toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils3.generateId)(),
598
+ toolName: toolCall.function.name,
599
+ args: toolCall.function.arguments
600
+ });
601
+ }
602
+ const completionTokenDetails = (_c = response.usage) == null ? void 0 : _c.completion_tokens_details;
603
+ const promptTokenDetails = (_d = response.usage) == null ? void 0 : _d.prompt_tokens_details;
590
604
  const providerMetadata = { openai: {} };
591
605
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null) {
592
606
  providerMetadata.openai.reasoningTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens;
@@ -601,16 +615,7 @@ var OpenAIChatLanguageModel = class {
601
615
  providerMetadata.openai.cachedPromptTokens = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens;
602
616
  }
603
617
  return {
604
- text: (_c = choice.message.content) != null ? _c : void 0,
605
- toolCalls: (_d = choice.message.tool_calls) == null ? void 0 : _d.map((toolCall) => {
606
- var _a2;
607
- return {
608
- toolCallType: "function",
609
- toolCallId: (_a2 = toolCall.id) != null ? _a2 : (0, import_provider_utils3.generateId)(),
610
- toolName: toolCall.function.name,
611
- args: toolCall.function.arguments
612
- };
613
- }),
618
+ content,
614
619
  finishReason: mapOpenAIFinishReason(choice.finish_reason),
615
620
  usage: {
616
621
  inputTokens: (_f = (_e = response.usage) == null ? void 0 : _e.prompt_tokens) != null ? _f : void 0,
@@ -662,6 +667,9 @@ var OpenAIChatLanguageModel = class {
662
667
  return {
663
668
  stream: response.pipeThrough(
664
669
  new TransformStream({
670
+ start(controller) {
671
+ controller.enqueue({ type: "stream-start", warnings });
672
+ },
665
673
  transform(chunk, controller) {
666
674
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
667
675
  if (!chunk.success) {
@@ -714,8 +722,8 @@ var OpenAIChatLanguageModel = class {
714
722
  const delta = choice.delta;
715
723
  if (delta.content != null) {
716
724
  controller.enqueue({
717
- type: "text-delta",
718
- textDelta: delta.content
725
+ type: "text",
726
+ text: delta.content
719
727
  });
720
728
  }
721
729
  const mappedLogprobs = mapOpenAIChatLogProbsOutput(
@@ -819,8 +827,7 @@ var OpenAIChatLanguageModel = class {
819
827
  })
820
828
  ),
821
829
  request: { body },
822
- response: { headers: responseHeaders },
823
- warnings
830
+ response: { headers: responseHeaders }
824
831
  };
825
832
  }
826
833
  };
@@ -1144,7 +1151,7 @@ var OpenAICompletionLanguageModel = class {
1144
1151
  });
1145
1152
  const choice = response.choices[0];
1146
1153
  return {
1147
- text: choice.text,
1154
+ content: [{ type: "text", text: choice.text }],
1148
1155
  usage: {
1149
1156
  inputTokens: response.usage.prompt_tokens,
1150
1157
  outputTokens: response.usage.completion_tokens
@@ -1192,6 +1199,9 @@ var OpenAICompletionLanguageModel = class {
1192
1199
  return {
1193
1200
  stream: response.pipeThrough(
1194
1201
  new TransformStream({
1202
+ start(controller) {
1203
+ controller.enqueue({ type: "stream-start", warnings });
1204
+ },
1195
1205
  transform(chunk, controller) {
1196
1206
  if (!chunk.success) {
1197
1207
  finishReason = "error";
@@ -1221,8 +1231,8 @@ var OpenAICompletionLanguageModel = class {
1221
1231
  }
1222
1232
  if ((choice == null ? void 0 : choice.text) != null) {
1223
1233
  controller.enqueue({
1224
- type: "text-delta",
1225
- textDelta: choice.text
1234
+ type: "text",
1235
+ text: choice.text
1226
1236
  });
1227
1237
  }
1228
1238
  const mappedLogprobs = mapOpenAICompletionLogProbs(
@@ -1243,9 +1253,8 @@ var OpenAICompletionLanguageModel = class {
1243
1253
  }
1244
1254
  })
1245
1255
  ),
1246
- response: { headers: responseHeaders },
1247
- warnings,
1248
- request: { body: JSON.stringify(body) }
1256
+ request: { body },
1257
+ response: { headers: responseHeaders }
1249
1258
  };
1250
1259
  }
1251
1260
  };
@@ -1300,7 +1309,7 @@ var import_provider_utils5 = require("@ai-sdk/provider-utils");
1300
1309
  var import_zod5 = require("zod");
1301
1310
  var OpenAIEmbeddingModel = class {
1302
1311
  constructor(modelId, settings, config) {
1303
- this.specificationVersion = "v1";
1312
+ this.specificationVersion = "v2";
1304
1313
  this.modelId = modelId;
1305
1314
  this.settings = settings;
1306
1315
  this.config = config;
@@ -1329,7 +1338,11 @@ var OpenAIEmbeddingModel = class {
1329
1338
  values
1330
1339
  });
1331
1340
  }
1332
- const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
1341
+ const {
1342
+ responseHeaders,
1343
+ value: response,
1344
+ rawValue
1345
+ } = await (0, import_provider_utils5.postJsonToApi)({
1333
1346
  url: this.config.url({
1334
1347
  path: "/embeddings",
1335
1348
  modelId: this.modelId
@@ -1352,7 +1365,7 @@ var OpenAIEmbeddingModel = class {
1352
1365
  return {
1353
1366
  embeddings: response.data.map((item) => item.embedding),
1354
1367
  usage: response.usage ? { tokens: response.usage.prompt_tokens } : void 0,
1355
- rawResponse: { headers: responseHeaders }
1368
+ response: { headers: responseHeaders, body: rawValue }
1356
1369
  };
1357
1370
  }
1358
1371
  };
@@ -1448,7 +1461,7 @@ var openaiImageResponseSchema = import_zod6.z.object({
1448
1461
  // src/openai-transcription-model.ts
1449
1462
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1450
1463
  var import_zod7 = require("zod");
1451
- var OpenAIProviderOptionsSchema = import_zod7.z.object({
1464
+ var openAIProviderOptionsSchema = import_zod7.z.object({
1452
1465
  include: import_zod7.z.array(import_zod7.z.string()).nullish(),
1453
1466
  language: import_zod7.z.string().nullish(),
1454
1467
  prompt: import_zod7.z.string().nullish(),
@@ -1533,7 +1546,7 @@ var OpenAITranscriptionModel = class {
1533
1546
  const openAIOptions = (0, import_provider_utils7.parseProviderOptions)({
1534
1547
  provider: "openai",
1535
1548
  providerOptions,
1536
- schema: OpenAIProviderOptionsSchema
1549
+ schema: openAIProviderOptionsSchema
1537
1550
  });
1538
1551
  const formData = new FormData();
1539
1552
  const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils7.convertBase64ToUint8Array)(audio)]);
@@ -1614,9 +1627,108 @@ var openaiTranscriptionResponseSchema = import_zod7.z.object({
1614
1627
  ).nullish()
1615
1628
  });
1616
1629
 
1617
- // src/responses/openai-responses-language-model.ts
1630
+ // src/openai-speech-model.ts
1618
1631
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1619
1632
  var import_zod8 = require("zod");
1633
+ var OpenAIProviderOptionsSchema = import_zod8.z.object({
1634
+ instructions: import_zod8.z.string().nullish(),
1635
+ speed: import_zod8.z.number().min(0.25).max(4).default(1).nullish()
1636
+ });
1637
+ var OpenAISpeechModel = class {
1638
+ constructor(modelId, config) {
1639
+ this.modelId = modelId;
1640
+ this.config = config;
1641
+ this.specificationVersion = "v1";
1642
+ }
1643
+ get provider() {
1644
+ return this.config.provider;
1645
+ }
1646
+ getArgs({
1647
+ text,
1648
+ voice = "alloy",
1649
+ outputFormat = "mp3",
1650
+ speed,
1651
+ instructions,
1652
+ providerOptions
1653
+ }) {
1654
+ const warnings = [];
1655
+ const openAIOptions = (0, import_provider_utils8.parseProviderOptions)({
1656
+ provider: "openai",
1657
+ providerOptions,
1658
+ schema: OpenAIProviderOptionsSchema
1659
+ });
1660
+ const requestBody = {
1661
+ model: this.modelId,
1662
+ input: text,
1663
+ voice,
1664
+ response_format: "mp3",
1665
+ speed,
1666
+ instructions
1667
+ };
1668
+ if (outputFormat) {
1669
+ if (["mp3", "opus", "aac", "flac", "wav", "pcm"].includes(outputFormat)) {
1670
+ requestBody.response_format = outputFormat;
1671
+ } else {
1672
+ warnings.push({
1673
+ type: "unsupported-setting",
1674
+ setting: "outputFormat",
1675
+ details: `Unsupported output format: ${outputFormat}. Using mp3 instead.`
1676
+ });
1677
+ }
1678
+ }
1679
+ if (openAIOptions) {
1680
+ const speechModelOptions = {};
1681
+ for (const key in speechModelOptions) {
1682
+ const value = speechModelOptions[key];
1683
+ if (value !== void 0) {
1684
+ requestBody[key] = value;
1685
+ }
1686
+ }
1687
+ }
1688
+ return {
1689
+ requestBody,
1690
+ warnings
1691
+ };
1692
+ }
1693
+ async doGenerate(options) {
1694
+ var _a, _b, _c;
1695
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1696
+ const { requestBody, warnings } = this.getArgs(options);
1697
+ const {
1698
+ value: audio,
1699
+ responseHeaders,
1700
+ rawValue: rawResponse
1701
+ } = await (0, import_provider_utils8.postJsonToApi)({
1702
+ url: this.config.url({
1703
+ path: "/audio/speech",
1704
+ modelId: this.modelId
1705
+ }),
1706
+ headers: (0, import_provider_utils8.combineHeaders)(this.config.headers(), options.headers),
1707
+ body: requestBody,
1708
+ failedResponseHandler: openaiFailedResponseHandler,
1709
+ successfulResponseHandler: (0, import_provider_utils8.createBinaryResponseHandler)(),
1710
+ abortSignal: options.abortSignal,
1711
+ fetch: this.config.fetch
1712
+ });
1713
+ return {
1714
+ audio,
1715
+ warnings,
1716
+ request: {
1717
+ body: JSON.stringify(requestBody)
1718
+ },
1719
+ response: {
1720
+ timestamp: currentDate,
1721
+ modelId: this.modelId,
1722
+ headers: responseHeaders,
1723
+ body: rawResponse
1724
+ }
1725
+ };
1726
+ }
1727
+ };
1728
+
1729
+ // src/responses/openai-responses-language-model.ts
1730
+ var import_provider_utils9 = require("@ai-sdk/provider-utils");
1731
+ var import_zod9 = require("zod");
1620
1732
 
1621
1733
  // src/responses/convert-to-openai-responses-messages.ts
1622
1734
  var import_provider6 = require("@ai-sdk/provider");
@@ -1876,7 +1988,7 @@ var OpenAIResponsesLanguageModel = class {
1876
1988
  systemMessageMode: modelConfig.systemMessageMode
1877
1989
  });
1878
1990
  warnings.push(...messageWarnings);
1879
- const openaiOptions = (0, import_provider_utils8.parseProviderOptions)({
1991
+ const openaiOptions = (0, import_provider_utils9.parseProviderOptions)({
1880
1992
  provider: "openai",
1881
1993
  providerOptions,
1882
1994
  schema: openaiResponsesProviderOptionsSchema
@@ -1951,95 +2063,109 @@ var OpenAIResponsesLanguageModel = class {
1951
2063
  };
1952
2064
  }
1953
2065
  async doGenerate(options) {
1954
- var _a, _b, _c, _d, _e;
2066
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1955
2067
  const { args: body, warnings } = this.getArgs(options);
1956
2068
  const {
1957
2069
  responseHeaders,
1958
2070
  value: response,
1959
2071
  rawValue: rawResponse
1960
- } = await (0, import_provider_utils8.postJsonToApi)({
2072
+ } = await (0, import_provider_utils9.postJsonToApi)({
1961
2073
  url: this.config.url({
1962
2074
  path: "/responses",
1963
2075
  modelId: this.modelId
1964
2076
  }),
1965
- headers: (0, import_provider_utils8.combineHeaders)(this.config.headers(), options.headers),
2077
+ headers: (0, import_provider_utils9.combineHeaders)(this.config.headers(), options.headers),
1966
2078
  body,
1967
2079
  failedResponseHandler: openaiFailedResponseHandler,
1968
- successfulResponseHandler: (0, import_provider_utils8.createJsonResponseHandler)(
1969
- import_zod8.z.object({
1970
- id: import_zod8.z.string(),
1971
- created_at: import_zod8.z.number(),
1972
- model: import_zod8.z.string(),
1973
- output: import_zod8.z.array(
1974
- import_zod8.z.discriminatedUnion("type", [
1975
- import_zod8.z.object({
1976
- type: import_zod8.z.literal("message"),
1977
- role: import_zod8.z.literal("assistant"),
1978
- content: import_zod8.z.array(
1979
- import_zod8.z.object({
1980
- type: import_zod8.z.literal("output_text"),
1981
- text: import_zod8.z.string(),
1982
- annotations: import_zod8.z.array(
1983
- import_zod8.z.object({
1984
- type: import_zod8.z.literal("url_citation"),
1985
- start_index: import_zod8.z.number(),
1986
- end_index: import_zod8.z.number(),
1987
- url: import_zod8.z.string(),
1988
- title: import_zod8.z.string()
2080
+ successfulResponseHandler: (0, import_provider_utils9.createJsonResponseHandler)(
2081
+ import_zod9.z.object({
2082
+ id: import_zod9.z.string(),
2083
+ created_at: import_zod9.z.number(),
2084
+ model: import_zod9.z.string(),
2085
+ output: import_zod9.z.array(
2086
+ import_zod9.z.discriminatedUnion("type", [
2087
+ import_zod9.z.object({
2088
+ type: import_zod9.z.literal("message"),
2089
+ role: import_zod9.z.literal("assistant"),
2090
+ content: import_zod9.z.array(
2091
+ import_zod9.z.object({
2092
+ type: import_zod9.z.literal("output_text"),
2093
+ text: import_zod9.z.string(),
2094
+ annotations: import_zod9.z.array(
2095
+ import_zod9.z.object({
2096
+ type: import_zod9.z.literal("url_citation"),
2097
+ start_index: import_zod9.z.number(),
2098
+ end_index: import_zod9.z.number(),
2099
+ url: import_zod9.z.string(),
2100
+ title: import_zod9.z.string()
1989
2101
  })
1990
2102
  )
1991
2103
  })
1992
2104
  )
1993
2105
  }),
1994
- import_zod8.z.object({
1995
- type: import_zod8.z.literal("function_call"),
1996
- call_id: import_zod8.z.string(),
1997
- name: import_zod8.z.string(),
1998
- arguments: import_zod8.z.string()
2106
+ import_zod9.z.object({
2107
+ type: import_zod9.z.literal("function_call"),
2108
+ call_id: import_zod9.z.string(),
2109
+ name: import_zod9.z.string(),
2110
+ arguments: import_zod9.z.string()
1999
2111
  }),
2000
- import_zod8.z.object({
2001
- type: import_zod8.z.literal("web_search_call")
2112
+ import_zod9.z.object({
2113
+ type: import_zod9.z.literal("web_search_call")
2002
2114
  }),
2003
- import_zod8.z.object({
2004
- type: import_zod8.z.literal("computer_call")
2115
+ import_zod9.z.object({
2116
+ type: import_zod9.z.literal("computer_call")
2005
2117
  }),
2006
- import_zod8.z.object({
2007
- type: import_zod8.z.literal("reasoning")
2118
+ import_zod9.z.object({
2119
+ type: import_zod9.z.literal("reasoning")
2008
2120
  })
2009
2121
  ])
2010
2122
  ),
2011
- incomplete_details: import_zod8.z.object({ reason: import_zod8.z.string() }).nullable(),
2123
+ incomplete_details: import_zod9.z.object({ reason: import_zod9.z.string() }).nullable(),
2012
2124
  usage: usageSchema
2013
2125
  })
2014
2126
  ),
2015
2127
  abortSignal: options.abortSignal,
2016
2128
  fetch: this.config.fetch
2017
2129
  });
2018
- const outputTextElements = response.output.filter((output) => output.type === "message").flatMap((output) => output.content).filter((content) => content.type === "output_text");
2019
- const toolCalls = response.output.filter((output) => output.type === "function_call").map((output) => ({
2020
- toolCallType: "function",
2021
- toolCallId: output.call_id,
2022
- toolName: output.name,
2023
- args: output.arguments
2024
- }));
2130
+ const content = [];
2131
+ for (const part of response.output) {
2132
+ switch (part.type) {
2133
+ case "message": {
2134
+ for (const contentPart of part.content) {
2135
+ content.push({
2136
+ type: "text",
2137
+ text: contentPart.text
2138
+ });
2139
+ for (const annotation of contentPart.annotations) {
2140
+ content.push({
2141
+ type: "source",
2142
+ sourceType: "url",
2143
+ id: (_c = (_b = (_a = this.config).generateId) == null ? void 0 : _b.call(_a)) != null ? _c : (0, import_provider_utils9.generateId)(),
2144
+ url: annotation.url,
2145
+ title: annotation.title
2146
+ });
2147
+ }
2148
+ }
2149
+ break;
2150
+ }
2151
+ case "function_call": {
2152
+ content.push({
2153
+ type: "tool-call",
2154
+ toolCallType: "function",
2155
+ toolCallId: part.call_id,
2156
+ toolName: part.name,
2157
+ args: part.arguments
2158
+ });
2159
+ break;
2160
+ }
2161
+ }
2162
+ }
2025
2163
  return {
2026
- text: outputTextElements.map((content) => content.text).join("\n"),
2027
- sources: outputTextElements.flatMap(
2028
- (content) => content.annotations.map((annotation) => {
2029
- var _a2, _b2, _c2;
2030
- return {
2031
- sourceType: "url",
2032
- id: (_c2 = (_b2 = (_a2 = this.config).generateId) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : (0, import_provider_utils8.generateId)(),
2033
- url: annotation.url,
2034
- title: annotation.title
2035
- };
2036
- })
2037
- ),
2164
+ content,
2038
2165
  finishReason: mapOpenAIResponseFinishReason({
2039
- finishReason: (_a = response.incomplete_details) == null ? void 0 : _a.reason,
2040
- hasToolCalls: toolCalls.length > 0
2166
+ finishReason: (_d = response.incomplete_details) == null ? void 0 : _d.reason,
2167
+ hasToolCalls: content.some((part) => part.type === "tool-call")
2041
2168
  }),
2042
- toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
2043
2169
  usage: {
2044
2170
  inputTokens: response.usage.input_tokens,
2045
2171
  outputTokens: response.usage.output_tokens
@@ -2055,8 +2181,8 @@ var OpenAIResponsesLanguageModel = class {
2055
2181
  providerMetadata: {
2056
2182
  openai: {
2057
2183
  responseId: response.id,
2058
- cachedPromptTokens: (_c = (_b = response.usage.input_tokens_details) == null ? void 0 : _b.cached_tokens) != null ? _c : null,
2059
- reasoningTokens: (_e = (_d = response.usage.output_tokens_details) == null ? void 0 : _d.reasoning_tokens) != null ? _e : null
2184
+ cachedPromptTokens: (_f = (_e = response.usage.input_tokens_details) == null ? void 0 : _e.cached_tokens) != null ? _f : null,
2185
+ reasoningTokens: (_h = (_g = response.usage.output_tokens_details) == null ? void 0 : _g.reasoning_tokens) != null ? _h : null
2060
2186
  }
2061
2187
  },
2062
2188
  warnings
@@ -2064,18 +2190,18 @@ var OpenAIResponsesLanguageModel = class {
2064
2190
  }
2065
2191
  async doStream(options) {
2066
2192
  const { args: body, warnings } = this.getArgs(options);
2067
- const { responseHeaders, value: response } = await (0, import_provider_utils8.postJsonToApi)({
2193
+ const { responseHeaders, value: response } = await (0, import_provider_utils9.postJsonToApi)({
2068
2194
  url: this.config.url({
2069
2195
  path: "/responses",
2070
2196
  modelId: this.modelId
2071
2197
  }),
2072
- headers: (0, import_provider_utils8.combineHeaders)(this.config.headers(), options.headers),
2198
+ headers: (0, import_provider_utils9.combineHeaders)(this.config.headers(), options.headers),
2073
2199
  body: {
2074
2200
  ...body,
2075
2201
  stream: true
2076
2202
  },
2077
2203
  failedResponseHandler: openaiFailedResponseHandler,
2078
- successfulResponseHandler: (0, import_provider_utils8.createEventSourceResponseHandler)(
2204
+ successfulResponseHandler: (0, import_provider_utils9.createEventSourceResponseHandler)(
2079
2205
  openaiResponsesChunkSchema
2080
2206
  ),
2081
2207
  abortSignal: options.abortSignal,
@@ -2095,6 +2221,9 @@ var OpenAIResponsesLanguageModel = class {
2095
2221
  return {
2096
2222
  stream: response.pipeThrough(
2097
2223
  new TransformStream({
2224
+ start(controller) {
2225
+ controller.enqueue({ type: "stream-start", warnings });
2226
+ },
2098
2227
  transform(chunk, controller) {
2099
2228
  var _a, _b, _c, _d, _e, _f, _g, _h;
2100
2229
  if (!chunk.success) {
@@ -2138,8 +2267,8 @@ var OpenAIResponsesLanguageModel = class {
2138
2267
  });
2139
2268
  } else if (isTextDeltaChunk(value)) {
2140
2269
  controller.enqueue({
2141
- type: "text-delta",
2142
- textDelta: value.delta
2270
+ type: "text",
2271
+ text: value.delta
2143
2272
  });
2144
2273
  } else if (isResponseOutputItemDoneChunk(value) && value.item.type === "function_call") {
2145
2274
  ongoingToolCalls[value.output_index] = void 0;
@@ -2163,12 +2292,10 @@ var OpenAIResponsesLanguageModel = class {
2163
2292
  } else if (isResponseAnnotationAddedChunk(value)) {
2164
2293
  controller.enqueue({
2165
2294
  type: "source",
2166
- source: {
2167
- sourceType: "url",
2168
- id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0, import_provider_utils8.generateId)(),
2169
- url: value.annotation.url,
2170
- title: value.annotation.title
2171
- }
2295
+ sourceType: "url",
2296
+ id: (_h = (_g = (_f = self.config).generateId) == null ? void 0 : _g.call(_f)) != null ? _h : (0, import_provider_utils9.generateId)(),
2297
+ url: value.annotation.url,
2298
+ title: value.annotation.title
2172
2299
  });
2173
2300
  }
2174
2301
  },
@@ -2191,84 +2318,83 @@ var OpenAIResponsesLanguageModel = class {
2191
2318
  })
2192
2319
  ),
2193
2320
  request: { body },
2194
- response: { headers: responseHeaders },
2195
- warnings
2321
+ response: { headers: responseHeaders }
2196
2322
  };
2197
2323
  }
2198
2324
  };
2199
- var usageSchema = import_zod8.z.object({
2200
- input_tokens: import_zod8.z.number(),
2201
- input_tokens_details: import_zod8.z.object({ cached_tokens: import_zod8.z.number().nullish() }).nullish(),
2202
- output_tokens: import_zod8.z.number(),
2203
- output_tokens_details: import_zod8.z.object({ reasoning_tokens: import_zod8.z.number().nullish() }).nullish()
2325
+ var usageSchema = import_zod9.z.object({
2326
+ input_tokens: import_zod9.z.number(),
2327
+ input_tokens_details: import_zod9.z.object({ cached_tokens: import_zod9.z.number().nullish() }).nullish(),
2328
+ output_tokens: import_zod9.z.number(),
2329
+ output_tokens_details: import_zod9.z.object({ reasoning_tokens: import_zod9.z.number().nullish() }).nullish()
2204
2330
  });
2205
- var textDeltaChunkSchema = import_zod8.z.object({
2206
- type: import_zod8.z.literal("response.output_text.delta"),
2207
- delta: import_zod8.z.string()
2331
+ var textDeltaChunkSchema = import_zod9.z.object({
2332
+ type: import_zod9.z.literal("response.output_text.delta"),
2333
+ delta: import_zod9.z.string()
2208
2334
  });
2209
- var responseFinishedChunkSchema = import_zod8.z.object({
2210
- type: import_zod8.z.enum(["response.completed", "response.incomplete"]),
2211
- response: import_zod8.z.object({
2212
- incomplete_details: import_zod8.z.object({ reason: import_zod8.z.string() }).nullish(),
2335
+ var responseFinishedChunkSchema = import_zod9.z.object({
2336
+ type: import_zod9.z.enum(["response.completed", "response.incomplete"]),
2337
+ response: import_zod9.z.object({
2338
+ incomplete_details: import_zod9.z.object({ reason: import_zod9.z.string() }).nullish(),
2213
2339
  usage: usageSchema
2214
2340
  })
2215
2341
  });
2216
- var responseCreatedChunkSchema = import_zod8.z.object({
2217
- type: import_zod8.z.literal("response.created"),
2218
- response: import_zod8.z.object({
2219
- id: import_zod8.z.string(),
2220
- created_at: import_zod8.z.number(),
2221
- model: import_zod8.z.string()
2342
+ var responseCreatedChunkSchema = import_zod9.z.object({
2343
+ type: import_zod9.z.literal("response.created"),
2344
+ response: import_zod9.z.object({
2345
+ id: import_zod9.z.string(),
2346
+ created_at: import_zod9.z.number(),
2347
+ model: import_zod9.z.string()
2222
2348
  })
2223
2349
  });
2224
- var responseOutputItemDoneSchema = import_zod8.z.object({
2225
- type: import_zod8.z.literal("response.output_item.done"),
2226
- output_index: import_zod8.z.number(),
2227
- item: import_zod8.z.discriminatedUnion("type", [
2228
- import_zod8.z.object({
2229
- type: import_zod8.z.literal("message")
2350
+ var responseOutputItemDoneSchema = import_zod9.z.object({
2351
+ type: import_zod9.z.literal("response.output_item.done"),
2352
+ output_index: import_zod9.z.number(),
2353
+ item: import_zod9.z.discriminatedUnion("type", [
2354
+ import_zod9.z.object({
2355
+ type: import_zod9.z.literal("message")
2230
2356
  }),
2231
- import_zod8.z.object({
2232
- type: import_zod8.z.literal("function_call"),
2233
- id: import_zod8.z.string(),
2234
- call_id: import_zod8.z.string(),
2235
- name: import_zod8.z.string(),
2236
- arguments: import_zod8.z.string(),
2237
- status: import_zod8.z.literal("completed")
2357
+ import_zod9.z.object({
2358
+ type: import_zod9.z.literal("function_call"),
2359
+ id: import_zod9.z.string(),
2360
+ call_id: import_zod9.z.string(),
2361
+ name: import_zod9.z.string(),
2362
+ arguments: import_zod9.z.string(),
2363
+ status: import_zod9.z.literal("completed")
2238
2364
  })
2239
2365
  ])
2240
2366
  });
2241
- var responseFunctionCallArgumentsDeltaSchema = import_zod8.z.object({
2242
- type: import_zod8.z.literal("response.function_call_arguments.delta"),
2243
- item_id: import_zod8.z.string(),
2244
- output_index: import_zod8.z.number(),
2245
- delta: import_zod8.z.string()
2367
+ var responseFunctionCallArgumentsDeltaSchema = import_zod9.z.object({
2368
+ type: import_zod9.z.literal("response.function_call_arguments.delta"),
2369
+ item_id: import_zod9.z.string(),
2370
+ output_index: import_zod9.z.number(),
2371
+ delta: import_zod9.z.string()
2246
2372
  });
2247
- var responseOutputItemAddedSchema = import_zod8.z.object({
2248
- type: import_zod8.z.literal("response.output_item.added"),
2249
- output_index: import_zod8.z.number(),
2250
- item: import_zod8.z.discriminatedUnion("type", [
2251
- import_zod8.z.object({
2252
- type: import_zod8.z.literal("message")
2373
+ var responseOutputItemAddedSchema = import_zod9.z.object({
2374
+ type: import_zod9.z.literal("response.output_item.added"),
2375
+ output_index: import_zod9.z.number(),
2376
+ item: import_zod9.z.discriminatedUnion("type", [
2377
+ import_zod9.z.object({
2378
+ type: import_zod9.z.literal("message")
2253
2379
  }),
2254
- import_zod8.z.object({
2255
- type: import_zod8.z.literal("function_call"),
2256
- id: import_zod8.z.string(),
2257
- call_id: import_zod8.z.string(),
2258
- name: import_zod8.z.string(),
2259
- arguments: import_zod8.z.string()
2380
+ import_zod9.z.object({
2381
+ type: import_zod9.z.literal("function_call"),
2382
+ id: import_zod9.z.string(),
2383
+ call_id: import_zod9.z.string(),
2384
+ name: import_zod9.z.string(),
2385
+ arguments: import_zod9.z.string()
2260
2386
  })
2261
2387
  ])
2262
2388
  });
2263
- var responseAnnotationAddedSchema = import_zod8.z.object({
2264
- type: import_zod8.z.literal("response.output_text.annotation.added"),
2265
- annotation: import_zod8.z.object({
2266
- type: import_zod8.z.literal("url_citation"),
2267
- url: import_zod8.z.string(),
2268
- title: import_zod8.z.string()
2389
+ var responseAnnotationAddedSchema = import_zod9.z.object({
2390
+ type: import_zod9.z.literal("response.output_text.annotation.added"),
2391
+ annotation: import_zod9.z.object({
2392
+ type: import_zod9.z.literal("url_citation"),
2393
+ url: import_zod9.z.string(),
2394
+ title: import_zod9.z.string()
2269
2395
  })
2270
2396
  });
2271
- var openaiResponsesChunkSchema = import_zod8.z.union([
2397
+ var openaiResponsesChunkSchema = import_zod9.z.union([
2272
2398
  textDeltaChunkSchema,
2273
2399
  responseFinishedChunkSchema,
2274
2400
  responseCreatedChunkSchema,
@@ -2276,7 +2402,7 @@ var openaiResponsesChunkSchema = import_zod8.z.union([
2276
2402
  responseFunctionCallArgumentsDeltaSchema,
2277
2403
  responseOutputItemAddedSchema,
2278
2404
  responseAnnotationAddedSchema,
2279
- import_zod8.z.object({ type: import_zod8.z.string() }).passthrough()
2405
+ import_zod9.z.object({ type: import_zod9.z.string() }).passthrough()
2280
2406
  // fallback for unknown chunks
2281
2407
  ]);
2282
2408
  function isTextDeltaChunk(chunk) {
@@ -2321,15 +2447,15 @@ function getResponsesModelConfig(modelId) {
2321
2447
  requiredAutoTruncation: false
2322
2448
  };
2323
2449
  }
2324
- var openaiResponsesProviderOptionsSchema = import_zod8.z.object({
2325
- metadata: import_zod8.z.any().nullish(),
2326
- parallelToolCalls: import_zod8.z.boolean().nullish(),
2327
- previousResponseId: import_zod8.z.string().nullish(),
2328
- store: import_zod8.z.boolean().nullish(),
2329
- user: import_zod8.z.string().nullish(),
2330
- reasoningEffort: import_zod8.z.string().nullish(),
2331
- strictSchemas: import_zod8.z.boolean().nullish(),
2332
- instructions: import_zod8.z.string().nullish()
2450
+ var openaiResponsesProviderOptionsSchema = import_zod9.z.object({
2451
+ metadata: import_zod9.z.any().nullish(),
2452
+ parallelToolCalls: import_zod9.z.boolean().nullish(),
2453
+ previousResponseId: import_zod9.z.string().nullish(),
2454
+ store: import_zod9.z.boolean().nullish(),
2455
+ user: import_zod9.z.string().nullish(),
2456
+ reasoningEffort: import_zod9.z.string().nullish(),
2457
+ strictSchemas: import_zod9.z.boolean().nullish(),
2458
+ instructions: import_zod9.z.string().nullish()
2333
2459
  });
2334
2460
  // Annotate the CommonJS export names for ESM import in node:
2335
2461
  0 && (module.exports = {
@@ -2338,6 +2464,7 @@ var openaiResponsesProviderOptionsSchema = import_zod8.z.object({
2338
2464
  OpenAIEmbeddingModel,
2339
2465
  OpenAIImageModel,
2340
2466
  OpenAIResponsesLanguageModel,
2467
+ OpenAISpeechModel,
2341
2468
  OpenAITranscriptionModel,
2342
2469
  modelMaxImagesPerCall,
2343
2470
  openaiProviderOptions