@ai-sdk/openai 4.0.13 → 4.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 4.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 0063c2d: Add the client-executed OpenAI Responses API computer tool with batched actions and screenshot outputs.
8
+
9
+ ## 4.0.14
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [31c7be8]
14
+ - @ai-sdk/provider-utils@5.0.10
15
+
3
16
  ## 4.0.13
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as _ai_sdk_provider from '@ai-sdk/provider';
2
2
  import { JSONValue, ProviderV4, LanguageModelV4, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4, SpeechModelV4, Experimental_RealtimeFactoryV4, FilesV4, SkillsV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig } from '@ai-sdk/provider';
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
4
  import { InferSchema, FetchFunction, WebSocketConstructor } from '@ai-sdk/provider-utils';
5
+ import { z } from 'zod/v4';
5
6
 
6
7
  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' | (string & {});
7
8
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
@@ -307,6 +308,98 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
307
308
  type: "response.output_item.added";
308
309
  output_index: number;
309
310
  item: {
311
+ type: "computer_call";
312
+ id: string;
313
+ status: "completed" | "in_progress" | "incomplete";
314
+ call_id?: string | null | undefined;
315
+ action?: {
316
+ type: "click";
317
+ button: "left" | "right" | "wheel" | "back" | "forward";
318
+ x: number;
319
+ y: number;
320
+ keys?: string[] | null | undefined;
321
+ } | {
322
+ type: "double_click";
323
+ x: number;
324
+ y: number;
325
+ keys?: string[] | null | undefined;
326
+ } | {
327
+ type: "drag";
328
+ path: {
329
+ x: number;
330
+ y: number;
331
+ }[];
332
+ keys?: string[] | null | undefined;
333
+ } | {
334
+ type: "keypress";
335
+ keys: string[];
336
+ } | {
337
+ type: "move";
338
+ x: number;
339
+ y: number;
340
+ keys?: string[] | null | undefined;
341
+ } | {
342
+ type: "screenshot";
343
+ } | {
344
+ type: "scroll";
345
+ x: number;
346
+ y: number;
347
+ scroll_x: number;
348
+ scroll_y: number;
349
+ keys?: string[] | null | undefined;
350
+ } | {
351
+ type: "type";
352
+ text: string;
353
+ } | {
354
+ type: "wait";
355
+ } | null | undefined;
356
+ actions?: ({
357
+ type: "click";
358
+ button: "left" | "right" | "wheel" | "back" | "forward";
359
+ x: number;
360
+ y: number;
361
+ keys?: string[] | null | undefined;
362
+ } | {
363
+ type: "double_click";
364
+ x: number;
365
+ y: number;
366
+ keys?: string[] | null | undefined;
367
+ } | {
368
+ type: "drag";
369
+ path: {
370
+ x: number;
371
+ y: number;
372
+ }[];
373
+ keys?: string[] | null | undefined;
374
+ } | {
375
+ type: "keypress";
376
+ keys: string[];
377
+ } | {
378
+ type: "move";
379
+ x: number;
380
+ y: number;
381
+ keys?: string[] | null | undefined;
382
+ } | {
383
+ type: "screenshot";
384
+ } | {
385
+ type: "scroll";
386
+ x: number;
387
+ y: number;
388
+ scroll_x: number;
389
+ scroll_y: number;
390
+ keys?: string[] | null | undefined;
391
+ } | {
392
+ type: "type";
393
+ text: string;
394
+ } | {
395
+ type: "wait";
396
+ })[] | null | undefined;
397
+ pending_safety_checks?: {
398
+ id: string;
399
+ code?: string | null | undefined;
400
+ message?: string | null | undefined;
401
+ }[] | null | undefined;
402
+ } | {
310
403
  type: "message";
311
404
  id: string;
312
405
  phase?: "commentary" | "final_answer" | null | undefined;
@@ -325,10 +418,6 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
325
418
  type: "web_search_call";
326
419
  id: string;
327
420
  status: string;
328
- } | {
329
- type: "computer_call";
330
- id: string;
331
- status: string;
332
421
  } | {
333
422
  type: "file_search_call";
334
423
  id: string;
@@ -428,6 +517,98 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
428
517
  type: "response.output_item.done";
429
518
  output_index: number;
430
519
  item: {
520
+ type: "computer_call";
521
+ id: string;
522
+ status: "completed" | "in_progress" | "incomplete";
523
+ call_id?: string | null | undefined;
524
+ action?: {
525
+ type: "click";
526
+ button: "left" | "right" | "wheel" | "back" | "forward";
527
+ x: number;
528
+ y: number;
529
+ keys?: string[] | null | undefined;
530
+ } | {
531
+ type: "double_click";
532
+ x: number;
533
+ y: number;
534
+ keys?: string[] | null | undefined;
535
+ } | {
536
+ type: "drag";
537
+ path: {
538
+ x: number;
539
+ y: number;
540
+ }[];
541
+ keys?: string[] | null | undefined;
542
+ } | {
543
+ type: "keypress";
544
+ keys: string[];
545
+ } | {
546
+ type: "move";
547
+ x: number;
548
+ y: number;
549
+ keys?: string[] | null | undefined;
550
+ } | {
551
+ type: "screenshot";
552
+ } | {
553
+ type: "scroll";
554
+ x: number;
555
+ y: number;
556
+ scroll_x: number;
557
+ scroll_y: number;
558
+ keys?: string[] | null | undefined;
559
+ } | {
560
+ type: "type";
561
+ text: string;
562
+ } | {
563
+ type: "wait";
564
+ } | null | undefined;
565
+ actions?: ({
566
+ type: "click";
567
+ button: "left" | "right" | "wheel" | "back" | "forward";
568
+ x: number;
569
+ y: number;
570
+ keys?: string[] | null | undefined;
571
+ } | {
572
+ type: "double_click";
573
+ x: number;
574
+ y: number;
575
+ keys?: string[] | null | undefined;
576
+ } | {
577
+ type: "drag";
578
+ path: {
579
+ x: number;
580
+ y: number;
581
+ }[];
582
+ keys?: string[] | null | undefined;
583
+ } | {
584
+ type: "keypress";
585
+ keys: string[];
586
+ } | {
587
+ type: "move";
588
+ x: number;
589
+ y: number;
590
+ keys?: string[] | null | undefined;
591
+ } | {
592
+ type: "screenshot";
593
+ } | {
594
+ type: "scroll";
595
+ x: number;
596
+ y: number;
597
+ scroll_x: number;
598
+ scroll_y: number;
599
+ keys?: string[] | null | undefined;
600
+ } | {
601
+ type: "type";
602
+ text: string;
603
+ } | {
604
+ type: "wait";
605
+ })[] | null | undefined;
606
+ pending_safety_checks?: {
607
+ id: string;
608
+ code?: string | null | undefined;
609
+ message?: string | null | undefined;
610
+ }[] | null | undefined;
611
+ } | {
431
612
  type: "message";
432
613
  id: string;
433
614
  phase?: "commentary" | "final_answer" | null | undefined;
@@ -512,10 +693,6 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
512
693
  working_directory?: string | undefined;
513
694
  env?: Record<string, string> | undefined;
514
695
  };
515
- } | {
516
- type: "computer_call";
517
- id: string;
518
- status: "completed";
519
696
  } | {
520
697
  type: "mcp_call";
521
698
  id: string;
@@ -789,6 +966,49 @@ declare const openaiTools: {
789
966
  url: string;
790
967
  }> | null;
791
968
  }, {}>;
969
+ /**
970
+ * The computer tool allows models to operate a browser or desktop through
971
+ * batched UI actions. Your application executes the actions and returns an
972
+ * updated screenshot.
973
+ *
974
+ * WARNING: Run computer use in an isolated environment, treat on-screen
975
+ * content as untrusted, and require confirmation for consequential actions.
976
+ */
977
+ computer: (options?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
978
+ actions: OpenAIComputerAction[];
979
+ pendingSafetyChecks: OpenAIComputerSafetyCheck[];
980
+ status: "in_progress" | "completed" | "incomplete";
981
+ }, {
982
+ output: {
983
+ type: "computer_screenshot";
984
+ imageUrl: string;
985
+ fileId?: string;
986
+ detail?: "auto" | "low" | "high" | "original";
987
+ } | {
988
+ type: "computer_screenshot";
989
+ fileId: string;
990
+ imageUrl?: string;
991
+ detail?: "auto" | "low" | "high" | "original";
992
+ };
993
+ acknowledgedSafetyChecks?: OpenAIComputerSafetyCheck[];
994
+ }, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderDefinedTool<{
995
+ actions: OpenAIComputerAction[];
996
+ pendingSafetyChecks: OpenAIComputerSafetyCheck[];
997
+ status: "in_progress" | "completed" | "incomplete";
998
+ }, {
999
+ output: {
1000
+ type: "computer_screenshot";
1001
+ imageUrl: string;
1002
+ fileId?: string;
1003
+ detail?: "auto" | "low" | "high" | "original";
1004
+ } | {
1005
+ type: "computer_screenshot";
1006
+ fileId: string;
1007
+ imageUrl?: string;
1008
+ detail?: "auto" | "low" | "high" | "original";
1009
+ };
1010
+ acknowledgedSafetyChecks?: OpenAIComputerSafetyCheck[];
1011
+ }, {}>;
792
1012
  /**
793
1013
  * File search is a tool available in the Responses API. It enables models to
794
1014
  * retrieve information in a knowledge base of previously uploaded files through
@@ -931,21 +1151,7 @@ declare const openaiTools: {
931
1151
  containerId: string;
932
1152
  } | {
933
1153
  type?: "local";
934
- skills
935
- /**
936
- * Web search allows models to access up-to-date information from the internet
937
- * and provide answers with sourced citations.
938
- *
939
- * @param searchContextSize - The search context size to use for the web search.
940
- * @param userLocation - The user location to use for the web search.
941
- */
942
- ? /**
943
- * Web search allows models to access up-to-date information from the internet
944
- * and provide answers with sourced citations.
945
- *
946
- * @param searchContextSize - The search context size to use for the web search.
947
- * @param userLocation - The user location to use for the web search.
948
- */: Array<{
1154
+ skills?: Array<{
949
1155
  name: string;
950
1156
  description: string;
951
1157
  path: string;
@@ -1279,6 +1485,61 @@ declare const openaiFilesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
1279
1485
  }>;
1280
1486
  type OpenAIFilesOptions = InferSchema<typeof openaiFilesOptionsSchema>;
1281
1487
 
1488
+ declare const safetyCheckSchema: z.ZodObject<{
1489
+ id: z.ZodString;
1490
+ code: z.ZodOptional<z.ZodString>;
1491
+ message: z.ZodOptional<z.ZodString>;
1492
+ }, z.core.$strip>;
1493
+ declare const computerActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1494
+ type: z.ZodLiteral<"click">;
1495
+ button: z.ZodEnum<{
1496
+ left: "left";
1497
+ right: "right";
1498
+ wheel: "wheel";
1499
+ back: "back";
1500
+ forward: "forward";
1501
+ }>;
1502
+ x: z.ZodNumber;
1503
+ y: z.ZodNumber;
1504
+ keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1505
+ }, z.core.$strip>, z.ZodObject<{
1506
+ type: z.ZodLiteral<"double_click">;
1507
+ x: z.ZodNumber;
1508
+ y: z.ZodNumber;
1509
+ keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1510
+ }, z.core.$strip>, z.ZodObject<{
1511
+ type: z.ZodLiteral<"drag">;
1512
+ path: z.ZodArray<z.ZodObject<{
1513
+ x: z.ZodNumber;
1514
+ y: z.ZodNumber;
1515
+ }, z.core.$strip>>;
1516
+ keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1517
+ }, z.core.$strip>, z.ZodObject<{
1518
+ type: z.ZodLiteral<"keypress">;
1519
+ keys: z.ZodArray<z.ZodString>;
1520
+ }, z.core.$strip>, z.ZodObject<{
1521
+ type: z.ZodLiteral<"move">;
1522
+ x: z.ZodNumber;
1523
+ y: z.ZodNumber;
1524
+ keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1525
+ }, z.core.$strip>, z.ZodObject<{
1526
+ type: z.ZodLiteral<"screenshot">;
1527
+ }, z.core.$strip>, z.ZodObject<{
1528
+ type: z.ZodLiteral<"scroll">;
1529
+ x: z.ZodNumber;
1530
+ y: z.ZodNumber;
1531
+ scrollX: z.ZodNumber;
1532
+ scrollY: z.ZodNumber;
1533
+ keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1534
+ }, z.core.$strip>, z.ZodObject<{
1535
+ type: z.ZodLiteral<"type">;
1536
+ text: z.ZodString;
1537
+ }, z.core.$strip>, z.ZodObject<{
1538
+ type: z.ZodLiteral<"wait">;
1539
+ }, z.core.$strip>]>;
1540
+ type OpenAIComputerAction = z.infer<typeof computerActionSchema>;
1541
+ type OpenAIComputerSafetyCheck = z.infer<typeof safetyCheckSchema>;
1542
+
1282
1543
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1283
1544
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
1284
1545
  type: 'response.output_text.annotation.added';
@@ -1334,4 +1595,4 @@ type OpenaiResponsesSourceDocumentProviderMetadata = {
1334
1595
 
1335
1596
  declare const VERSION: string;
1336
1597
 
1337
- export { OpenAIRealtimeModel as Experimental_OpenAIRealtimeModel, type OpenAIRealtimeModelConfig as Experimental_OpenAIRealtimeModelConfig, type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIFilesOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai };
1598
+ export { OpenAIRealtimeModel as Experimental_OpenAIRealtimeModel, type OpenAIRealtimeModelConfig as Experimental_OpenAIRealtimeModelConfig, type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIComputerAction, type OpenAIComputerSafetyCheck, type OpenAIEmbeddingModelOptions, type OpenAIFilesOptions, type OpenAIImageModelEditOptions, type OpenAIImageModelGenerationOptions, type OpenAIImageModelOptions, type OpenAILanguageModelChatOptions, type OpenAILanguageModelCompletionOptions, type OpenAILanguageModelResponsesOptions, type OpenAIProvider, type OpenAIProviderSettings, type OpenAILanguageModelResponsesOptions as OpenAIResponsesProviderOptions, type OpenAISpeechModelOptions, type OpenAITranscriptionModelOptions, type OpenaiResponsesCompactionProviderMetadata, type OpenaiResponsesProviderMetadata, type OpenaiResponsesReasoningProviderMetadata, type OpenaiResponsesSourceDocumentProviderMetadata, type OpenaiResponsesTextProviderMetadata, VERSION, createOpenAI, openai };