@ai-sdk/openai 4.0.0-beta.29 → 4.0.0-beta.30

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/dist/index.d.mts DELETED
@@ -1,1210 +0,0 @@
1
- import * as _ai_sdk_provider from '@ai-sdk/provider';
2
- import { JSONValue, ProviderV4, LanguageModelV4, EmbeddingModelV4, ImageModelV4, TranscriptionModelV4, SpeechModelV4, FilesV4, SkillsV4 } from '@ai-sdk/provider';
3
- import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
5
-
6
- 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' | (string & {});
7
- declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
8
- logitBias?: Record<number, number> | undefined;
9
- logprobs?: number | boolean | undefined;
10
- parallelToolCalls?: boolean | undefined;
11
- user?: string | undefined;
12
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
13
- maxCompletionTokens?: number | undefined;
14
- store?: boolean | undefined;
15
- metadata?: Record<string, string> | undefined;
16
- prediction?: Record<string, any> | undefined;
17
- serviceTier?: "default" | "auto" | "flex" | "priority" | undefined;
18
- strictJsonSchema?: boolean | undefined;
19
- textVerbosity?: "low" | "medium" | "high" | undefined;
20
- promptCacheKey?: string | undefined;
21
- promptCacheRetention?: "in_memory" | "24h" | undefined;
22
- safetyIdentifier?: string | undefined;
23
- systemMessageMode?: "remove" | "system" | "developer" | undefined;
24
- forceReasoning?: boolean | undefined;
25
- }>;
26
- type OpenAILanguageModelChatOptions = InferSchema<typeof openaiLanguageModelChatOptions>;
27
-
28
- type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | 'gpt-3.5-turbo-instruct-0914' | (string & {});
29
- declare const openaiLanguageModelCompletionOptions: _ai_sdk_provider_utils.LazySchema<{
30
- echo?: boolean | undefined;
31
- logitBias?: Record<string, number> | undefined;
32
- suffix?: string | undefined;
33
- user?: string | undefined;
34
- logprobs?: number | boolean | undefined;
35
- }>;
36
- type OpenAILanguageModelCompletionOptions = InferSchema<typeof openaiLanguageModelCompletionOptions>;
37
-
38
- type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
39
- declare const openaiEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
40
- dimensions?: number | undefined;
41
- user?: string | undefined;
42
- }>;
43
- type OpenAIEmbeddingModelOptions = InferSchema<typeof openaiEmbeddingModelOptions>;
44
-
45
- type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5' | 'chatgpt-image-latest' | (string & {});
46
-
47
- declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
48
- /**
49
- * An object describing the specific action taken in this web search call.
50
- * Includes details on how the model used the web (search, open_page, find_in_page).
51
- */
52
- action?: {
53
- /**
54
- * Action type "search" - Performs a web search query.
55
- */
56
- type: "search";
57
- /**
58
- * The search query.
59
- */
60
- query?: string;
61
- } | {
62
- /**
63
- * Action type "openPage" - Opens a specific URL from search results.
64
- */
65
- type: "openPage";
66
- /**
67
- * The URL opened by the model.
68
- */
69
- url?: string | null;
70
- } | {
71
- /**
72
- * Action type "findInPage": Searches for a pattern within a loaded page.
73
- */
74
- type: "findInPage";
75
- /**
76
- * The URL of the page searched for the pattern.
77
- */
78
- url?: string | null;
79
- /**
80
- * The pattern or text to search for within the page.
81
- */
82
- pattern?: string | null;
83
- };
84
- /**
85
- * Optional sources cited by the model for the web search call.
86
- */
87
- sources?: Array<{
88
- type: "url";
89
- url: string;
90
- } | {
91
- type: "api";
92
- name: string;
93
- }>;
94
- }, {
95
- /**
96
- * Whether to use external web access for fetching live content.
97
- * - true: Fetch live web content (default)
98
- * - false: Use cached/indexed results
99
- */
100
- externalWebAccess?: boolean;
101
- /**
102
- * Filters for the search.
103
- */
104
- filters?: {
105
- /**
106
- * Allowed domains for the search.
107
- * If not provided, all domains are allowed.
108
- * Subdomains of the provided domains are allowed as well.
109
- */
110
- allowedDomains?: string[];
111
- };
112
- /**
113
- * Search context size to use for the web search.
114
- * - high: Most comprehensive context, highest cost, slower response
115
- * - medium: Balanced context, cost, and latency (default)
116
- * - low: Least context, lowest cost, fastest response
117
- */
118
- searchContextSize?: "low" | "medium" | "high";
119
- /**
120
- * User location information to provide geographically relevant search results.
121
- */
122
- userLocation?: {
123
- /**
124
- * Type of location (always 'approximate')
125
- */
126
- type: "approximate";
127
- /**
128
- * Two-letter ISO country code (e.g., 'US', 'GB')
129
- */
130
- country?: string;
131
- /**
132
- * City name (free text, e.g., 'Minneapolis')
133
- */
134
- city?: string;
135
- /**
136
- * Region name (free text, e.g., 'Minnesota')
137
- */
138
- region?: string;
139
- /**
140
- * IANA timezone (e.g., 'America/Chicago')
141
- */
142
- timezone?: string;
143
- };
144
- }, {}>;
145
-
146
- /**
147
- * A filter used to compare a specified attribute key to a given value using a defined comparison operation.
148
- */
149
- type OpenAIResponsesFileSearchToolComparisonFilter = {
150
- /**
151
- * The key to compare against the value.
152
- */
153
- key: string;
154
- /**
155
- * Specifies the comparison operator: eq, ne, gt, gte, lt, lte, in, nin.
156
- */
157
- type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin';
158
- /**
159
- * The value to compare against the attribute key; supports string, number, boolean, or array of string types.
160
- */
161
- value: string | number | boolean | string[];
162
- };
163
- /**
164
- * Combine multiple filters using and or or.
165
- */
166
- type OpenAIResponsesFileSearchToolCompoundFilter = {
167
- /**
168
- * Type of operation: and or or.
169
- */
170
- type: 'and' | 'or';
171
- /**
172
- * Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
173
- */
174
- filters: Array<OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter>;
175
- };
176
- declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
177
- type: "unknown_chunk";
178
- message: string;
179
- } | {
180
- type: "response.output_text.delta";
181
- item_id: string;
182
- delta: string;
183
- logprobs?: {
184
- token: string;
185
- logprob: number;
186
- top_logprobs: {
187
- token: string;
188
- logprob: number;
189
- }[];
190
- }[] | null | undefined;
191
- } | {
192
- type: "response.completed" | "response.incomplete";
193
- response: {
194
- usage: {
195
- input_tokens: number;
196
- output_tokens: number;
197
- input_tokens_details?: {
198
- cached_tokens?: number | null | undefined;
199
- } | null | undefined;
200
- output_tokens_details?: {
201
- reasoning_tokens?: number | null | undefined;
202
- } | null | undefined;
203
- };
204
- incomplete_details?: {
205
- reason: string;
206
- } | null | undefined;
207
- service_tier?: string | null | undefined;
208
- };
209
- } | {
210
- type: "response.failed";
211
- response: {
212
- error?: {
213
- message: string;
214
- code?: string | null | undefined;
215
- } | null | undefined;
216
- incomplete_details?: {
217
- reason: string;
218
- } | null | undefined;
219
- usage?: {
220
- input_tokens: number;
221
- output_tokens: number;
222
- input_tokens_details?: {
223
- cached_tokens?: number | null | undefined;
224
- } | null | undefined;
225
- output_tokens_details?: {
226
- reasoning_tokens?: number | null | undefined;
227
- } | null | undefined;
228
- } | null | undefined;
229
- service_tier?: string | null | undefined;
230
- };
231
- } | {
232
- type: "response.created";
233
- response: {
234
- id: string;
235
- created_at: number;
236
- model: string;
237
- service_tier?: string | null | undefined;
238
- };
239
- } | {
240
- type: "response.output_item.added";
241
- output_index: number;
242
- item: {
243
- type: "message";
244
- id: string;
245
- phase?: "commentary" | "final_answer" | null | undefined;
246
- } | {
247
- type: "reasoning";
248
- id: string;
249
- encrypted_content?: string | null | undefined;
250
- } | {
251
- type: "function_call";
252
- id: string;
253
- call_id: string;
254
- name: string;
255
- arguments: string;
256
- } | {
257
- type: "web_search_call";
258
- id: string;
259
- status: string;
260
- } | {
261
- type: "computer_call";
262
- id: string;
263
- status: string;
264
- } | {
265
- type: "file_search_call";
266
- id: string;
267
- } | {
268
- type: "image_generation_call";
269
- id: string;
270
- } | {
271
- type: "code_interpreter_call";
272
- id: string;
273
- container_id: string;
274
- code: string | null;
275
- outputs: ({
276
- type: "logs";
277
- logs: string;
278
- } | {
279
- type: "image";
280
- url: string;
281
- })[] | null;
282
- status: string;
283
- } | {
284
- type: "mcp_call";
285
- id: string;
286
- status: string;
287
- approval_request_id?: string | null | undefined;
288
- } | {
289
- type: "mcp_list_tools";
290
- id: string;
291
- } | {
292
- type: "mcp_approval_request";
293
- id: string;
294
- } | {
295
- type: "apply_patch_call";
296
- id: string;
297
- call_id: string;
298
- status: "completed" | "in_progress";
299
- operation: {
300
- type: "create_file";
301
- path: string;
302
- diff: string;
303
- } | {
304
- type: "delete_file";
305
- path: string;
306
- } | {
307
- type: "update_file";
308
- path: string;
309
- diff: string;
310
- };
311
- } | {
312
- type: "custom_tool_call";
313
- id: string;
314
- call_id: string;
315
- name: string;
316
- input: string;
317
- } | {
318
- type: "shell_call";
319
- id: string;
320
- call_id: string;
321
- status: "completed" | "in_progress" | "incomplete";
322
- action: {
323
- commands: string[];
324
- };
325
- } | {
326
- type: "compaction";
327
- id: string;
328
- encrypted_content?: string | null | undefined;
329
- } | {
330
- type: "shell_call_output";
331
- id: string;
332
- call_id: string;
333
- status: "completed" | "in_progress" | "incomplete";
334
- output: {
335
- stdout: string;
336
- stderr: string;
337
- outcome: {
338
- type: "timeout";
339
- } | {
340
- type: "exit";
341
- exit_code: number;
342
- };
343
- }[];
344
- } | {
345
- type: "tool_search_call";
346
- id: string;
347
- execution: "server" | "client";
348
- call_id: string | null;
349
- status: "completed" | "in_progress" | "incomplete";
350
- arguments: unknown;
351
- } | {
352
- type: "tool_search_output";
353
- id: string;
354
- execution: "server" | "client";
355
- call_id: string | null;
356
- status: "completed" | "in_progress" | "incomplete";
357
- tools: Record<string, JSONValue | undefined>[];
358
- };
359
- } | {
360
- type: "response.output_item.done";
361
- output_index: number;
362
- item: {
363
- type: "message";
364
- id: string;
365
- phase?: "commentary" | "final_answer" | null | undefined;
366
- } | {
367
- type: "reasoning";
368
- id: string;
369
- encrypted_content?: string | null | undefined;
370
- } | {
371
- type: "function_call";
372
- id: string;
373
- call_id: string;
374
- name: string;
375
- arguments: string;
376
- status: "completed";
377
- } | {
378
- type: "custom_tool_call";
379
- id: string;
380
- call_id: string;
381
- name: string;
382
- input: string;
383
- status: "completed";
384
- } | {
385
- type: "code_interpreter_call";
386
- id: string;
387
- code: string | null;
388
- container_id: string;
389
- outputs: ({
390
- type: "logs";
391
- logs: string;
392
- } | {
393
- type: "image";
394
- url: string;
395
- })[] | null;
396
- } | {
397
- type: "image_generation_call";
398
- id: string;
399
- result: string;
400
- } | {
401
- type: "web_search_call";
402
- id: string;
403
- status: string;
404
- action?: {
405
- type: "search";
406
- query?: string | null | undefined;
407
- sources?: ({
408
- type: "url";
409
- url: string;
410
- } | {
411
- type: "api";
412
- name: string;
413
- })[] | null | undefined;
414
- } | {
415
- type: "open_page";
416
- url?: string | null | undefined;
417
- } | {
418
- type: "find_in_page";
419
- url?: string | null | undefined;
420
- pattern?: string | null | undefined;
421
- } | null | undefined;
422
- } | {
423
- type: "file_search_call";
424
- id: string;
425
- queries: string[];
426
- results?: {
427
- attributes: Record<string, string | number | boolean>;
428
- file_id: string;
429
- filename: string;
430
- score: number;
431
- text: string;
432
- }[] | null | undefined;
433
- } | {
434
- type: "local_shell_call";
435
- id: string;
436
- call_id: string;
437
- action: {
438
- type: "exec";
439
- command: string[];
440
- timeout_ms?: number | undefined;
441
- user?: string | undefined;
442
- working_directory?: string | undefined;
443
- env?: Record<string, string> | undefined;
444
- };
445
- } | {
446
- type: "computer_call";
447
- id: string;
448
- status: "completed";
449
- } | {
450
- type: "mcp_call";
451
- id: string;
452
- status: string;
453
- arguments: string;
454
- name: string;
455
- server_label: string;
456
- output?: string | null | undefined;
457
- error?: string | {
458
- [x: string]: unknown;
459
- type?: string | undefined;
460
- code?: string | number | undefined;
461
- message?: string | undefined;
462
- } | null | undefined;
463
- approval_request_id?: string | null | undefined;
464
- } | {
465
- type: "mcp_list_tools";
466
- id: string;
467
- server_label: string;
468
- tools: {
469
- name: string;
470
- input_schema: any;
471
- description?: string | undefined;
472
- annotations?: Record<string, unknown> | undefined;
473
- }[];
474
- error?: string | {
475
- [x: string]: unknown;
476
- type?: string | undefined;
477
- code?: string | number | undefined;
478
- message?: string | undefined;
479
- } | undefined;
480
- } | {
481
- type: "mcp_approval_request";
482
- id: string;
483
- server_label: string;
484
- name: string;
485
- arguments: string;
486
- approval_request_id?: string | undefined;
487
- } | {
488
- type: "apply_patch_call";
489
- id: string;
490
- call_id: string;
491
- status: "completed" | "in_progress";
492
- operation: {
493
- type: "create_file";
494
- path: string;
495
- diff: string;
496
- } | {
497
- type: "delete_file";
498
- path: string;
499
- } | {
500
- type: "update_file";
501
- path: string;
502
- diff: string;
503
- };
504
- } | {
505
- type: "shell_call";
506
- id: string;
507
- call_id: string;
508
- status: "completed" | "in_progress" | "incomplete";
509
- action: {
510
- commands: string[];
511
- };
512
- } | {
513
- type: "compaction";
514
- id: string;
515
- encrypted_content: string;
516
- } | {
517
- type: "shell_call_output";
518
- id: string;
519
- call_id: string;
520
- status: "completed" | "in_progress" | "incomplete";
521
- output: {
522
- stdout: string;
523
- stderr: string;
524
- outcome: {
525
- type: "timeout";
526
- } | {
527
- type: "exit";
528
- exit_code: number;
529
- };
530
- }[];
531
- } | {
532
- type: "tool_search_call";
533
- id: string;
534
- execution: "server" | "client";
535
- call_id: string | null;
536
- status: "completed" | "in_progress" | "incomplete";
537
- arguments: unknown;
538
- } | {
539
- type: "tool_search_output";
540
- id: string;
541
- execution: "server" | "client";
542
- call_id: string | null;
543
- status: "completed" | "in_progress" | "incomplete";
544
- tools: Record<string, JSONValue | undefined>[];
545
- };
546
- } | {
547
- type: "response.function_call_arguments.delta";
548
- item_id: string;
549
- output_index: number;
550
- delta: string;
551
- } | {
552
- type: "response.custom_tool_call_input.delta";
553
- item_id: string;
554
- output_index: number;
555
- delta: string;
556
- } | {
557
- type: "response.image_generation_call.partial_image";
558
- item_id: string;
559
- output_index: number;
560
- partial_image_b64: string;
561
- } | {
562
- type: "response.code_interpreter_call_code.delta";
563
- item_id: string;
564
- output_index: number;
565
- delta: string;
566
- } | {
567
- type: "response.code_interpreter_call_code.done";
568
- item_id: string;
569
- output_index: number;
570
- code: string;
571
- } | {
572
- type: "response.output_text.annotation.added";
573
- annotation: {
574
- type: "url_citation";
575
- start_index: number;
576
- end_index: number;
577
- url: string;
578
- title: string;
579
- } | {
580
- type: "file_citation";
581
- file_id: string;
582
- filename: string;
583
- index: number;
584
- } | {
585
- type: "container_file_citation";
586
- container_id: string;
587
- file_id: string;
588
- filename: string;
589
- start_index: number;
590
- end_index: number;
591
- } | {
592
- type: "file_path";
593
- file_id: string;
594
- index: number;
595
- };
596
- } | {
597
- type: "response.reasoning_summary_part.added";
598
- item_id: string;
599
- summary_index: number;
600
- } | {
601
- type: "response.reasoning_summary_text.delta";
602
- item_id: string;
603
- summary_index: number;
604
- delta: string;
605
- } | {
606
- type: "response.reasoning_summary_part.done";
607
- item_id: string;
608
- summary_index: number;
609
- } | {
610
- type: "response.apply_patch_call_operation_diff.delta";
611
- item_id: string;
612
- output_index: number;
613
- delta: string;
614
- obfuscation?: string | null | undefined;
615
- } | {
616
- type: "response.apply_patch_call_operation_diff.done";
617
- item_id: string;
618
- output_index: number;
619
- diff: string;
620
- } | {
621
- type: "error";
622
- sequence_number: number;
623
- error: {
624
- type: string;
625
- code: string;
626
- message: string;
627
- param?: string | null | undefined;
628
- };
629
- }>;
630
- type OpenAIResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
631
- type OpenAIResponsesLogprobs = NonNullable<(OpenAIResponsesChunk & {
632
- type: 'response.output_text.delta';
633
- })['logprobs']> | null;
634
-
635
- declare const customToolFactory: _ai_sdk_provider_utils.ProviderToolFactory<string, {
636
- /**
637
- * An optional description of what the tool does.
638
- */
639
- description?: string;
640
- /**
641
- * The output format specification for the tool.
642
- * Omit for unconstrained text output.
643
- */
644
- format?: {
645
- type: "grammar";
646
- syntax: "regex" | "lark";
647
- definition: string;
648
- } | {
649
- type: "text";
650
- };
651
- }, {}>;
652
-
653
- /**
654
- * Type definitions for the apply_patch operations.
655
- */
656
- type ApplyPatchOperation = {
657
- type: 'create_file';
658
- /**
659
- * Path of the file to create relative to the workspace root.
660
- */
661
- path: string;
662
- /**
663
- * Unified diff content to apply when creating the file.
664
- */
665
- diff: string;
666
- } | {
667
- type: 'delete_file';
668
- /**
669
- * Path of the file to delete relative to the workspace root.
670
- */
671
- path: string;
672
- } | {
673
- type: 'update_file';
674
- /**
675
- * Path of the file to update relative to the workspace root.
676
- */
677
- path: string;
678
- /**
679
- * Unified diff content to apply to the existing file.
680
- */
681
- diff: string;
682
- };
683
-
684
- declare const openaiTools: {
685
- /**
686
- * The apply_patch tool lets GPT-5.1 create, update, and delete files in your
687
- * codebase using structured diffs. Instead of just suggesting edits, the model
688
- * emits patch operations that your application applies and then reports back on,
689
- * enabling iterative, multi-step code editing workflows.
690
- *
691
- */
692
- applyPatch: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
693
- callId: string;
694
- operation: ApplyPatchOperation;
695
- }, {
696
- status: "completed" | "failed";
697
- output?: string;
698
- }, {}, {}>;
699
- /**
700
- * Custom tools let callers constrain model output to a grammar (regex or
701
- * Lark syntax). The model returns a `custom_tool_call` output item whose
702
- * `input` field is a string matching the specified grammar.
703
- *
704
- * @param description - An optional description of the tool.
705
- * @param format - The output format constraint (grammar type, syntax, and definition).
706
- */
707
- customTool: (args: Parameters<typeof customToolFactory>[0]) => _ai_sdk_provider_utils.Tool<string, unknown, {}>;
708
- /**
709
- * The Code Interpreter tool allows models to write and run Python code in a
710
- * sandboxed environment to solve complex problems in domains like data analysis,
711
- * coding, and math.
712
- *
713
- * @param container - The container to use for the code interpreter.
714
- */
715
- codeInterpreter: (args?: {
716
- container?: string | {
717
- fileIds?: string[];
718
- };
719
- }) => _ai_sdk_provider_utils.Tool<{
720
- code?: string | null;
721
- containerId: string;
722
- }, {
723
- outputs?: Array<{
724
- type: "logs";
725
- logs: string;
726
- } | {
727
- type: "image";
728
- url: string;
729
- }> | null;
730
- }, {}>;
731
- /**
732
- * File search is a tool available in the Responses API. It enables models to
733
- * retrieve information in a knowledge base of previously uploaded files through
734
- * semantic and keyword search.
735
- *
736
- * @param vectorStoreIds - The vector store IDs to use for the file search.
737
- * @param maxNumResults - The maximum number of results to return.
738
- * @param ranking - The ranking options to use for the file search.
739
- * @param filters - The filters to use for the file search.
740
- */
741
- fileSearch: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
742
- queries: string[];
743
- results: null | {
744
- attributes: Record<string, unknown>;
745
- fileId: string;
746
- filename: string;
747
- score: number;
748
- text: string;
749
- }[];
750
- }, {
751
- vectorStoreIds: string[];
752
- maxNumResults?: number;
753
- ranking?: {
754
- ranker?: string;
755
- scoreThreshold?: number;
756
- };
757
- filters?: OpenAIResponsesFileSearchToolComparisonFilter | OpenAIResponsesFileSearchToolCompoundFilter;
758
- }, {}>;
759
- /**
760
- * The image generation tool allows you to generate images using a text prompt,
761
- * and optionally image inputs. It leverages the GPT Image model,
762
- * and automatically optimizes text inputs for improved performance.
763
- *
764
- * @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
765
- * @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
766
- * @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
767
- * @param model - The image generation model to use. Default: gpt-image-1.
768
- * @param moderation - Moderation level for the generated image. Default: 'auto'.
769
- * @param outputCompression - Compression level for the output image (0-100).
770
- * @param outputFormat - The output format of the generated image. One of 'png', 'jpeg', or 'webp'.
771
- * @param partialImages - Number of partial images to generate in streaming mode (0-3).
772
- * @param quality - The quality of the generated image. One of 'auto', 'low', 'medium', or 'high'.
773
- * @param size - The size of the generated image. One of 'auto', '1024x1024', '1024x1536', or '1536x1024'.
774
- */
775
- imageGeneration: (args?: {
776
- background?: "auto" | "opaque" | "transparent";
777
- inputFidelity?: "low" | "high";
778
- inputImageMask?: {
779
- fileId?: string;
780
- imageUrl?: string;
781
- };
782
- model?: string;
783
- moderation?: "auto";
784
- outputCompression?: number;
785
- outputFormat?: "png" | "jpeg" | "webp";
786
- partialImages?: number;
787
- quality?: "auto" | "low" | "medium" | "high";
788
- size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
789
- }) => _ai_sdk_provider_utils.Tool<{}, {
790
- result: string;
791
- }, {}>;
792
- /**
793
- * Local shell is a tool that allows agents to run shell commands locally
794
- * on a machine you or the user provides.
795
- *
796
- * Supported models: `gpt-5-codex`
797
- */
798
- localShell: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
799
- action: {
800
- type: "exec";
801
- command: string[];
802
- timeoutMs?: number;
803
- user?: string;
804
- workingDirectory?: string;
805
- env?: Record<string, string>;
806
- };
807
- }, {
808
- output: string;
809
- }, {}, {}>;
810
- /**
811
- * The shell tool allows the model to interact with your local computer through
812
- * a controlled command-line interface. The model proposes shell commands; your
813
- * integration executes them and returns the outputs.
814
- *
815
- * Available through the Responses API for use with GPT-5.1.
816
- *
817
- * WARNING: Running arbitrary shell commands can be dangerous. Always sandbox
818
- * execution or add strict allow-/deny-lists before forwarding a command to
819
- * the system shell.
820
- */
821
- shell: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
822
- action: {
823
- commands: string[];
824
- timeoutMs?: number;
825
- maxOutputLength?: number;
826
- };
827
- }, {
828
- output: Array<{
829
- stdout: string;
830
- stderr: string;
831
- outcome: {
832
- type: "timeout";
833
- } | {
834
- type: "exit";
835
- exitCode: number;
836
- };
837
- }>;
838
- }, {
839
- environment?: {
840
- type: "containerAuto";
841
- fileIds?: string[];
842
- memoryLimit?: "1g" | "4g" | "16g" | "64g";
843
- networkPolicy?: {
844
- type: "disabled";
845
- } | {
846
- type: "allowlist";
847
- allowedDomains: string[];
848
- domainSecrets?: Array<{
849
- domain: string;
850
- name: string;
851
- value: string;
852
- }>;
853
- };
854
- skills?: Array<{
855
- type: "skillReference";
856
- providerReference: _ai_sdk_provider.SharedV4ProviderReference;
857
- version?: string;
858
- } | {
859
- type: "inline";
860
- name: string;
861
- description: string;
862
- source: {
863
- type: "base64";
864
- mediaType: "application/zip";
865
- data: string;
866
- };
867
- }>;
868
- } | {
869
- type: "containerReference";
870
- containerId: string;
871
- } | {
872
- type?: "local";
873
- skills?: Array<{
874
- name: string;
875
- description: string;
876
- path: string;
877
- }>;
878
- };
879
- }, {}>;
880
- /**
881
- * Web search allows models to access up-to-date information from the internet
882
- * and provide answers with sourced citations.
883
- *
884
- * @param searchContextSize - The search context size to use for the web search.
885
- * @param userLocation - The user location to use for the web search.
886
- */
887
- webSearchPreview: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{}, {
888
- action?: {
889
- type: "search";
890
- query?: string;
891
- } | {
892
- type: "openPage";
893
- url?: string | null;
894
- } | {
895
- type: "findInPage";
896
- url?: string | null;
897
- pattern?: string | null;
898
- };
899
- }, {
900
- searchContextSize?: "low" | "medium" | "high";
901
- userLocation?: {
902
- type: "approximate";
903
- country?: string;
904
- city?: string;
905
- region?: string;
906
- timezone?: string;
907
- };
908
- }, {}>;
909
- /**
910
- * Web search allows models to access up-to-date information from the internet
911
- * and provide answers with sourced citations.
912
- *
913
- * @param filters - The filters to use for the web search.
914
- * @param searchContextSize - The search context size to use for the web search.
915
- * @param userLocation - The user location to use for the web search.
916
- */
917
- webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
918
- action?: {
919
- type: "search";
920
- query?: string;
921
- } | {
922
- type: "openPage";
923
- url?: string | null;
924
- } | {
925
- type: "findInPage";
926
- url?: string | null;
927
- pattern?: string | null;
928
- };
929
- sources?: Array<{
930
- type: "url";
931
- url: string;
932
- } | {
933
- type: "api";
934
- name: string;
935
- }>;
936
- }, {}>;
937
- /**
938
- * MCP (Model Context Protocol) allows models to call tools exposed by
939
- * remote MCP servers or service connectors.
940
- *
941
- * @param serverLabel - Label to identify the MCP server.
942
- * @param allowedTools - Allowed tool names or filter object.
943
- * @param authorization - OAuth access token for the MCP server/connector.
944
- * @param connectorId - Identifier for a service connector.
945
- * @param headers - Optional headers to include in MCP requests.
946
- * // param requireApproval - Approval policy ('always'|'never'|filter object). (Removed - always 'never')
947
- * @param serverDescription - Optional description of the server.
948
- * @param serverUrl - URL for the MCP server.
949
- */
950
- mcp: (args: {
951
- serverLabel: string;
952
- allowedTools?: string[] | {
953
- readOnly?: boolean;
954
- toolNames?: string[];
955
- };
956
- authorization?: string;
957
- connectorId?: string;
958
- headers?: Record<string, string>;
959
- requireApproval?: "always" | "never" | {
960
- never?: {
961
- toolNames?: string[];
962
- };
963
- };
964
- serverDescription?: string;
965
- serverUrl?: string;
966
- }) => _ai_sdk_provider_utils.Tool<{}, {
967
- type: "call";
968
- serverLabel: string;
969
- name: string;
970
- arguments: string;
971
- output?: string | null;
972
- error?: _ai_sdk_provider.JSONValue;
973
- }, {}>;
974
- /**
975
- * Tool search allows the model to dynamically search for and load deferred
976
- * tools into the model's context as needed. This helps reduce overall token
977
- * usage, cost, and latency by only loading tools when the model needs them.
978
- *
979
- * To use tool search, mark functions or namespaces with `defer_loading: true`
980
- * in the tools array. The model will use tool search to load these tools
981
- * when it determines they are needed.
982
- */
983
- toolSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
984
- arguments?: unknown;
985
- call_id?: string | null;
986
- }, {
987
- tools: Array<_ai_sdk_provider.JSONObject>;
988
- }, {
989
- execution?: "server" | "client";
990
- description?: string;
991
- parameters?: Record<string, unknown>;
992
- }, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
993
- arguments?: unknown;
994
- call_id?: string | null;
995
- }, {
996
- tools: Array<_ai_sdk_provider.JSONObject>;
997
- }, {}>;
998
- };
999
-
1000
- 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-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 & {});
1001
- declare const openaiLanguageModelResponsesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
1002
- conversation?: string | null | undefined;
1003
- include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
1004
- instructions?: string | null | undefined;
1005
- logprobs?: number | boolean | undefined;
1006
- maxToolCalls?: number | null | undefined;
1007
- metadata?: any;
1008
- parallelToolCalls?: boolean | null | undefined;
1009
- previousResponseId?: string | null | undefined;
1010
- promptCacheKey?: string | null | undefined;
1011
- promptCacheRetention?: "in_memory" | "24h" | null | undefined;
1012
- reasoningEffort?: string | null | undefined;
1013
- reasoningSummary?: string | null | undefined;
1014
- safetyIdentifier?: string | null | undefined;
1015
- serviceTier?: "default" | "auto" | "flex" | "priority" | null | undefined;
1016
- store?: boolean | null | undefined;
1017
- strictJsonSchema?: boolean | null | undefined;
1018
- textVerbosity?: "low" | "medium" | "high" | null | undefined;
1019
- truncation?: "auto" | "disabled" | null | undefined;
1020
- user?: string | null | undefined;
1021
- systemMessageMode?: "remove" | "system" | "developer" | undefined;
1022
- forceReasoning?: boolean | undefined;
1023
- contextManagement?: {
1024
- type: "compaction";
1025
- compactThreshold: number;
1026
- }[] | null | undefined;
1027
- }>;
1028
- type OpenAILanguageModelResponsesOptions = InferSchema<typeof openaiLanguageModelResponsesOptionsSchema>;
1029
-
1030
- type OpenAISpeechModelId = 'tts-1' | 'tts-1-1106' | 'tts-1-hd' | 'tts-1-hd-1106' | 'gpt-4o-mini-tts' | 'gpt-4o-mini-tts-2025-03-20' | 'gpt-4o-mini-tts-2025-12-15' | (string & {});
1031
- declare const openaiSpeechModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
1032
- instructions?: string | null | undefined;
1033
- speed?: number | null | undefined;
1034
- }>;
1035
- type OpenAISpeechModelOptions = InferSchema<typeof openaiSpeechModelOptionsSchema>;
1036
-
1037
- type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-mini-transcribe-2025-03-20' | 'gpt-4o-mini-transcribe-2025-12-15' | 'gpt-4o-transcribe' | 'gpt-4o-transcribe-diarize' | (string & {});
1038
- declare const openAITranscriptionModelOptions: _ai_sdk_provider_utils.LazySchema<{
1039
- include?: string[] | undefined;
1040
- language?: string | undefined;
1041
- prompt?: string | undefined;
1042
- temperature?: number | undefined;
1043
- timestampGranularities?: ("word" | "segment")[] | undefined;
1044
- }>;
1045
- type OpenAITranscriptionModelOptions = InferSchema<typeof openAITranscriptionModelOptions>;
1046
-
1047
- interface OpenAIProvider extends ProviderV4 {
1048
- (modelId: OpenAIResponsesModelId): LanguageModelV4;
1049
- /**
1050
- * Creates an OpenAI model for text generation.
1051
- */
1052
- languageModel(modelId: OpenAIResponsesModelId): LanguageModelV4;
1053
- /**
1054
- * Creates an OpenAI chat model for text generation.
1055
- */
1056
- chat(modelId: OpenAIChatModelId): LanguageModelV4;
1057
- /**
1058
- * Creates an OpenAI responses API model for text generation.
1059
- */
1060
- responses(modelId: OpenAIResponsesModelId): LanguageModelV4;
1061
- /**
1062
- * Creates an OpenAI completion model for text generation.
1063
- */
1064
- completion(modelId: OpenAICompletionModelId): LanguageModelV4;
1065
- /**
1066
- * Creates a model for text embeddings.
1067
- */
1068
- embedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
1069
- /**
1070
- * Creates a model for text embeddings.
1071
- */
1072
- embeddingModel(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
1073
- /**
1074
- * @deprecated Use `embedding` instead.
1075
- */
1076
- textEmbedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
1077
- /**
1078
- * @deprecated Use `embeddingModel` instead.
1079
- */
1080
- textEmbeddingModel(modelId: OpenAIEmbeddingModelId): EmbeddingModelV4;
1081
- /**
1082
- * Creates a model for image generation.
1083
- */
1084
- image(modelId: OpenAIImageModelId): ImageModelV4;
1085
- /**
1086
- * Creates a model for image generation.
1087
- */
1088
- imageModel(modelId: OpenAIImageModelId): ImageModelV4;
1089
- /**
1090
- * Creates a model for transcription.
1091
- */
1092
- transcription(modelId: OpenAITranscriptionModelId): TranscriptionModelV4;
1093
- /**
1094
- * Creates a model for speech generation.
1095
- */
1096
- speech(modelId: OpenAISpeechModelId): SpeechModelV4;
1097
- /**
1098
- * Returns a FilesV4 interface for uploading files to OpenAI.
1099
- */
1100
- files(): FilesV4;
1101
- /**
1102
- * Returns a SkillsV4 interface for uploading skills to OpenAI.
1103
- */
1104
- skills(): SkillsV4;
1105
- /**
1106
- * OpenAI-specific tools.
1107
- */
1108
- tools: typeof openaiTools;
1109
- }
1110
- interface OpenAIProviderSettings {
1111
- /**
1112
- * Base URL for the OpenAI API calls.
1113
- */
1114
- baseURL?: string;
1115
- /**
1116
- * API key for authenticating requests.
1117
- */
1118
- apiKey?: string;
1119
- /**
1120
- * OpenAI Organization.
1121
- */
1122
- organization?: string;
1123
- /**
1124
- * OpenAI project.
1125
- */
1126
- project?: string;
1127
- /**
1128
- * Custom headers to include in the requests.
1129
- */
1130
- headers?: Record<string, string>;
1131
- /**
1132
- * Provider name. Overrides the `openai` default name for 3rd party providers.
1133
- */
1134
- name?: string;
1135
- /**
1136
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
1137
- * or to provide a custom fetch implementation for e.g. testing.
1138
- */
1139
- fetch?: FetchFunction;
1140
- }
1141
- /**
1142
- * Create an OpenAI provider instance.
1143
- */
1144
- declare function createOpenAI(options?: OpenAIProviderSettings): OpenAIProvider;
1145
- /**
1146
- * Default OpenAI provider instance.
1147
- */
1148
- declare const openai: OpenAIProvider;
1149
-
1150
- declare const openaiFilesOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
1151
- purpose?: string | undefined;
1152
- expiresAfter?: number | undefined;
1153
- }>;
1154
- type OpenAIFilesOptions = InferSchema<typeof openaiFilesOptionsSchema>;
1155
-
1156
- type OpenaiResponsesChunk = InferSchema<typeof openaiResponsesChunkSchema>;
1157
- type ResponsesOutputTextAnnotationProviderMetadata = Extract<OpenaiResponsesChunk, {
1158
- type: 'response.output_text.annotation.added';
1159
- }>['annotation'];
1160
- type ResponsesProviderMetadata = {
1161
- responseId: string | null | undefined;
1162
- logprobs?: Array<OpenAIResponsesLogprobs>;
1163
- serviceTier?: string;
1164
- };
1165
- type ResponsesReasoningProviderMetadata = {
1166
- itemId: string;
1167
- reasoningEncryptedContent?: string | null;
1168
- };
1169
- type OpenaiResponsesReasoningProviderMetadata = {
1170
- openai: ResponsesReasoningProviderMetadata;
1171
- };
1172
- type OpenaiResponsesProviderMetadata = {
1173
- openai: ResponsesProviderMetadata;
1174
- };
1175
- type ResponsesCompactionProviderMetadata = {
1176
- type: 'compaction';
1177
- itemId: string;
1178
- encryptedContent?: string;
1179
- };
1180
- type OpenaiResponsesCompactionProviderMetadata = {
1181
- openai: ResponsesCompactionProviderMetadata;
1182
- };
1183
- type ResponsesTextProviderMetadata = {
1184
- itemId: string;
1185
- phase?: 'commentary' | 'final_answer' | null;
1186
- annotations?: Array<ResponsesOutputTextAnnotationProviderMetadata>;
1187
- };
1188
- type OpenaiResponsesTextProviderMetadata = {
1189
- openai: ResponsesTextProviderMetadata;
1190
- };
1191
- type ResponsesSourceDocumentProviderMetadata = {
1192
- type: 'file_citation';
1193
- fileId: string;
1194
- index: number;
1195
- } | {
1196
- type: 'container_file_citation';
1197
- fileId: string;
1198
- containerId: string;
1199
- } | {
1200
- type: 'file_path';
1201
- fileId: string;
1202
- index: number;
1203
- };
1204
- type OpenaiResponsesSourceDocumentProviderMetadata = {
1205
- openai: ResponsesSourceDocumentProviderMetadata;
1206
- };
1207
-
1208
- declare const VERSION: string;
1209
-
1210
- export { type OpenAILanguageModelChatOptions as OpenAIChatLanguageModelOptions, type OpenAIEmbeddingModelOptions, type OpenAIFilesOptions, 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 };