@ai-sdk/openai 3.0.132 → 3.0.134

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.
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, FlexibleSchema } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | '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.3-chat-latest' | '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-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | '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.3-chat-latest' | '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-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
6
6
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
@@ -226,19 +226,207 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
226
226
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
227
227
  }
228
228
 
229
- 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-6-astra' | 'gpt-6.1-sol' | 'gpt-6-luna' | 'gpt-6-sol' | '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 & {});
230
-
231
- declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
232
- readonly specificationVersion = "v3";
233
- readonly modelId: OpenAIResponsesModelId;
234
- private readonly config;
235
- constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
236
- readonly supportedUrls: Record<string, RegExp[]>;
237
- get provider(): string;
238
- private getArgs;
239
- doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
240
- doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
241
- }
229
+ declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
230
+ externalWebAccess?: boolean | undefined;
231
+ filters?: {
232
+ allowedDomains?: string[] | undefined;
233
+ blockedDomains?: string[] | undefined;
234
+ } | undefined;
235
+ searchContextSize?: "low" | "medium" | "high" | undefined;
236
+ userLocation?: {
237
+ type: "approximate";
238
+ country?: string | undefined;
239
+ city?: string | undefined;
240
+ region?: string | undefined;
241
+ timezone?: string | undefined;
242
+ } | undefined;
243
+ }>;
244
+ declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
245
+ action?: {
246
+ type: "search";
247
+ query?: string | undefined;
248
+ queries?: string[] | undefined;
249
+ } | {
250
+ type: "openPage";
251
+ url?: string | null | undefined;
252
+ } | {
253
+ type: "findInPage";
254
+ url?: string | null | undefined;
255
+ pattern?: string | null | undefined;
256
+ } | undefined;
257
+ sources?: ({
258
+ type: "url";
259
+ url: string;
260
+ } | {
261
+ type: "api";
262
+ name: string;
263
+ })[] | undefined;
264
+ }>;
265
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
266
+ /**
267
+ * An object describing the specific action taken in this web search call.
268
+ * Includes details on how the model used the web (search, open_page, find_in_page).
269
+ */
270
+ action?: {
271
+ /**
272
+ * Action type "search" - Performs a web search query.
273
+ */
274
+ type: "search";
275
+ /**
276
+ * The search query.
277
+ *
278
+ * @deprecated Use `queries` instead.
279
+ */
280
+ query?: string;
281
+ /**
282
+ * The search queries the model used.
283
+ */
284
+ queries?: string[];
285
+ } | {
286
+ /**
287
+ * Action type "openPage" - Opens a specific URL from search results.
288
+ */
289
+ type: "openPage";
290
+ /**
291
+ * The URL opened by the model.
292
+ */
293
+ url?: string | null;
294
+ } | {
295
+ /**
296
+ * Action type "findInPage": Searches for a pattern within a loaded page.
297
+ */
298
+ type: "findInPage";
299
+ /**
300
+ * The URL of the page searched for the pattern.
301
+ */
302
+ url?: string | null;
303
+ /**
304
+ * The pattern or text to search for within the page.
305
+ */
306
+ pattern?: string | null;
307
+ };
308
+ /**
309
+ * Optional sources cited by the model for the web search call.
310
+ */
311
+ sources?: Array<{
312
+ type: "url";
313
+ url: string;
314
+ } | {
315
+ type: "api";
316
+ name: string;
317
+ }>;
318
+ }, {
319
+ /**
320
+ * Whether to use external web access for fetching live content.
321
+ * - true: Fetch live web content (default)
322
+ * - false: Use cached/indexed results
323
+ */
324
+ externalWebAccess?: boolean;
325
+ /**
326
+ * Filters for the search.
327
+ */
328
+ filters?: {
329
+ /**
330
+ * Allowed domains for the search.
331
+ * If not provided, all domains are allowed.
332
+ * Subdomains of the provided domains are allowed as well.
333
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
334
+ */
335
+ allowedDomains?: string[];
336
+ /**
337
+ * Blocked domains for the search.
338
+ * Subdomains of the provided domains are blocked as well.
339
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
340
+ */
341
+ blockedDomains?: string[];
342
+ };
343
+ /**
344
+ * Search context size to use for the web search.
345
+ * - high: Most comprehensive context, highest cost, slower response
346
+ * - medium: Balanced context, cost, and latency (default)
347
+ * - low: Least context, lowest cost, fastest response
348
+ */
349
+ searchContextSize?: "low" | "medium" | "high";
350
+ /**
351
+ * User location information to provide geographically relevant search results.
352
+ */
353
+ userLocation?: {
354
+ /**
355
+ * Type of location (always 'approximate')
356
+ */
357
+ type: "approximate";
358
+ /**
359
+ * Two-letter ISO country code (e.g., 'US', 'GB')
360
+ */
361
+ country?: string;
362
+ /**
363
+ * City name (free text, e.g., 'Minneapolis')
364
+ */
365
+ city?: string;
366
+ /**
367
+ * Region name (free text, e.g., 'Minnesota')
368
+ */
369
+ region?: string;
370
+ /**
371
+ * IANA timezone (e.g., 'America/Chicago')
372
+ */
373
+ timezone?: string;
374
+ };
375
+ }>;
376
+ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
377
+ /**
378
+ * An object describing the specific action taken in this web search call.
379
+ * Includes details on how the model used the web (search, open_page, find_in_page).
380
+ */
381
+ action?: {
382
+ /**
383
+ * Action type "search" - Performs a web search query.
384
+ */
385
+ type: "search";
386
+ /**
387
+ * The search query.
388
+ *
389
+ * @deprecated Use `queries` instead.
390
+ */
391
+ query?: string;
392
+ /**
393
+ * The search queries the model used.
394
+ */
395
+ queries?: string[];
396
+ } | {
397
+ /**
398
+ * Action type "openPage" - Opens a specific URL from search results.
399
+ */
400
+ type: "openPage";
401
+ /**
402
+ * The URL opened by the model.
403
+ */
404
+ url?: string | null;
405
+ } | {
406
+ /**
407
+ * Action type "findInPage": Searches for a pattern within a loaded page.
408
+ */
409
+ type: "findInPage";
410
+ /**
411
+ * The URL of the page searched for the pattern.
412
+ */
413
+ url?: string | null;
414
+ /**
415
+ * The pattern or text to search for within the page.
416
+ */
417
+ pattern?: string | null;
418
+ };
419
+ /**
420
+ * Optional sources cited by the model for the web search call.
421
+ */
422
+ sources?: Array<{
423
+ type: "url";
424
+ url: string;
425
+ } | {
426
+ type: "api";
427
+ name: string;
428
+ }>;
429
+ }>;
242
430
 
243
431
  /**
244
432
  * A filter used to compare a specified attribute key to a given value using a defined comparison operation.
@@ -775,6 +963,36 @@ type OpenAIResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
775
963
  type OpenAIResponsesLogprobs = NonNullable<(OpenAIResponsesChunk & {
776
964
  type: 'response.output_text.delta';
777
965
  })['logprobs']> | null;
966
+ type OpenAIResponsesWebSearchAction = NonNullable<((OpenAIResponsesChunk & {
967
+ type: 'response.output_item.done';
968
+ })['item'] & {
969
+ type: 'web_search_call';
970
+ })['action']>;
971
+
972
+ 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-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | '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 & {});
973
+
974
+ declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
975
+ readonly specificationVersion = "v3";
976
+ readonly modelId: OpenAIResponsesModelId;
977
+ private readonly config;
978
+ constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
979
+ readonly supportedUrls: Record<string, RegExp[]>;
980
+ get provider(): string;
981
+ private getArgs;
982
+ doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
983
+ doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
984
+ }
985
+ declare function mapWebSearchResult({ action, status, }: {
986
+ action?: OpenAIResponsesWebSearchAction | null;
987
+ status: string;
988
+ }): {
989
+ isError: true;
990
+ result: {
991
+ status: string;
992
+ };
993
+ } | {
994
+ result: InferSchema<typeof webSearchOutputSchema>;
995
+ };
778
996
 
779
997
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
780
998
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
@@ -1291,208 +1509,6 @@ declare const toolSearch: (args?: Parameters<typeof toolSearchToolFactory>[0]) =
1291
1509
  tools: Array<JSONObject>;
1292
1510
  }>;
1293
1511
 
1294
- declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1295
- externalWebAccess?: boolean | undefined;
1296
- filters?: {
1297
- allowedDomains?: string[] | undefined;
1298
- blockedDomains?: string[] | undefined;
1299
- } | undefined;
1300
- searchContextSize?: "low" | "medium" | "high" | undefined;
1301
- userLocation?: {
1302
- type: "approximate";
1303
- country?: string | undefined;
1304
- city?: string | undefined;
1305
- region?: string | undefined;
1306
- timezone?: string | undefined;
1307
- } | undefined;
1308
- }>;
1309
- declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
1310
- action?: {
1311
- type: "search";
1312
- query?: string | undefined;
1313
- queries?: string[] | undefined;
1314
- } | {
1315
- type: "openPage";
1316
- url?: string | null | undefined;
1317
- } | {
1318
- type: "findInPage";
1319
- url?: string | null | undefined;
1320
- pattern?: string | null | undefined;
1321
- } | undefined;
1322
- sources?: ({
1323
- type: "url";
1324
- url: string;
1325
- } | {
1326
- type: "api";
1327
- name: string;
1328
- })[] | undefined;
1329
- }>;
1330
- declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
1331
- /**
1332
- * An object describing the specific action taken in this web search call.
1333
- * Includes details on how the model used the web (search, open_page, find_in_page).
1334
- */
1335
- action?: {
1336
- /**
1337
- * Action type "search" - Performs a web search query.
1338
- */
1339
- type: "search";
1340
- /**
1341
- * The search query.
1342
- *
1343
- * @deprecated Use `queries` instead.
1344
- */
1345
- query?: string;
1346
- /**
1347
- * The search queries the model used.
1348
- */
1349
- queries?: string[];
1350
- } | {
1351
- /**
1352
- * Action type "openPage" - Opens a specific URL from search results.
1353
- */
1354
- type: "openPage";
1355
- /**
1356
- * The URL opened by the model.
1357
- */
1358
- url?: string | null;
1359
- } | {
1360
- /**
1361
- * Action type "findInPage": Searches for a pattern within a loaded page.
1362
- */
1363
- type: "findInPage";
1364
- /**
1365
- * The URL of the page searched for the pattern.
1366
- */
1367
- url?: string | null;
1368
- /**
1369
- * The pattern or text to search for within the page.
1370
- */
1371
- pattern?: string | null;
1372
- };
1373
- /**
1374
- * Optional sources cited by the model for the web search call.
1375
- */
1376
- sources?: Array<{
1377
- type: "url";
1378
- url: string;
1379
- } | {
1380
- type: "api";
1381
- name: string;
1382
- }>;
1383
- }, {
1384
- /**
1385
- * Whether to use external web access for fetching live content.
1386
- * - true: Fetch live web content (default)
1387
- * - false: Use cached/indexed results
1388
- */
1389
- externalWebAccess?: boolean;
1390
- /**
1391
- * Filters for the search.
1392
- */
1393
- filters?: {
1394
- /**
1395
- * Allowed domains for the search.
1396
- * If not provided, all domains are allowed.
1397
- * Subdomains of the provided domains are allowed as well.
1398
- * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
1399
- */
1400
- allowedDomains?: string[];
1401
- /**
1402
- * Blocked domains for the search.
1403
- * Subdomains of the provided domains are blocked as well.
1404
- * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
1405
- */
1406
- blockedDomains?: string[];
1407
- };
1408
- /**
1409
- * Search context size to use for the web search.
1410
- * - high: Most comprehensive context, highest cost, slower response
1411
- * - medium: Balanced context, cost, and latency (default)
1412
- * - low: Least context, lowest cost, fastest response
1413
- */
1414
- searchContextSize?: "low" | "medium" | "high";
1415
- /**
1416
- * User location information to provide geographically relevant search results.
1417
- */
1418
- userLocation?: {
1419
- /**
1420
- * Type of location (always 'approximate')
1421
- */
1422
- type: "approximate";
1423
- /**
1424
- * Two-letter ISO country code (e.g., 'US', 'GB')
1425
- */
1426
- country?: string;
1427
- /**
1428
- * City name (free text, e.g., 'Minneapolis')
1429
- */
1430
- city?: string;
1431
- /**
1432
- * Region name (free text, e.g., 'Minnesota')
1433
- */
1434
- region?: string;
1435
- /**
1436
- * IANA timezone (e.g., 'America/Chicago')
1437
- */
1438
- timezone?: string;
1439
- };
1440
- }>;
1441
- declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
1442
- /**
1443
- * An object describing the specific action taken in this web search call.
1444
- * Includes details on how the model used the web (search, open_page, find_in_page).
1445
- */
1446
- action?: {
1447
- /**
1448
- * Action type "search" - Performs a web search query.
1449
- */
1450
- type: "search";
1451
- /**
1452
- * The search query.
1453
- *
1454
- * @deprecated Use `queries` instead.
1455
- */
1456
- query?: string;
1457
- /**
1458
- * The search queries the model used.
1459
- */
1460
- queries?: string[];
1461
- } | {
1462
- /**
1463
- * Action type "openPage" - Opens a specific URL from search results.
1464
- */
1465
- type: "openPage";
1466
- /**
1467
- * The URL opened by the model.
1468
- */
1469
- url?: string | null;
1470
- } | {
1471
- /**
1472
- * Action type "findInPage": Searches for a pattern within a loaded page.
1473
- */
1474
- type: "findInPage";
1475
- /**
1476
- * The URL of the page searched for the pattern.
1477
- */
1478
- url?: string | null;
1479
- /**
1480
- * The pattern or text to search for within the page.
1481
- */
1482
- pattern?: string | null;
1483
- };
1484
- /**
1485
- * Optional sources cited by the model for the web search call.
1486
- */
1487
- sources?: Array<{
1488
- type: "url";
1489
- url: string;
1490
- } | {
1491
- type: "api";
1492
- name: string;
1493
- }>;
1494
- }>;
1495
-
1496
1512
  declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
1497
1513
  searchContextSize?: "low" | "medium" | "high" | undefined;
1498
1514
  userLocation?: {
@@ -1576,4 +1592,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOu
1576
1592
  };
1577
1593
  }>;
1578
1594
 
1579
- 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 OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, 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, toolSearch, toolSearchArgsSchema, toolSearchInputSchema, toolSearchOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
1595
+ 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 OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, type OpenaiResponsesToolCallProviderMetadata, type ResponsesProviderMetadata, type ResponsesReasoningProviderMetadata, type ResponsesSourceDocumentProviderMetadata, type ResponsesTextProviderMetadata, type ResponsesToolCallProviderMetadata, applyPatch, applyPatchArgsSchema, applyPatchInputSchema, applyPatchOutputSchema, applyPatchToolFactory, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, mapWebSearchResult, modelMaxImagesPerCall, openAITranscriptionModelOptions, openaiEmbeddingModelOptions, openaiImageModelEditOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiLanguageModelChatOptions, openaiLanguageModelCompletionOptions, openaiSpeechModelOptionsSchema, toolSearch, toolSearchArgsSchema, toolSearchInputSchema, toolSearchOutputSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -45,6 +45,7 @@ __export(index_exports, {
45
45
  imageGeneration: () => imageGeneration,
46
46
  imageGenerationArgsSchema: () => imageGenerationArgsSchema,
47
47
  imageGenerationOutputSchema: () => imageGenerationOutputSchema,
48
+ mapWebSearchResult: () => mapWebSearchResult,
48
49
  modelMaxImagesPerCall: () => modelMaxImagesPerCall,
49
50
  openAITranscriptionModelOptions: () => openAITranscriptionModelOptions,
50
51
  openaiEmbeddingModelOptions: () => openaiEmbeddingModelOptions,
@@ -102,7 +103,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
102
103
  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);
103
104
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
104
105
  const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
105
- const isGpt6SolOrLuna = modelId === "gpt-6-sol" || modelId === "gpt-6-luna";
106
+ const isGpt6OrLaterModelWithNoneEffort = modelId === "gpt-6-sol" || modelId === "gpt-6-luna" || modelId === "gpt-6.1-terra";
106
107
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
107
108
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
108
109
  const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
@@ -113,7 +114,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
113
114
  supportsPriorityProcessing,
114
115
  supportsConfigurationUpdate: isGpt6OrLaterModel,
115
116
  supportsAsyncToolCalling: isGpt6OrLaterModel,
116
- supportedReasoningEfforts: isGpt6SolOrLuna ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
117
+ supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
117
118
  isReasoningModel,
118
119
  systemMessageMode,
119
120
  supportsNonReasoningParameters
@@ -2457,7 +2458,12 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils15.lazySchema)(
2457
2458
  compression_ratio: import_v410.z.number(),
2458
2459
  no_speech_prob: import_v410.z.number()
2459
2460
  })
2460
- ).nullish()
2461
+ ).nullish(),
2462
+ // Lenient: an unexpected usage shape must not fail the transcription.
2463
+ usage: import_v410.z.object({
2464
+ type: import_v410.z.string().nullish(),
2465
+ seconds: import_v410.z.number().nullish()
2466
+ }).nullish().catch(void 0)
2461
2467
  })
2462
2468
  )
2463
2469
  );
@@ -2590,10 +2596,10 @@ var OpenAITranscriptionModel = class {
2590
2596
  prompt: openAIOptions.prompt,
2591
2597
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
2592
2598
  // prefer verbose_json to get segments for models that support it
2593
- response_format: [
2594
- "gpt-4o-transcribe",
2595
- "gpt-4o-mini-transcribe"
2596
- ].includes(this.modelId) ? "json" : "verbose_json",
2599
+ // gpt-4o(-mini)-transcribe (incl. snapshots) and gpt-transcribe reject verbose_json:
2600
+ response_format: ["gpt-4o-transcribe", "gpt-4o-mini-transcribe"].includes(
2601
+ this.modelId
2602
+ ) || this.modelId.startsWith("gpt-4o-mini-transcribe-") || this.modelId === "gpt-transcribe" || this.modelId.startsWith("gpt-transcribe-") ? "json" : "verbose_json",
2597
2603
  temperature: openAIOptions.temperature,
2598
2604
  timestamp_granularities: openAIOptions.timestampGranularities
2599
2605
  };
@@ -2615,7 +2621,7 @@ var OpenAITranscriptionModel = class {
2615
2621
  };
2616
2622
  }
2617
2623
  async doGenerate(options) {
2618
- var _a2, _b, _c, _d, _e, _f, _g, _h;
2624
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2619
2625
  const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
2620
2626
  const { formData, warnings } = await this.getArgs(options);
2621
2627
  const {
@@ -2649,7 +2655,8 @@ var OpenAITranscriptionModel = class {
2649
2655
  endSecond: word.end
2650
2656
  }))) != null ? _g : [],
2651
2657
  language,
2652
- durationInSeconds: (_h = response.duration) != null ? _h : void 0,
2658
+ // Duration-billed json responses report the duration only in `usage`:
2659
+ durationInSeconds: (_j = response.duration) != null ? _j : ((_h = response.usage) == null ? void 0 : _h.type) === "duration" ? (_i = response.usage.seconds) != null ? _i : void 0 : void 0,
2653
2660
  warnings,
2654
2661
  response: {
2655
2662
  timestamp: currentDate,
@@ -2875,6 +2882,7 @@ var openaiResponsesReasoningModelIds = [
2875
2882
  "gpt-5.6-terra",
2876
2883
  "gpt-6-astra",
2877
2884
  "gpt-6.1-sol",
2885
+ "gpt-6.1-terra",
2878
2886
  "gpt-6-luna",
2879
2887
  "gpt-6-sol"
2880
2888
  ];
@@ -6928,7 +6936,7 @@ var OpenAIResponsesLanguageModel = class {
6928
6936
  toolName: toolNameMapping.toCustomToolName(
6929
6937
  webSearchToolName != null ? webSearchToolName : "web_search"
6930
6938
  ),
6931
- result: mapWebSearchOutput(part.action)
6939
+ ...mapWebSearchResult(part)
6932
6940
  });
6933
6941
  break;
6934
6942
  }
@@ -7532,7 +7540,7 @@ var OpenAIResponsesLanguageModel = class {
7532
7540
  toolName: toolNameMapping.toCustomToolName(
7533
7541
  webSearchToolName != null ? webSearchToolName : "web_search"
7534
7542
  ),
7535
- result: mapWebSearchOutput(value.item.action)
7543
+ ...mapWebSearchResult(value.item)
7536
7544
  });
7537
7545
  } else if (value.item.type === "computer_call") {
7538
7546
  ongoingToolCalls[value.output_index] = void 0;
@@ -8214,6 +8222,12 @@ function isErrorChunk(chunk) {
8214
8222
  function isResponseOutputChunk(chunk) {
8215
8223
  return !(chunk.type === "response.created" || chunk.type === "response.failed" || chunk.type === "error" || chunk.type === "unknown_chunk");
8216
8224
  }
8225
+ function mapWebSearchResult({
8226
+ action,
8227
+ status
8228
+ }) {
8229
+ return status === "completed" ? { result: mapWebSearchOutput(action) } : { isError: true, result: { status } };
8230
+ }
8217
8231
  function mapWebSearchOutput(action) {
8218
8232
  var _a2;
8219
8233
  if (action == null) {
@@ -8272,6 +8286,7 @@ function escapeJSONDelta(delta) {
8272
8286
  imageGeneration,
8273
8287
  imageGenerationArgsSchema,
8274
8288
  imageGenerationOutputSchema,
8289
+ mapWebSearchResult,
8275
8290
  modelMaxImagesPerCall,
8276
8291
  openAITranscriptionModelOptions,
8277
8292
  openaiEmbeddingModelOptions,