@ai-sdk/openai 4.0.32 → 4.0.34

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.
@@ -1,7 +1,8 @@
1
1
  import * as _ai_sdk_provider from '@ai-sdk/provider';
2
- import { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4CallOptions, TranscriptionModelV4, Experimental_TranscriptionModelV4StreamOptions, SpeechModelV4, JSONValue } from '@ai-sdk/provider';
2
+ import { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4CallOptions, TranscriptionModelV4, Experimental_TranscriptionModelV4StreamOptions, SpeechModelV4, JSONSchema7, JSONObject, JSONValue, SharedV4Warning } from '@ai-sdk/provider';
3
3
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
4
  import { InferSchema, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, 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<{
@@ -280,28 +281,370 @@ declare class OpenAISpeechModel implements SpeechModelV4 {
280
281
  doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
281
282
  }
282
283
 
283
- 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 & {});
284
-
285
- declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
286
- readonly specificationVersion = "v4";
287
- readonly modelId: OpenAIResponsesModelId;
288
- private readonly config;
289
- static [WORKFLOW_SERIALIZE](model: OpenAIResponsesLanguageModel): {
290
- modelId: string;
291
- config: _ai_sdk_provider.JSONObject;
284
+ declare const openaiResponsesComputerCallSchema: z.ZodObject<{
285
+ type: z.ZodLiteral<"computer_call">;
286
+ id: z.ZodString;
287
+ call_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
+ status: z.ZodEnum<{
289
+ completed: "completed";
290
+ in_progress: "in_progress";
291
+ incomplete: "incomplete";
292
+ }>;
293
+ action: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
294
+ type: z.ZodLiteral<"click">;
295
+ button: z.ZodEnum<{
296
+ left: "left";
297
+ right: "right";
298
+ wheel: "wheel";
299
+ back: "back";
300
+ forward: "forward";
301
+ }>;
302
+ x: z.ZodNumber;
303
+ y: z.ZodNumber;
304
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
305
+ }, z.core.$strip>, z.ZodObject<{
306
+ type: z.ZodLiteral<"double_click">;
307
+ x: z.ZodNumber;
308
+ y: z.ZodNumber;
309
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
310
+ }, z.core.$strip>, z.ZodObject<{
311
+ type: z.ZodLiteral<"drag">;
312
+ path: z.ZodArray<z.ZodObject<{
313
+ x: z.ZodNumber;
314
+ y: z.ZodNumber;
315
+ }, z.core.$strip>>;
316
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
317
+ }, z.core.$strip>, z.ZodObject<{
318
+ type: z.ZodLiteral<"keypress">;
319
+ keys: z.ZodArray<z.ZodString>;
320
+ }, z.core.$strip>, z.ZodObject<{
321
+ type: z.ZodLiteral<"move">;
322
+ x: z.ZodNumber;
323
+ y: z.ZodNumber;
324
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
325
+ }, z.core.$strip>, z.ZodObject<{
326
+ type: z.ZodLiteral<"screenshot">;
327
+ }, z.core.$strip>, z.ZodObject<{
328
+ type: z.ZodLiteral<"scroll">;
329
+ x: z.ZodNumber;
330
+ y: z.ZodNumber;
331
+ scroll_x: z.ZodNumber;
332
+ scroll_y: z.ZodNumber;
333
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
334
+ }, z.core.$strip>, z.ZodObject<{
335
+ type: z.ZodLiteral<"type">;
336
+ text: z.ZodString;
337
+ }, z.core.$strip>, z.ZodObject<{
338
+ type: z.ZodLiteral<"wait">;
339
+ }, z.core.$strip>]>>>;
340
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
341
+ type: z.ZodLiteral<"click">;
342
+ button: z.ZodEnum<{
343
+ left: "left";
344
+ right: "right";
345
+ wheel: "wheel";
346
+ back: "back";
347
+ forward: "forward";
348
+ }>;
349
+ x: z.ZodNumber;
350
+ y: z.ZodNumber;
351
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
352
+ }, z.core.$strip>, z.ZodObject<{
353
+ type: z.ZodLiteral<"double_click">;
354
+ x: z.ZodNumber;
355
+ y: z.ZodNumber;
356
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
357
+ }, z.core.$strip>, z.ZodObject<{
358
+ type: z.ZodLiteral<"drag">;
359
+ path: z.ZodArray<z.ZodObject<{
360
+ x: z.ZodNumber;
361
+ y: z.ZodNumber;
362
+ }, z.core.$strip>>;
363
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
364
+ }, z.core.$strip>, z.ZodObject<{
365
+ type: z.ZodLiteral<"keypress">;
366
+ keys: z.ZodArray<z.ZodString>;
367
+ }, z.core.$strip>, z.ZodObject<{
368
+ type: z.ZodLiteral<"move">;
369
+ x: z.ZodNumber;
370
+ y: z.ZodNumber;
371
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
372
+ }, z.core.$strip>, z.ZodObject<{
373
+ type: z.ZodLiteral<"screenshot">;
374
+ }, z.core.$strip>, z.ZodObject<{
375
+ type: z.ZodLiteral<"scroll">;
376
+ x: z.ZodNumber;
377
+ y: z.ZodNumber;
378
+ scroll_x: z.ZodNumber;
379
+ scroll_y: z.ZodNumber;
380
+ keys: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
381
+ }, z.core.$strip>, z.ZodObject<{
382
+ type: z.ZodLiteral<"type">;
383
+ text: z.ZodString;
384
+ }, z.core.$strip>, z.ZodObject<{
385
+ type: z.ZodLiteral<"wait">;
386
+ }, z.core.$strip>]>>>>;
387
+ pending_safety_checks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
388
+ id: z.ZodString;
389
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
390
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
391
+ }, z.core.$strip>>>>;
392
+ }, z.core.$strip>;
393
+ type OpenAIResponsesInput = Array<OpenAIResponsesInputItem>;
394
+ type OpenAIResponsesInputItem = OpenAIResponsesSystemMessage | OpenAIResponsesUserMessage | OpenAIResponsesAssistantMessage | OpenAIResponsesFunctionCall | OpenAIResponsesFunctionCallOutput | OpenAIResponsesProgram | OpenAIResponsesProgramOutput | OpenAIResponsesCustomToolCall | OpenAIResponsesCustomToolCallOutput | OpenAIResponsesMcpApprovalResponse | OpenAIResponsesComputerCall | OpenAIResponsesComputerCallOutput | OpenAIResponsesLocalShellCall | OpenAIResponsesLocalShellCallOutput | OpenAIResponsesShellCall | OpenAIResponsesShellCallOutput | OpenAIResponsesApplyPatchCall | OpenAIResponsesApplyPatchCallOutput | OpenAIResponsesToolSearchCall | OpenAIResponsesToolSearchOutput | OpenAIResponsesReasoning | OpenAIResponsesItemReference | OpenAIResponsesCompactionItem;
395
+ type OpenAIResponsesIncludeValue = 'web_search_call.action.sources' | 'web_search_call.results' | 'code_interpreter_call.outputs' | 'computer_call_output.output.image_url' | 'file_search_call.results' | 'message.input_image.image_url' | 'message.output_text.logprobs' | 'reasoning.encrypted_content';
396
+ type OpenAIResponsesIncludeOptions = Array<OpenAIResponsesIncludeValue> | undefined | null;
397
+ type OpenAIResponsesSystemMessage = {
398
+ role: 'system' | 'developer';
399
+ content: string | Array<{
400
+ type: 'input_text';
401
+ text: string;
402
+ prompt_cache_breakpoint?: {
403
+ mode: 'explicit';
404
+ };
405
+ }>;
406
+ };
407
+ type OpenAIResponsesUserMessage = {
408
+ role: 'user';
409
+ content: Array<{
410
+ type: 'input_text';
411
+ text: string;
412
+ prompt_cache_breakpoint?: {
413
+ mode: 'explicit';
414
+ };
415
+ } | {
416
+ type: 'input_image';
417
+ image_url: string;
418
+ prompt_cache_breakpoint?: {
419
+ mode: 'explicit';
420
+ };
421
+ } | {
422
+ type: 'input_image';
423
+ file_id: string;
424
+ prompt_cache_breakpoint?: {
425
+ mode: 'explicit';
426
+ };
427
+ } | {
428
+ type: 'input_file';
429
+ file_url: string;
430
+ prompt_cache_breakpoint?: {
431
+ mode: 'explicit';
432
+ };
433
+ } | {
434
+ type: 'input_file';
435
+ filename: string;
436
+ file_data: string;
437
+ prompt_cache_breakpoint?: {
438
+ mode: 'explicit';
439
+ };
440
+ } | {
441
+ type: 'input_file';
442
+ file_id: string;
443
+ prompt_cache_breakpoint?: {
444
+ mode: 'explicit';
445
+ };
446
+ }>;
447
+ };
448
+ type OpenAIResponsesAssistantMessage = {
449
+ role: 'assistant';
450
+ content: Array<{
451
+ type: 'output_text';
452
+ text: string;
453
+ }>;
454
+ id?: string;
455
+ phase?: 'commentary' | 'final_answer' | null;
456
+ };
457
+ type OpenAIResponsesFunctionCall = {
458
+ type: 'function_call';
459
+ call_id: string;
460
+ name: string;
461
+ arguments: string;
462
+ id?: string;
463
+ namespace?: string;
464
+ caller?: OpenAIResponsesToolCaller;
465
+ };
466
+ type OpenAIResponsesFunctionCallOutput = {
467
+ type: 'function_call_output';
468
+ call_id: string;
469
+ output: string | Array<{
470
+ type: 'input_text';
471
+ text: string;
472
+ prompt_cache_breakpoint?: {
473
+ mode: 'explicit';
474
+ };
475
+ } | {
476
+ type: 'input_image';
477
+ image_url: string;
478
+ prompt_cache_breakpoint?: {
479
+ mode: 'explicit';
480
+ };
481
+ } | {
482
+ type: 'input_file';
483
+ filename: string;
484
+ file_data: string;
485
+ prompt_cache_breakpoint?: {
486
+ mode: 'explicit';
487
+ };
488
+ } | {
489
+ type: 'input_file';
490
+ file_url: string;
491
+ prompt_cache_breakpoint?: {
492
+ mode: 'explicit';
493
+ };
494
+ }>;
495
+ caller?: OpenAIResponsesToolCaller;
496
+ };
497
+ type OpenAIResponsesToolCaller = {
498
+ type: 'direct';
499
+ } | {
500
+ type: 'program';
501
+ caller_id: string;
502
+ };
503
+ type OpenAIResponsesProgram = {
504
+ type: 'program';
505
+ id: string;
506
+ call_id: string;
507
+ code: string;
508
+ fingerprint: string;
509
+ };
510
+ type OpenAIResponsesProgramOutput = {
511
+ type: 'program_output';
512
+ id: string;
513
+ call_id: string;
514
+ result: string;
515
+ status: 'completed' | 'incomplete';
516
+ };
517
+ type OpenAIResponsesCustomToolCall = {
518
+ type: 'custom_tool_call';
519
+ id?: string;
520
+ call_id: string;
521
+ name: string;
522
+ input: string;
523
+ };
524
+ type OpenAIResponsesCustomToolCallOutput = {
525
+ type: 'custom_tool_call_output';
526
+ call_id: string;
527
+ output: OpenAIResponsesFunctionCallOutput['output'];
528
+ };
529
+ type OpenAIResponsesMcpApprovalResponse = {
530
+ type: 'mcp_approval_response';
531
+ approval_request_id: string;
532
+ approve: boolean;
533
+ };
534
+ type OpenAIResponsesComputerCall = InferSchema<typeof openaiResponsesComputerCallSchema>;
535
+ type OpenAIResponsesComputerCallOutput = {
536
+ type: 'computer_call_output';
537
+ call_id: string;
538
+ output: {
539
+ type: 'computer_screenshot';
540
+ image_url?: string;
541
+ file_id?: string;
542
+ detail?: 'auto' | 'low' | 'high' | 'original';
292
543
  };
293
- static [WORKFLOW_DESERIALIZE](options: {
294
- modelId: OpenAIResponsesModelId;
295
- config: OpenAIConfig;
296
- }): OpenAIResponsesLanguageModel;
297
- constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
298
- readonly supportedUrls: Record<string, RegExp[]>;
299
- get provider(): string;
300
- private getArgs;
301
- doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
302
- doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
303
- }
304
-
544
+ acknowledged_safety_checks?: Array<{
545
+ id: string;
546
+ code?: string;
547
+ message?: string;
548
+ }>;
549
+ };
550
+ type OpenAIResponsesLocalShellCall = {
551
+ type: 'local_shell_call';
552
+ id: string;
553
+ call_id: string;
554
+ action: {
555
+ type: 'exec';
556
+ command: string[];
557
+ timeout_ms?: number;
558
+ user?: string;
559
+ working_directory?: string;
560
+ env?: Record<string, string>;
561
+ };
562
+ };
563
+ type OpenAIResponsesLocalShellCallOutput = {
564
+ type: 'local_shell_call_output';
565
+ call_id: string;
566
+ output: string;
567
+ };
568
+ /**
569
+ * Official OpenAI API Specifications: https://platform.openai.com/docs/api-reference/responses/object#responses-object-output-shell_tool_call
570
+ */
571
+ type OpenAIResponsesShellCall = {
572
+ type: 'shell_call';
573
+ id: string;
574
+ call_id: string;
575
+ status: 'in_progress' | 'completed' | 'incomplete';
576
+ action: {
577
+ commands: string[];
578
+ timeout_ms?: number;
579
+ max_output_length?: number;
580
+ };
581
+ };
582
+ type OpenAIResponsesShellCallOutput = {
583
+ type: 'shell_call_output';
584
+ id?: string;
585
+ call_id: string;
586
+ status?: 'in_progress' | 'completed' | 'incomplete';
587
+ max_output_length?: number | null;
588
+ output: Array<{
589
+ stdout: string;
590
+ stderr: string;
591
+ outcome: {
592
+ type: 'timeout';
593
+ } | {
594
+ type: 'exit';
595
+ exit_code: number;
596
+ };
597
+ }>;
598
+ };
599
+ type OpenAIResponsesApplyPatchCall = {
600
+ type: 'apply_patch_call';
601
+ id?: string;
602
+ call_id: string;
603
+ status: 'in_progress' | 'completed';
604
+ operation: {
605
+ type: 'create_file';
606
+ path: string;
607
+ diff: string;
608
+ } | {
609
+ type: 'delete_file';
610
+ path: string;
611
+ } | {
612
+ type: 'update_file';
613
+ path: string;
614
+ diff: string;
615
+ };
616
+ };
617
+ type OpenAIResponsesApplyPatchCallOutput = {
618
+ type: 'apply_patch_call_output';
619
+ call_id: string;
620
+ status: 'completed' | 'failed';
621
+ output?: string;
622
+ };
623
+ type OpenAIResponsesToolSearchCall = {
624
+ type: 'tool_search_call';
625
+ id: string;
626
+ execution: 'server' | 'client';
627
+ call_id: string | null;
628
+ status: 'in_progress' | 'completed' | 'incomplete';
629
+ arguments: unknown;
630
+ };
631
+ type OpenAIResponsesToolSearchOutput = {
632
+ type: 'tool_search_output';
633
+ id?: string;
634
+ execution: 'server' | 'client';
635
+ call_id: string | null;
636
+ status: 'in_progress' | 'completed' | 'incomplete';
637
+ tools: Array<JSONObject>;
638
+ };
639
+ type OpenAIResponsesItemReference = {
640
+ type: 'item_reference';
641
+ id: string;
642
+ };
643
+ type OpenAIResponsesCompactionItem = {
644
+ type: 'compaction';
645
+ id: string;
646
+ encrypted_content: string;
647
+ };
305
648
  /**
306
649
  * A filter used to compare a specified attribute key to a given value using a defined comparison operation.
307
650
  */
@@ -332,6 +675,173 @@ type OpenAIResponsesFileSearchToolCompoundFilter = {
332
675
  */
333
676
  filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
334
677
  };
678
+ type OpenAIResponsesFunctionTool = {
679
+ type: 'function';
680
+ name: string;
681
+ description: string | undefined;
682
+ parameters: JSONSchema7;
683
+ strict?: boolean;
684
+ defer_loading?: boolean;
685
+ allowed_callers?: Array<'direct' | 'programmatic'>;
686
+ output_schema?: JSONSchema7;
687
+ };
688
+ type OpenAIResponsesTool = OpenAIResponsesFunctionTool | {
689
+ type: 'namespace';
690
+ name: string;
691
+ description: string;
692
+ tools: Array<OpenAIResponsesFunctionTool>;
693
+ } | {
694
+ type: 'apply_patch';
695
+ } | {
696
+ type: 'computer';
697
+ } | {
698
+ type: 'web_search';
699
+ external_web_access: boolean | undefined;
700
+ filters: {
701
+ allowed_domains: string[] | undefined;
702
+ blocked_domains: string[] | undefined;
703
+ } | undefined;
704
+ search_context_size: 'low' | 'medium' | 'high' | undefined;
705
+ user_location: {
706
+ type: 'approximate';
707
+ city?: string;
708
+ country?: string;
709
+ region?: string;
710
+ timezone?: string;
711
+ } | undefined;
712
+ } | {
713
+ type: 'web_search_preview';
714
+ search_context_size: 'low' | 'medium' | 'high' | undefined;
715
+ user_location: {
716
+ type: 'approximate';
717
+ city?: string;
718
+ country?: string;
719
+ region?: string;
720
+ timezone?: string;
721
+ } | undefined;
722
+ } | {
723
+ type: 'code_interpreter';
724
+ container: string | {
725
+ type: 'auto';
726
+ file_ids: string[] | undefined;
727
+ };
728
+ } | {
729
+ type: 'file_search';
730
+ vector_store_ids: string[];
731
+ max_num_results: number | undefined;
732
+ ranking_options: {
733
+ ranker?: string;
734
+ score_threshold?: number;
735
+ } | undefined;
736
+ filters: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter | undefined;
737
+ } | {
738
+ type: 'image_generation';
739
+ background: 'auto' | 'opaque' | 'transparent' | undefined;
740
+ input_fidelity: 'low' | 'high' | undefined;
741
+ input_image_mask: {
742
+ file_id: string | undefined;
743
+ image_url: string | undefined;
744
+ } | undefined;
745
+ model: string | undefined;
746
+ moderation: 'auto' | undefined;
747
+ output_compression: number | undefined;
748
+ output_format: 'png' | 'jpeg' | 'webp' | undefined;
749
+ partial_images: number | undefined;
750
+ quality: 'auto' | 'low' | 'medium' | 'high' | undefined;
751
+ size: 'auto' | '1024x1024' | '1024x1536' | '1536x1024' | undefined;
752
+ }
753
+ /**
754
+ * Official OpenAI API Specifications: https://platform.openai.com/docs/api-reference/responses/create#responses_create-tools-mcp_tool
755
+ */
756
+ | {
757
+ type: 'mcp';
758
+ server_label: string;
759
+ allowed_tools: string[] | {
760
+ read_only?: boolean;
761
+ tool_names?: string[];
762
+ } | undefined;
763
+ authorization: string | undefined;
764
+ connector_id: string | undefined;
765
+ headers: Record<string, string> | undefined;
766
+ require_approval: 'always' | 'never' | {
767
+ never?: {
768
+ tool_names?: string[];
769
+ };
770
+ } | undefined;
771
+ server_description: string | undefined;
772
+ server_url: string | undefined;
773
+ } | {
774
+ type: 'custom';
775
+ name: string;
776
+ description?: string;
777
+ format?: {
778
+ type: 'grammar';
779
+ syntax: 'regex' | 'lark';
780
+ definition: string;
781
+ } | {
782
+ type: 'text';
783
+ };
784
+ } | {
785
+ type: 'local_shell';
786
+ } | {
787
+ type: 'shell';
788
+ environment?: {
789
+ type: 'container_auto';
790
+ file_ids?: string[];
791
+ memory_limit?: '1g' | '4g' | '16g' | '64g';
792
+ network_policy?: {
793
+ type: 'disabled';
794
+ } | {
795
+ type: 'allowlist';
796
+ allowed_domains: string[];
797
+ domain_secrets?: Array<{
798
+ domain: string;
799
+ name: string;
800
+ value: string;
801
+ }>;
802
+ };
803
+ skills?: Array<{
804
+ type: 'skill_reference';
805
+ skill_id: string;
806
+ version?: string;
807
+ } | {
808
+ type: 'inline';
809
+ name: string;
810
+ description: string;
811
+ source: {
812
+ type: 'base64';
813
+ media_type: 'application/zip';
814
+ data: string;
815
+ };
816
+ }>;
817
+ } | {
818
+ type: 'container_reference';
819
+ container_id: string;
820
+ } | {
821
+ type: 'local';
822
+ skills?: Array<{
823
+ name: string;
824
+ description: string;
825
+ path: string;
826
+ }>;
827
+ };
828
+ } | {
829
+ type: 'tool_search';
830
+ execution?: 'server' | 'client';
831
+ description?: string;
832
+ parameters?: Record<string, unknown>;
833
+ } | {
834
+ type: 'programmatic_tool_calling';
835
+ };
836
+ type OpenAIResponsesReasoning = {
837
+ type: 'reasoning';
838
+ id?: string;
839
+ encrypted_content?: string | null;
840
+ summary: Array<{
841
+ type: 'summary_text';
842
+ text: string;
843
+ }>;
844
+ };
335
845
  declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
336
846
  type: "unknown_chunk";
337
847
  message: string;
@@ -354,6 +864,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
354
864
  type: "response.output_text.delta";
355
865
  item_id: string;
356
866
  delta: string;
867
+ output_index?: number | null | undefined;
357
868
  logprobs?: {
358
869
  token: string;
359
870
  logprob: number;
@@ -1009,15 +1520,18 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
1009
1520
  type: "response.reasoning_summary_part.added";
1010
1521
  item_id: string;
1011
1522
  summary_index: number;
1523
+ output_index?: number | null | undefined;
1012
1524
  } | {
1013
1525
  type: "response.reasoning_summary_text.delta";
1014
1526
  item_id: string;
1015
1527
  summary_index: number;
1016
1528
  delta: string;
1529
+ output_index?: number | null | undefined;
1017
1530
  } | {
1018
1531
  type: "response.reasoning_summary_part.done";
1019
1532
  item_id: string;
1020
1533
  summary_index: number;
1534
+ output_index?: number | null | undefined;
1021
1535
  } | {
1022
1536
  type: "response.apply_patch_call_operation_diff.delta";
1023
1537
  item_id: string;
@@ -1035,6 +1549,120 @@ type OpenAIResponsesLogprobs = NonNullable<(OpenAIResponsesChunk & {
1035
1549
  type: 'response.output_text.delta';
1036
1550
  })['logprobs']> | null;
1037
1551
 
1552
+ 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 & {});
1553
+
1554
+ declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1555
+ readonly specificationVersion = "v4";
1556
+ readonly modelId: OpenAIResponsesModelId;
1557
+ private readonly config;
1558
+ static [WORKFLOW_SERIALIZE](model: OpenAIResponsesLanguageModel): {
1559
+ modelId: string;
1560
+ config: _ai_sdk_provider.JSONObject;
1561
+ };
1562
+ static [WORKFLOW_DESERIALIZE](options: {
1563
+ modelId: OpenAIResponsesModelId;
1564
+ config: OpenAIConfig;
1565
+ }): OpenAIResponsesLanguageModel;
1566
+ constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
1567
+ readonly supportedUrls: Record<string, RegExp[]>;
1568
+ get provider(): string;
1569
+ protected getArgs({ maxOutputTokens, temperature, stopSequences, topP, topK, presencePenalty, frequencyPenalty, seed, prompt, reasoning, providerOptions, tools, toolChoice, responseFormat, }: LanguageModelV4CallOptions): Promise<{
1570
+ webSearchToolName: string | undefined;
1571
+ args: {
1572
+ tools: OpenAIResponsesTool[] | undefined;
1573
+ tool_choice: "auto" | "none" | "required" | {
1574
+ type: "file_search";
1575
+ } | {
1576
+ type: "web_search_preview";
1577
+ } | {
1578
+ type: "web_search";
1579
+ } | {
1580
+ type: "function";
1581
+ name: string;
1582
+ } | {
1583
+ type: "custom";
1584
+ name: string;
1585
+ } | {
1586
+ type: "code_interpreter";
1587
+ } | {
1588
+ type: "mcp";
1589
+ } | {
1590
+ type: "image_generation";
1591
+ } | {
1592
+ type: "apply_patch";
1593
+ } | {
1594
+ type: "computer";
1595
+ } | {
1596
+ type: "programmatic_tool_calling";
1597
+ } | {
1598
+ type: "allowed_tools";
1599
+ mode: "auto" | "required";
1600
+ tools: Array<{
1601
+ type: "function";
1602
+ name: string;
1603
+ }>;
1604
+ } | undefined;
1605
+ reasoning?: {
1606
+ context?: "auto" | "current_turn" | "all_turns" | undefined;
1607
+ mode?: "standard" | "pro" | undefined;
1608
+ summary?: string | undefined;
1609
+ effort?: string | undefined;
1610
+ } | undefined;
1611
+ context_management?: {
1612
+ type: "compaction";
1613
+ compact_threshold: number;
1614
+ }[] | undefined;
1615
+ conversation: string | null | undefined;
1616
+ max_tool_calls: number | null | undefined;
1617
+ metadata: any;
1618
+ parallel_tool_calls: boolean | null | undefined;
1619
+ previous_response_id: string | null | undefined;
1620
+ store: boolean | null | undefined;
1621
+ user: string | null | undefined;
1622
+ instructions: string | null | undefined;
1623
+ service_tier: "default" | "auto" | "flex" | "priority" | null | undefined;
1624
+ include: OpenAIResponsesIncludeOptions;
1625
+ prompt_cache_key: string | null | undefined;
1626
+ prompt_cache_options: {
1627
+ mode?: "explicit" | "implicit" | undefined;
1628
+ ttl?: "30m" | undefined;
1629
+ } | undefined;
1630
+ prompt_cache_retention: "in_memory" | "24h" | null | undefined;
1631
+ safety_identifier: string | null | undefined;
1632
+ top_logprobs: number | undefined;
1633
+ truncation: "auto" | "disabled" | null | undefined;
1634
+ text?: {
1635
+ verbosity?: "low" | "medium" | "high" | undefined;
1636
+ format?: {
1637
+ type: string;
1638
+ strict: boolean;
1639
+ name: string;
1640
+ description: string | undefined;
1641
+ schema: _ai_sdk_provider.JSONSchema7;
1642
+ } | {
1643
+ type: string;
1644
+ strict?: undefined;
1645
+ name?: undefined;
1646
+ description?: undefined;
1647
+ schema?: undefined;
1648
+ } | undefined;
1649
+ } | undefined;
1650
+ model: OpenAIResponsesModelId;
1651
+ input: OpenAIResponsesInput;
1652
+ temperature: number | undefined;
1653
+ top_p: number | undefined;
1654
+ max_output_tokens: number | undefined;
1655
+ };
1656
+ warnings: SharedV4Warning[];
1657
+ store: boolean | null | undefined;
1658
+ toolNameMapping: _ai_sdk_provider_utils.ToolNameMapping;
1659
+ providerOptionsName: string;
1660
+ isShellProviderExecuted: boolean;
1661
+ }>;
1662
+ doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
1663
+ doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
1664
+ }
1665
+
1038
1666
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1039
1667
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
1040
1668
  type: 'response.output_text.annotation.added';