@ai-sdk/openai 4.0.52 → 4.0.54

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.
@@ -101,13 +101,18 @@ declare class OpenAICompletionLanguageModel implements LanguageModelV4 {
101
101
  doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
102
102
  }
103
103
 
104
+ type OpenAIHeaders = Record<string, string | undefined>;
105
+ type SerializedOpenAIConfig = Omit<Partial<OpenAIConfig>, 'headers'> & {
106
+ headers?: (() => OpenAIHeaders) | OpenAIHeaders;
107
+ };
104
108
  type OpenAIConfig = {
105
109
  provider: string;
110
+ baseURL?: string;
106
111
  url: (options: {
107
112
  modelId: string;
108
113
  path: string;
109
114
  }) => string;
110
- headers?: () => Record<string, string | undefined>;
115
+ headers?: () => OpenAIHeaders;
111
116
  fetch?: FetchFunction;
112
117
  webSocket?: WebSocketConstructor;
113
118
  generateId?: () => string;
@@ -121,6 +126,7 @@ type OpenAIConfig = {
121
126
  */
122
127
  fileIdPrefixes?: readonly string[];
123
128
  };
129
+ declare function prepareOpenAIConfigForWorkflowDeserialize(config: SerializedOpenAIConfig): OpenAIConfig;
124
130
 
125
131
  type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
126
132
  declare const openaiEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
@@ -897,7 +903,10 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
897
903
  } | {
898
904
  type: "response.completed" | "response.incomplete";
899
905
  response: {
900
- usage: {
906
+ incomplete_details?: {
907
+ reason: string;
908
+ } | null | undefined;
909
+ usage?: {
901
910
  input_tokens: number;
902
911
  output_tokens: number;
903
912
  input_tokens_details?: {
@@ -910,9 +919,6 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
910
919
  reasoning_tokens?: number | null | undefined;
911
920
  orchestration_output_tokens?: number | null | undefined;
912
921
  } | null | undefined;
913
- };
914
- incomplete_details?: {
915
- reason: string;
916
922
  } | null | undefined;
917
923
  reasoning?: {
918
924
  context?: string | null | undefined;
@@ -1586,6 +1592,213 @@ type OpenAIResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1586
1592
  type OpenAIResponsesLogprobs = NonNullable<(OpenAIResponsesChunk & {
1587
1593
  type: 'response.output_text.delta';
1588
1594
  })['logprobs']> | null;
1595
+ type OpenAIResponsesWebSearchAction = NonNullable<((OpenAIResponsesChunk & {
1596
+ type: 'response.output_item.done';
1597
+ })['item'] & {
1598
+ type: 'web_search_call';
1599
+ })['action']>;
1600
+
1601
+ declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1602
+ externalWebAccess?: boolean | undefined;
1603
+ filters?: {
1604
+ allowedDomains?: string[] | undefined;
1605
+ blockedDomains?: string[] | undefined;
1606
+ } | undefined;
1607
+ searchContextSize?: "low" | "medium" | "high" | undefined;
1608
+ userLocation?: {
1609
+ type: "approximate";
1610
+ country?: string | undefined;
1611
+ city?: string | undefined;
1612
+ region?: string | undefined;
1613
+ timezone?: string | undefined;
1614
+ } | undefined;
1615
+ }>;
1616
+ declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
1617
+ action?: {
1618
+ type: "search";
1619
+ query?: string | undefined;
1620
+ queries?: string[] | undefined;
1621
+ } | {
1622
+ type: "openPage";
1623
+ url?: string | null | undefined;
1624
+ } | {
1625
+ type: "findInPage";
1626
+ url?: string | null | undefined;
1627
+ pattern?: string | null | undefined;
1628
+ } | undefined;
1629
+ sources?: ({
1630
+ type: "url";
1631
+ url: string;
1632
+ } | {
1633
+ type: "api";
1634
+ name: string;
1635
+ })[] | undefined;
1636
+ }>;
1637
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
1638
+ /**
1639
+ * An object describing the specific action taken in this web search call.
1640
+ * Includes details on how the model used the web (search, open_page, find_in_page).
1641
+ */
1642
+ action?: {
1643
+ /**
1644
+ * Action type "search" - Performs a web search query.
1645
+ */
1646
+ type: "search";
1647
+ /**
1648
+ * The search query.
1649
+ *
1650
+ * @deprecated Use `queries` instead.
1651
+ */
1652
+ query?: string;
1653
+ /**
1654
+ * The search queries the model used.
1655
+ */
1656
+ queries?: string[];
1657
+ } | {
1658
+ /**
1659
+ * Action type "openPage" - Opens a specific URL from search results.
1660
+ */
1661
+ type: "openPage";
1662
+ /**
1663
+ * The URL opened by the model.
1664
+ */
1665
+ url?: string | null;
1666
+ } | {
1667
+ /**
1668
+ * Action type "findInPage": Searches for a pattern within a loaded page.
1669
+ */
1670
+ type: "findInPage";
1671
+ /**
1672
+ * The URL of the page searched for the pattern.
1673
+ */
1674
+ url?: string | null;
1675
+ /**
1676
+ * The pattern or text to search for within the page.
1677
+ */
1678
+ pattern?: string | null;
1679
+ };
1680
+ /**
1681
+ * Optional sources cited by the model for the web search call.
1682
+ */
1683
+ sources?: Array<{
1684
+ type: "url";
1685
+ url: string;
1686
+ } | {
1687
+ type: "api";
1688
+ name: string;
1689
+ }>;
1690
+ }, {
1691
+ /**
1692
+ * Whether to use external web access for fetching live content.
1693
+ * - true: Fetch live web content (default)
1694
+ * - false: Use cached/indexed results
1695
+ */
1696
+ externalWebAccess?: boolean;
1697
+ /**
1698
+ * Filters for the search.
1699
+ */
1700
+ filters?: {
1701
+ /**
1702
+ * Allowed domains for the search.
1703
+ * If not provided, all domains are allowed.
1704
+ * Subdomains of the provided domains are allowed as well.
1705
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
1706
+ */
1707
+ allowedDomains?: string[];
1708
+ /**
1709
+ * Blocked domains for the search.
1710
+ * Subdomains of the provided domains are blocked as well.
1711
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
1712
+ */
1713
+ blockedDomains?: string[];
1714
+ };
1715
+ /**
1716
+ * Search context size to use for the web search.
1717
+ * - high: Most comprehensive context, highest cost, slower response
1718
+ * - medium: Balanced context, cost, and latency (default)
1719
+ * - low: Least context, lowest cost, fastest response
1720
+ */
1721
+ searchContextSize?: "low" | "medium" | "high";
1722
+ /**
1723
+ * User location information to provide geographically relevant search results.
1724
+ */
1725
+ userLocation?: {
1726
+ /**
1727
+ * Type of location (always 'approximate')
1728
+ */
1729
+ type: "approximate";
1730
+ /**
1731
+ * Two-letter ISO country code (e.g., 'US', 'GB')
1732
+ */
1733
+ country?: string;
1734
+ /**
1735
+ * City name (free text, e.g., 'Minneapolis')
1736
+ */
1737
+ city?: string;
1738
+ /**
1739
+ * Region name (free text, e.g., 'Minnesota')
1740
+ */
1741
+ region?: string;
1742
+ /**
1743
+ * IANA timezone (e.g., 'America/Chicago')
1744
+ */
1745
+ timezone?: string;
1746
+ };
1747
+ }, {}>;
1748
+ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
1749
+ /**
1750
+ * An object describing the specific action taken in this web search call.
1751
+ * Includes details on how the model used the web (search, open_page, find_in_page).
1752
+ */
1753
+ action?: {
1754
+ /**
1755
+ * Action type "search" - Performs a web search query.
1756
+ */
1757
+ type: "search";
1758
+ /**
1759
+ * The search query.
1760
+ *
1761
+ * @deprecated Use `queries` instead.
1762
+ */
1763
+ query?: string;
1764
+ /**
1765
+ * The search queries the model used.
1766
+ */
1767
+ queries?: string[];
1768
+ } | {
1769
+ /**
1770
+ * Action type "openPage" - Opens a specific URL from search results.
1771
+ */
1772
+ type: "openPage";
1773
+ /**
1774
+ * The URL opened by the model.
1775
+ */
1776
+ url?: string | null;
1777
+ } | {
1778
+ /**
1779
+ * Action type "findInPage": Searches for a pattern within a loaded page.
1780
+ */
1781
+ type: "findInPage";
1782
+ /**
1783
+ * The URL of the page searched for the pattern.
1784
+ */
1785
+ url?: string | null;
1786
+ /**
1787
+ * The pattern or text to search for within the page.
1788
+ */
1789
+ pattern?: string | null;
1790
+ };
1791
+ /**
1792
+ * Optional sources cited by the model for the web search call.
1793
+ */
1794
+ sources?: Array<{
1795
+ type: "url";
1796
+ url: string;
1797
+ } | {
1798
+ type: "api";
1799
+ name: string;
1800
+ }>;
1801
+ }, {}>;
1589
1802
 
1590
1803
  type OpenAIResponsesModelId = 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.2-codex' | 'gpt-5.3-chat-latest' | 'gpt-5.3-codex' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | 'o4-mini' | 'o4-mini-2025-04-16' | (string & {});
1591
1804
 
@@ -1598,8 +1811,8 @@ declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1598
1811
  config: _ai_sdk_provider.JSONObject;
1599
1812
  };
1600
1813
  static [WORKFLOW_DESERIALIZE](options: {
1601
- modelId: OpenAIResponsesModelId;
1602
- config: OpenAIConfig;
1814
+ modelId: string;
1815
+ config: Parameters<typeof prepareOpenAIConfigForWorkflowDeserialize>[0];
1603
1816
  }): OpenAIResponsesLanguageModel;
1604
1817
  constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
1605
1818
  readonly supportedUrls: Record<string, RegExp[]>;
@@ -1697,6 +1910,7 @@ declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1697
1910
  doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
1698
1911
  doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
1699
1912
  }
1913
+ declare function mapWebSearchOutput(action: OpenAIResponsesWebSearchAction | null | undefined): InferSchema<typeof webSearchOutputSchema>;
1700
1914
 
1701
1915
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1702
1916
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
@@ -2153,208 +2367,6 @@ declare const programmaticToolCalling: () => _ai_sdk_provider_utils.Experimental
2153
2367
  status: "completed" | "incomplete";
2154
2368
  }, {}>>;
2155
2369
 
2156
- declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
2157
- externalWebAccess?: boolean | undefined;
2158
- filters?: {
2159
- allowedDomains?: string[] | undefined;
2160
- blockedDomains?: string[] | undefined;
2161
- } | undefined;
2162
- searchContextSize?: "low" | "medium" | "high" | undefined;
2163
- userLocation?: {
2164
- type: "approximate";
2165
- country?: string | undefined;
2166
- city?: string | undefined;
2167
- region?: string | undefined;
2168
- timezone?: string | undefined;
2169
- } | undefined;
2170
- }>;
2171
- declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
2172
- action?: {
2173
- type: "search";
2174
- query?: string | undefined;
2175
- queries?: string[] | undefined;
2176
- } | {
2177
- type: "openPage";
2178
- url?: string | null | undefined;
2179
- } | {
2180
- type: "findInPage";
2181
- url?: string | null | undefined;
2182
- pattern?: string | null | undefined;
2183
- } | undefined;
2184
- sources?: ({
2185
- type: "url";
2186
- url: string;
2187
- } | {
2188
- type: "api";
2189
- name: string;
2190
- })[] | undefined;
2191
- }>;
2192
- declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
2193
- /**
2194
- * An object describing the specific action taken in this web search call.
2195
- * Includes details on how the model used the web (search, open_page, find_in_page).
2196
- */
2197
- action?: {
2198
- /**
2199
- * Action type "search" - Performs a web search query.
2200
- */
2201
- type: "search";
2202
- /**
2203
- * The search query.
2204
- *
2205
- * @deprecated Use `queries` instead.
2206
- */
2207
- query?: string;
2208
- /**
2209
- * The search queries the model used.
2210
- */
2211
- queries?: string[];
2212
- } | {
2213
- /**
2214
- * Action type "openPage" - Opens a specific URL from search results.
2215
- */
2216
- type: "openPage";
2217
- /**
2218
- * The URL opened by the model.
2219
- */
2220
- url?: string | null;
2221
- } | {
2222
- /**
2223
- * Action type "findInPage": Searches for a pattern within a loaded page.
2224
- */
2225
- type: "findInPage";
2226
- /**
2227
- * The URL of the page searched for the pattern.
2228
- */
2229
- url?: string | null;
2230
- /**
2231
- * The pattern or text to search for within the page.
2232
- */
2233
- pattern?: string | null;
2234
- };
2235
- /**
2236
- * Optional sources cited by the model for the web search call.
2237
- */
2238
- sources?: Array<{
2239
- type: "url";
2240
- url: string;
2241
- } | {
2242
- type: "api";
2243
- name: string;
2244
- }>;
2245
- }, {
2246
- /**
2247
- * Whether to use external web access for fetching live content.
2248
- * - true: Fetch live web content (default)
2249
- * - false: Use cached/indexed results
2250
- */
2251
- externalWebAccess?: boolean;
2252
- /**
2253
- * Filters for the search.
2254
- */
2255
- filters?: {
2256
- /**
2257
- * Allowed domains for the search.
2258
- * If not provided, all domains are allowed.
2259
- * Subdomains of the provided domains are allowed as well.
2260
- * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
2261
- */
2262
- allowedDomains?: string[];
2263
- /**
2264
- * Blocked domains for the search.
2265
- * Subdomains of the provided domains are blocked as well.
2266
- * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
2267
- */
2268
- blockedDomains?: string[];
2269
- };
2270
- /**
2271
- * Search context size to use for the web search.
2272
- * - high: Most comprehensive context, highest cost, slower response
2273
- * - medium: Balanced context, cost, and latency (default)
2274
- * - low: Least context, lowest cost, fastest response
2275
- */
2276
- searchContextSize?: "low" | "medium" | "high";
2277
- /**
2278
- * User location information to provide geographically relevant search results.
2279
- */
2280
- userLocation?: {
2281
- /**
2282
- * Type of location (always 'approximate')
2283
- */
2284
- type: "approximate";
2285
- /**
2286
- * Two-letter ISO country code (e.g., 'US', 'GB')
2287
- */
2288
- country?: string;
2289
- /**
2290
- * City name (free text, e.g., 'Minneapolis')
2291
- */
2292
- city?: string;
2293
- /**
2294
- * Region name (free text, e.g., 'Minnesota')
2295
- */
2296
- region?: string;
2297
- /**
2298
- * IANA timezone (e.g., 'America/Chicago')
2299
- */
2300
- timezone?: string;
2301
- };
2302
- }, {}>;
2303
- declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
2304
- /**
2305
- * An object describing the specific action taken in this web search call.
2306
- * Includes details on how the model used the web (search, open_page, find_in_page).
2307
- */
2308
- action?: {
2309
- /**
2310
- * Action type "search" - Performs a web search query.
2311
- */
2312
- type: "search";
2313
- /**
2314
- * The search query.
2315
- *
2316
- * @deprecated Use `queries` instead.
2317
- */
2318
- query?: string;
2319
- /**
2320
- * The search queries the model used.
2321
- */
2322
- queries?: string[];
2323
- } | {
2324
- /**
2325
- * Action type "openPage" - Opens a specific URL from search results.
2326
- */
2327
- type: "openPage";
2328
- /**
2329
- * The URL opened by the model.
2330
- */
2331
- url?: string | null;
2332
- } | {
2333
- /**
2334
- * Action type "findInPage": Searches for a pattern within a loaded page.
2335
- */
2336
- type: "findInPage";
2337
- /**
2338
- * The URL of the page searched for the pattern.
2339
- */
2340
- url?: string | null;
2341
- /**
2342
- * The pattern or text to search for within the page.
2343
- */
2344
- pattern?: string | null;
2345
- };
2346
- /**
2347
- * Optional sources cited by the model for the web search call.
2348
- */
2349
- sources?: Array<{
2350
- type: "url";
2351
- url: string;
2352
- } | {
2353
- type: "api";
2354
- name: string;
2355
- }>;
2356
- }, {}>;
2357
-
2358
2370
  declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
2359
2371
  searchContextSize?: "low" | "medium" | "high" | undefined;
2360
2372
  userLocation?: {
@@ -2438,4 +2450,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderExecutedToolFacto
2438
2450
  };
2439
2451
  }, {}>;
2440
2452
 
2441
- export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenAITranscriptionStreamOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesCompactionProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, programmaticToolCalling, programmaticToolCallingInputSchema, programmaticToolCallingOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
2453
+ export { type ApplyPatchOperation, OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingModelOptions, OpenAIImageModel, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, OpenAIResponsesLanguageModel, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAISpeechModelOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, type OpenAITranscriptionStreamOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type ResponsesCompactionProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, mapWebSearchOutput, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, programmaticToolCalling, programmaticToolCallingInputSchema, programmaticToolCallingOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -3072,6 +3072,28 @@ import {
3072
3072
  WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE7
3073
3073
  } from "@ai-sdk/provider-utils";
3074
3074
 
3075
+ // src/openai-config.ts
3076
+ function prepareOpenAIConfigForWorkflowDeserialize(config) {
3077
+ if (config.provider == null) {
3078
+ throw new Error(
3079
+ "OpenAI model is missing provider after workflow deserialization."
3080
+ );
3081
+ }
3082
+ return {
3083
+ ...config,
3084
+ provider: config.provider,
3085
+ url: typeof config.url === "function" ? config.url : ({ path }) => {
3086
+ if (config.baseURL == null) {
3087
+ throw new Error(
3088
+ "OpenAI model is missing baseURL after workflow deserialization."
3089
+ );
3090
+ }
3091
+ return `${config.baseURL}${path}`;
3092
+ },
3093
+ headers: typeof config.headers === "function" ? config.headers : config.headers == null ? void 0 : () => config.headers
3094
+ };
3095
+ }
3096
+
3075
3097
  // src/responses/convert-openai-responses-usage.ts
3076
3098
  import { createNullLanguageModelUsage as createNullLanguageModelUsage3 } from "@ai-sdk/provider-utils";
3077
3099
  function convertOpenAIResponsesUsage(usage) {
@@ -4926,7 +4948,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4926
4948
  reasoning_tokens: z20.number().nullish(),
4927
4949
  orchestration_output_tokens: z20.number().nullish()
4928
4950
  }).nullish()
4929
- }),
4951
+ }).nullish(),
4930
4952
  reasoning: z20.object({
4931
4953
  context: z20.string().nullish()
4932
4954
  }).nullish(),
@@ -5758,7 +5780,7 @@ var openaiResponsesResponseSchema = lazySchema18(
5758
5780
  reasoning_tokens: z20.number().nullish(),
5759
5781
  orchestration_output_tokens: z20.number().nullish()
5760
5782
  }).nullish()
5761
- }).optional()
5783
+ }).nullish()
5762
5784
  })
5763
5785
  )
5764
5786
  );
@@ -6984,7 +7006,10 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6984
7006
  });
6985
7007
  }
6986
7008
  static [WORKFLOW_DESERIALIZE7](options) {
6987
- return new _OpenAIResponsesLanguageModel(options.modelId, options.config);
7009
+ return new _OpenAIResponsesLanguageModel(
7010
+ options.modelId,
7011
+ prepareOpenAIConfigForWorkflowDeserialize(options.config)
7012
+ );
6988
7013
  }
6989
7014
  get provider() {
6990
7015
  return this.config.provider;
@@ -7935,7 +7960,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7935
7960
  controller.enqueue({ type: "stream-start", warnings });
7936
7961
  },
7937
7962
  transform(chunk, controller) {
7938
- var _a3, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R;
7963
+ var _a3, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S;
7939
7964
  if (options.includeRawChunks) {
7940
7965
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
7941
7966
  }
@@ -8870,15 +8895,15 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8870
8895
  raw: (_z = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason) != null ? _z : void 0
8871
8896
  };
8872
8897
  }
8873
- usage = value.response.usage;
8898
+ usage = (_A = value.response.usage) != null ? _A : void 0;
8874
8899
  if (typeof value.response.service_tier === "string") {
8875
8900
  serviceTier = value.response.service_tier;
8876
8901
  }
8877
- if (((_A = value.response.reasoning) == null ? void 0 : _A.context) != null) {
8902
+ if (((_B = value.response.reasoning) == null ? void 0 : _B.context) != null) {
8878
8903
  reasoningContext = value.response.reasoning.context;
8879
8904
  }
8880
8905
  } else if (isResponseFailedChunk(value)) {
8881
- const incompleteReason = (_B = value.response.incomplete_details) == null ? void 0 : _B.reason;
8906
+ const incompleteReason = (_C = value.response.incomplete_details) == null ? void 0 : _C.reason;
8882
8907
  finishReason = {
8883
8908
  unified: incompleteReason ? mapOpenAIResponseFinishReason({
8884
8909
  finishReason: incompleteReason,
@@ -8886,8 +8911,8 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8886
8911
  }) : "error",
8887
8912
  raw: incompleteReason != null ? incompleteReason : "error"
8888
8913
  };
8889
- usage = (_C = value.response.usage) != null ? _C : void 0;
8890
- if (((_D = value.response.reasoning) == null ? void 0 : _D.context) != null) {
8914
+ usage = (_D = value.response.usage) != null ? _D : void 0;
8915
+ if (((_E = value.response.reasoning) == null ? void 0 : _E.context) != null) {
8891
8916
  reasoningContext = value.response.reasoning.context;
8892
8917
  }
8893
8918
  if (!encounteredStreamError && value.response.error != null) {
@@ -8903,7 +8928,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8903
8928
  };
8904
8929
  controller.enqueue({
8905
8930
  type: "error",
8906
- error: (_E = createOpenAIProviderStreamError(error)) != null ? _E : error
8931
+ error: (_F = createOpenAIProviderStreamError(error)) != null ? _F : error
8907
8932
  });
8908
8933
  }
8909
8934
  } else if (isResponseAnnotationAddedChunk(value)) {
@@ -8912,7 +8937,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8912
8937
  controller.enqueue({
8913
8938
  type: "source",
8914
8939
  sourceType: "url",
8915
- id: (_H = (_G = (_F = self.config).generateId) == null ? void 0 : _G.call(_F)) != null ? _H : generateId2(),
8940
+ id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : generateId2(),
8916
8941
  url: value.annotation.url,
8917
8942
  title: value.annotation.title
8918
8943
  });
@@ -8920,7 +8945,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8920
8945
  controller.enqueue({
8921
8946
  type: "source",
8922
8947
  sourceType: "document",
8923
- id: (_K = (_J = (_I = self.config).generateId) == null ? void 0 : _J.call(_I)) != null ? _K : generateId2(),
8948
+ id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : generateId2(),
8924
8949
  mediaType: "text/plain",
8925
8950
  title: value.annotation.filename,
8926
8951
  filename: value.annotation.filename,
@@ -8936,7 +8961,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8936
8961
  controller.enqueue({
8937
8962
  type: "source",
8938
8963
  sourceType: "document",
8939
- id: (_N = (_M = (_L = self.config).generateId) == null ? void 0 : _M.call(_L)) != null ? _N : generateId2(),
8964
+ id: (_O = (_N = (_M = self.config).generateId) == null ? void 0 : _N.call(_M)) != null ? _O : generateId2(),
8940
8965
  mediaType: "text/plain",
8941
8966
  title: value.annotation.filename,
8942
8967
  filename: value.annotation.filename,
@@ -8952,7 +8977,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8952
8977
  controller.enqueue({
8953
8978
  type: "source",
8954
8979
  sourceType: "document",
8955
- id: (_Q = (_P = (_O = self.config).generateId) == null ? void 0 : _P.call(_O)) != null ? _Q : generateId2(),
8980
+ id: (_R = (_Q = (_P = self.config).generateId) == null ? void 0 : _Q.call(_P)) != null ? _R : generateId2(),
8956
8981
  mediaType: "application/octet-stream",
8957
8982
  title: value.annotation.file_id,
8958
8983
  filename: value.annotation.file_id,
@@ -8970,7 +8995,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
8970
8995
  finishReason = { unified: "error", raw: "error" };
8971
8996
  controller.enqueue({
8972
8997
  type: "error",
8973
- error: (_R = createOpenAIProviderStreamError(value)) != null ? _R : value
8998
+ error: (_S = createOpenAIProviderStreamError(value)) != null ? _S : value
8974
8999
  });
8975
9000
  }
8976
9001
  },
@@ -9149,6 +9174,7 @@ export {
9149
9174
  imageGeneration,
9150
9175
  imageGenerationArgsSchema,
9151
9176
  imageGenerationOutputSchema,
9177
+ mapWebSearchOutput,
9152
9178
  modelMaxImagesPerCall,
9153
9179
  openAITranscriptionModelOptions,
9154
9180
  openaiEmbeddingModelOptions,