@ai-sdk/openai 4.0.32 → 4.0.33

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;
@@ -1035,6 +1545,120 @@ type OpenAIResponsesLogprobs = NonNullable<(OpenAIResponsesChunk & {
1035
1545
  type: 'response.output_text.delta';
1036
1546
  })['logprobs']> | null;
1037
1547
 
1548
+ 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 & {});
1549
+
1550
+ declare class OpenAIResponsesLanguageModel implements LanguageModelV4 {
1551
+ readonly specificationVersion = "v4";
1552
+ readonly modelId: OpenAIResponsesModelId;
1553
+ private readonly config;
1554
+ static [WORKFLOW_SERIALIZE](model: OpenAIResponsesLanguageModel): {
1555
+ modelId: string;
1556
+ config: _ai_sdk_provider.JSONObject;
1557
+ };
1558
+ static [WORKFLOW_DESERIALIZE](options: {
1559
+ modelId: OpenAIResponsesModelId;
1560
+ config: OpenAIConfig;
1561
+ }): OpenAIResponsesLanguageModel;
1562
+ constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
1563
+ readonly supportedUrls: Record<string, RegExp[]>;
1564
+ get provider(): string;
1565
+ protected getArgs({ maxOutputTokens, temperature, stopSequences, topP, topK, presencePenalty, frequencyPenalty, seed, prompt, reasoning, providerOptions, tools, toolChoice, responseFormat, }: LanguageModelV4CallOptions): Promise<{
1566
+ webSearchToolName: string | undefined;
1567
+ args: {
1568
+ tools: OpenAIResponsesTool[] | undefined;
1569
+ tool_choice: "auto" | "none" | "required" | {
1570
+ type: "file_search";
1571
+ } | {
1572
+ type: "web_search_preview";
1573
+ } | {
1574
+ type: "web_search";
1575
+ } | {
1576
+ type: "function";
1577
+ name: string;
1578
+ } | {
1579
+ type: "custom";
1580
+ name: string;
1581
+ } | {
1582
+ type: "code_interpreter";
1583
+ } | {
1584
+ type: "mcp";
1585
+ } | {
1586
+ type: "image_generation";
1587
+ } | {
1588
+ type: "apply_patch";
1589
+ } | {
1590
+ type: "computer";
1591
+ } | {
1592
+ type: "programmatic_tool_calling";
1593
+ } | {
1594
+ type: "allowed_tools";
1595
+ mode: "auto" | "required";
1596
+ tools: Array<{
1597
+ type: "function";
1598
+ name: string;
1599
+ }>;
1600
+ } | undefined;
1601
+ reasoning?: {
1602
+ context?: "auto" | "current_turn" | "all_turns" | undefined;
1603
+ mode?: "standard" | "pro" | undefined;
1604
+ summary?: string | undefined;
1605
+ effort?: string | undefined;
1606
+ } | undefined;
1607
+ context_management?: {
1608
+ type: "compaction";
1609
+ compact_threshold: number;
1610
+ }[] | undefined;
1611
+ conversation: string | null | undefined;
1612
+ max_tool_calls: number | null | undefined;
1613
+ metadata: any;
1614
+ parallel_tool_calls: boolean | null | undefined;
1615
+ previous_response_id: string | null | undefined;
1616
+ store: boolean | null | undefined;
1617
+ user: string | null | undefined;
1618
+ instructions: string | null | undefined;
1619
+ service_tier: "default" | "auto" | "flex" | "priority" | null | undefined;
1620
+ include: OpenAIResponsesIncludeOptions;
1621
+ prompt_cache_key: string | null | undefined;
1622
+ prompt_cache_options: {
1623
+ mode?: "explicit" | "implicit" | undefined;
1624
+ ttl?: "30m" | undefined;
1625
+ } | undefined;
1626
+ prompt_cache_retention: "in_memory" | "24h" | null | undefined;
1627
+ safety_identifier: string | null | undefined;
1628
+ top_logprobs: number | undefined;
1629
+ truncation: "auto" | "disabled" | null | undefined;
1630
+ text?: {
1631
+ verbosity?: "low" | "medium" | "high" | undefined;
1632
+ format?: {
1633
+ type: string;
1634
+ strict: boolean;
1635
+ name: string;
1636
+ description: string | undefined;
1637
+ schema: _ai_sdk_provider.JSONSchema7;
1638
+ } | {
1639
+ type: string;
1640
+ strict?: undefined;
1641
+ name?: undefined;
1642
+ description?: undefined;
1643
+ schema?: undefined;
1644
+ } | undefined;
1645
+ } | undefined;
1646
+ model: OpenAIResponsesModelId;
1647
+ input: OpenAIResponsesInput;
1648
+ temperature: number | undefined;
1649
+ top_p: number | undefined;
1650
+ max_output_tokens: number | undefined;
1651
+ };
1652
+ warnings: SharedV4Warning[];
1653
+ store: boolean | null | undefined;
1654
+ toolNameMapping: _ai_sdk_provider_utils.ToolNameMapping;
1655
+ providerOptionsName: string;
1656
+ isShellProviderExecuted: boolean;
1657
+ }>;
1658
+ doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
1659
+ doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
1660
+ }
1661
+
1038
1662
  type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1039
1663
  type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
1040
1664
  type: 'response.output_text.annotation.added';