@bodhiapp/ts-client 0.1.26 → 0.1.27

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.
@@ -0,0 +1,4810 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ /**
4
+ * An annotation that applies to a span of output text.
5
+ */
6
+ export type Annotation = (FileCitationBody & {
7
+ type: 'file_citation';
8
+ }) | (UrlCitationBody & {
9
+ type: 'url_citation';
10
+ }) | (ContainerFileCitationBody & {
11
+ type: 'container_file_citation';
12
+ }) | (FilePath & {
13
+ type: 'file_path';
14
+ });
15
+
16
+ /**
17
+ * OpenAI API returns error object on failure
18
+ */
19
+ export type ApiError = {
20
+ message: string;
21
+ type?: string | null;
22
+ param?: string | null;
23
+ code?: string | null;
24
+ };
25
+
26
+ /**
27
+ * Outcome values reported for apply_patch tool call outputs.
28
+ */
29
+ export type ApplyPatchCallOutputStatus = 'completed' | 'failed';
30
+
31
+ /**
32
+ * Outcome values reported for apply_patch tool call outputs.
33
+ */
34
+ export type ApplyPatchCallOutputStatusParam = 'completed' | 'failed';
35
+
36
+ /**
37
+ * Status values reported for apply_patch tool calls.
38
+ */
39
+ export type ApplyPatchCallStatus = 'in_progress' | 'completed';
40
+
41
+ /**
42
+ * Status values reported for apply_patch tool calls.
43
+ */
44
+ export type ApplyPatchCallStatusParam = 'in_progress' | 'completed';
45
+
46
+ /**
47
+ * Instruction describing how to create a file via the apply_patch tool.
48
+ */
49
+ export type ApplyPatchCreateFileOperation = {
50
+ /**
51
+ * Path of the file to create.
52
+ */
53
+ path: string;
54
+ /**
55
+ * Diff to apply.
56
+ */
57
+ diff: string;
58
+ };
59
+
60
+ /**
61
+ * Instruction for creating a new file via the apply_patch tool.
62
+ */
63
+ export type ApplyPatchCreateFileOperationParam = {
64
+ /**
65
+ * Path of the file to create relative to the workspace root.
66
+ */
67
+ path: string;
68
+ /**
69
+ * Unified diff content to apply when creating the file.
70
+ */
71
+ diff: string;
72
+ };
73
+
74
+ /**
75
+ * Instruction describing how to delete a file via the apply_patch tool.
76
+ */
77
+ export type ApplyPatchDeleteFileOperation = {
78
+ /**
79
+ * Path of the file to delete.
80
+ */
81
+ path: string;
82
+ };
83
+
84
+ /**
85
+ * Instruction for deleting an existing file via the apply_patch tool.
86
+ */
87
+ export type ApplyPatchDeleteFileOperationParam = {
88
+ /**
89
+ * Path of the file to delete relative to the workspace root.
90
+ */
91
+ path: string;
92
+ };
93
+
94
+ /**
95
+ * One of the create_file, delete_file, or update_file operations applied via apply_patch.
96
+ */
97
+ export type ApplyPatchOperation = (ApplyPatchCreateFileOperation & {
98
+ type: 'create_file';
99
+ }) | (ApplyPatchDeleteFileOperation & {
100
+ type: 'delete_file';
101
+ }) | (ApplyPatchUpdateFileOperation & {
102
+ type: 'update_file';
103
+ });
104
+
105
+ /**
106
+ * One of the create_file, delete_file, or update_file operations supplied to the apply_patch tool.
107
+ */
108
+ export type ApplyPatchOperationParam = (ApplyPatchCreateFileOperationParam & {
109
+ type: 'create_file';
110
+ }) | (ApplyPatchDeleteFileOperationParam & {
111
+ type: 'delete_file';
112
+ }) | (ApplyPatchUpdateFileOperationParam & {
113
+ type: 'update_file';
114
+ });
115
+
116
+ /**
117
+ * A tool call that applies file diffs by creating, deleting, or updating files.
118
+ */
119
+ export type ApplyPatchToolCall = {
120
+ /**
121
+ * The unique ID of the apply patch tool call. Populated when this item is returned via API.
122
+ */
123
+ id: string;
124
+ /**
125
+ * The unique ID of the apply patch tool call generated by the model.
126
+ */
127
+ call_id: string;
128
+ /**
129
+ * The status of the apply patch tool call. One of `in_progress` or `completed`.
130
+ */
131
+ status: ApplyPatchCallStatus;
132
+ /**
133
+ * One of the create_file, delete_file, or update_file operations applied via apply_patch.
134
+ */
135
+ operation: ApplyPatchOperation;
136
+ /**
137
+ * The ID of the entity that created this tool call.
138
+ */
139
+ created_by?: string | null;
140
+ };
141
+
142
+ /**
143
+ * A tool call representing a request to create, delete, or update files using diff patches.
144
+ */
145
+ export type ApplyPatchToolCallItemParam = {
146
+ /**
147
+ * The unique ID of the apply patch tool call. Populated when this item is returned via API.
148
+ */
149
+ id?: string | null;
150
+ /**
151
+ * The unique ID of the apply patch tool call generated by the model.
152
+ */
153
+ call_id: string;
154
+ /**
155
+ * The status of the apply patch tool call. One of `in_progress` or `completed`.
156
+ */
157
+ status: ApplyPatchCallStatusParam;
158
+ /**
159
+ * The specific create, delete, or update instruction for the apply_patch tool call.
160
+ */
161
+ operation: ApplyPatchOperationParam;
162
+ };
163
+
164
+ /**
165
+ * The output emitted by an apply patch tool call.
166
+ */
167
+ export type ApplyPatchToolCallOutput = {
168
+ /**
169
+ * The unique ID of the apply patch tool call output. Populated when this item is returned via API.
170
+ */
171
+ id: string;
172
+ /**
173
+ * The unique ID of the apply patch tool call generated by the model.
174
+ */
175
+ call_id: string;
176
+ /**
177
+ * The status of the apply patch tool call output. One of `completed` or `failed`.
178
+ */
179
+ status: ApplyPatchCallOutputStatus;
180
+ /**
181
+ * Optional textual output returned by the apply patch tool.
182
+ */
183
+ output?: string | null;
184
+ /**
185
+ * The ID of the entity that created this tool call output.
186
+ */
187
+ created_by?: string | null;
188
+ };
189
+
190
+ /**
191
+ * The streamed output emitted by an apply patch tool call.
192
+ */
193
+ export type ApplyPatchToolCallOutputItemParam = {
194
+ /**
195
+ * The unique ID of the apply patch tool call output. Populated when this item is returned via API.
196
+ */
197
+ id?: string | null;
198
+ /**
199
+ * The unique ID of the apply patch tool call generated by the model.
200
+ */
201
+ call_id: string;
202
+ /**
203
+ * The status of the apply patch tool call output. One of `completed` or `failed`.
204
+ */
205
+ status: ApplyPatchCallOutputStatusParam;
206
+ /**
207
+ * Optional human-readable log text from the apply patch tool (e.g., patch results or errors).
208
+ */
209
+ output?: string | null;
210
+ };
211
+
212
+ /**
213
+ * Instruction describing how to update a file via the apply_patch tool.
214
+ */
215
+ export type ApplyPatchUpdateFileOperation = {
216
+ /**
217
+ * Path of the file to update.
218
+ */
219
+ path: string;
220
+ /**
221
+ * Diff to apply.
222
+ */
223
+ diff: string;
224
+ };
225
+
226
+ /**
227
+ * Instruction for updating an existing file via the apply_patch tool.
228
+ */
229
+ export type ApplyPatchUpdateFileOperationParam = {
230
+ /**
231
+ * Path of the file to update relative to the workspace root.
232
+ */
233
+ path: string;
234
+ /**
235
+ * Unified diff content to apply to the existing file.
236
+ */
237
+ diff: string;
238
+ };
239
+
240
+ /**
241
+ * The role for an output message - always `assistant`.
242
+ * This type ensures type safety by only allowing the assistant role.
243
+ */
244
+ export type AssistantRole = 'assistant';
245
+
246
+ export type Billing = {
247
+ payer: string;
248
+ };
249
+
250
+ export type ChatChoice = {
251
+ /**
252
+ * The index of the choice in the list of choices.
253
+ */
254
+ index: number;
255
+ message: ChatCompletionResponseMessage;
256
+ finish_reason?: null | FinishReason;
257
+ logprobs?: null | ChatChoiceLogprobs;
258
+ };
259
+
260
+ export type ChatChoiceLogprobs = {
261
+ /**
262
+ * A list of message content tokens with log probability information.
263
+ */
264
+ content?: Array<ChatCompletionTokenLogprob> | null;
265
+ refusal?: Array<ChatCompletionTokenLogprob> | null;
266
+ };
267
+
268
+ export type ChatChoiceStream = {
269
+ /**
270
+ * The index of the choice in the list of choices.
271
+ */
272
+ index: number;
273
+ delta: ChatCompletionStreamResponseDelta;
274
+ finish_reason?: null | FinishReason;
275
+ logprobs?: null | ChatChoiceLogprobs;
276
+ };
277
+
278
+ export type ChatCompletionAllowedTools = {
279
+ /**
280
+ * Constrains the tools available to the model to a pre-defined set.
281
+ *
282
+ * `auto` allows the model to pick from among the allowed tools and generate a
283
+ * message.
284
+ *
285
+ * `required` requires the model to call one or more of the allowed tools.
286
+ */
287
+ mode: ToolChoiceAllowedMode;
288
+ /**
289
+ * A list of tool definitions that the model should be allowed to call.
290
+ *
291
+ * For the Chat Completions API, the list of tool definitions might look like:
292
+ * ```json
293
+ * [
294
+ * { "type": "function", "function": { "name": "get_weather" } },
295
+ * { "type": "function", "function": { "name": "get_time" } }
296
+ * ]
297
+ * ```
298
+ */
299
+ tools: Array<{
300
+ [key: string]: unknown;
301
+ }>;
302
+ };
303
+
304
+ export type ChatCompletionAllowedToolsChoice = {
305
+ allowed_tools: Array<ChatCompletionAllowedTools>;
306
+ };
307
+
308
+ export type ChatCompletionAudio = {
309
+ /**
310
+ * The voice the model uses to respond. Supported built-in voices are `alloy`, `ash`,
311
+ * `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, `shimmer`, `marin`, and `cedar`.
312
+ */
313
+ voice: ChatCompletionAudioVoice;
314
+ /**
315
+ * Specifies the output audio format. Must be one of `wav`, `aac`, `mp3`, `flac`, `opus`, or `pcm16`.
316
+ */
317
+ format: ChatCompletionAudioFormat;
318
+ };
319
+
320
+ export type ChatCompletionAudioFormat = 'wav' | 'aac' | 'mp3' | 'flac' | 'opus' | 'pcm16';
321
+
322
+ export type ChatCompletionAudioVoice = 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'fable' | 'nova' | 'onyx' | 'sage' | 'shimmer' | {
323
+ other: string;
324
+ };
325
+
326
+ export type ChatCompletionFunctionCall = 'none' | 'auto' | {
327
+ /**
328
+ * Forces the model to call the specified function.
329
+ */
330
+ Function: {
331
+ name: string;
332
+ };
333
+ };
334
+
335
+ export type ChatCompletionFunctions = {
336
+ /**
337
+ * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
338
+ */
339
+ name: string;
340
+ /**
341
+ * A description of what the function does, used by the model to choose when and how to call the function.
342
+ */
343
+ description?: string | null;
344
+ /**
345
+ * The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
346
+ *
347
+ * Omitting `parameters` defines a function with an empty parameter list.
348
+ */
349
+ parameters: {
350
+ [key: string]: unknown;
351
+ };
352
+ };
353
+
354
+ export type ChatCompletionMessageCustomToolCall = {
355
+ /**
356
+ * The ID of the tool call.
357
+ */
358
+ id: string;
359
+ /**
360
+ * The custom tool that the model called.
361
+ */
362
+ custom_tool: CustomTool;
363
+ };
364
+
365
+ export type ChatCompletionMessageToolCall = {
366
+ /**
367
+ * The ID of the tool call.
368
+ */
369
+ id: string;
370
+ /**
371
+ * The function that the model called.
372
+ */
373
+ function: FunctionCall;
374
+ };
375
+
376
+ export type ChatCompletionMessageToolCallChunk = {
377
+ index: number;
378
+ /**
379
+ * The ID of the tool call.
380
+ */
381
+ id?: string | null;
382
+ type?: null | FunctionType;
383
+ function?: null | FunctionCallStream;
384
+ };
385
+
386
+ export type ChatCompletionMessageToolCalls = (ChatCompletionMessageToolCall & {
387
+ type: 'function';
388
+ }) | (ChatCompletionMessageCustomToolCall & {
389
+ type: 'custom';
390
+ });
391
+
392
+ /**
393
+ * Specifies a tool the model should use. Use to force the model to call a specific function.
394
+ */
395
+ export type ChatCompletionNamedToolChoice = {
396
+ function: FunctionName;
397
+ };
398
+
399
+ export type ChatCompletionNamedToolChoiceCustom = {
400
+ custom: CustomName;
401
+ };
402
+
403
+ export type ChatCompletionRequestAssistantMessage = {
404
+ content?: null | ChatCompletionRequestAssistantMessageContent;
405
+ /**
406
+ * The refusal message by the assistant.
407
+ */
408
+ refusal?: string | null;
409
+ /**
410
+ * An optional name for the participant. Provides the model information to differentiate between participants of the same role.
411
+ */
412
+ name?: string | null;
413
+ audio?: null | ChatCompletionRequestAssistantMessageAudio;
414
+ tool_calls?: Array<ChatCompletionMessageToolCalls> | null;
415
+ function_call?: null | FunctionCall;
416
+ };
417
+
418
+ export type ChatCompletionRequestAssistantMessageAudio = {
419
+ /**
420
+ * Unique identifier for a previous audio response from the model.
421
+ */
422
+ id: string;
423
+ };
424
+
425
+ export type ChatCompletionRequestAssistantMessageContent = string | Array<ChatCompletionRequestAssistantMessageContentPart>;
426
+
427
+ export type ChatCompletionRequestAssistantMessageContentPart = (ChatCompletionRequestMessageContentPartText & {
428
+ type: 'text';
429
+ }) | (ChatCompletionRequestMessageContentPartRefusal & {
430
+ type: 'refusal';
431
+ });
432
+
433
+ export type ChatCompletionRequestDeveloperMessage = {
434
+ /**
435
+ * The contents of the developer message.
436
+ */
437
+ content: ChatCompletionRequestDeveloperMessageContent;
438
+ /**
439
+ * An optional name for the participant. Provides the model information to differentiate between participants of the same role.
440
+ */
441
+ name?: string | null;
442
+ };
443
+
444
+ export type ChatCompletionRequestDeveloperMessageContent = string | Array<ChatCompletionRequestDeveloperMessageContentPart>;
445
+
446
+ export type ChatCompletionRequestDeveloperMessageContentPart = ChatCompletionRequestMessageContentPartText & {
447
+ type: 'text';
448
+ };
449
+
450
+ export type ChatCompletionRequestFunctionMessage = {
451
+ /**
452
+ * The return value from the function call, to return to the model.
453
+ */
454
+ content?: string | null;
455
+ /**
456
+ * The name of the function to call.
457
+ */
458
+ name: string;
459
+ };
460
+
461
+ export type ChatCompletionRequestMessage = (ChatCompletionRequestDeveloperMessage & {
462
+ role: 'developer';
463
+ }) | (ChatCompletionRequestSystemMessage & {
464
+ role: 'system';
465
+ }) | (ChatCompletionRequestUserMessage & {
466
+ role: 'user';
467
+ }) | (ChatCompletionRequestAssistantMessage & {
468
+ role: 'assistant';
469
+ }) | (ChatCompletionRequestToolMessage & {
470
+ role: 'tool';
471
+ }) | (ChatCompletionRequestFunctionMessage & {
472
+ role: 'function';
473
+ });
474
+
475
+ /**
476
+ * Learn about [audio inputs](https://platform.openai.com/docs/guides/audio).
477
+ */
478
+ export type ChatCompletionRequestMessageContentPartAudio = {
479
+ input_audio: InputAudio;
480
+ };
481
+
482
+ export type ChatCompletionRequestMessageContentPartFile = {
483
+ file: FileObject;
484
+ };
485
+
486
+ export type ChatCompletionRequestMessageContentPartImage = {
487
+ image_url: ImageUrl;
488
+ };
489
+
490
+ export type ChatCompletionRequestMessageContentPartRefusal = {
491
+ /**
492
+ * The refusal message generated by the model.
493
+ */
494
+ refusal: string;
495
+ };
496
+
497
+ export type ChatCompletionRequestMessageContentPartText = {
498
+ text: string;
499
+ };
500
+
501
+ export type ChatCompletionRequestSystemMessage = {
502
+ /**
503
+ * The contents of the system message.
504
+ */
505
+ content: ChatCompletionRequestSystemMessageContent;
506
+ /**
507
+ * An optional name for the participant. Provides the model information to differentiate between participants of the same role.
508
+ */
509
+ name?: string | null;
510
+ };
511
+
512
+ export type ChatCompletionRequestSystemMessageContent = string | Array<ChatCompletionRequestSystemMessageContentPart>;
513
+
514
+ export type ChatCompletionRequestSystemMessageContentPart = ChatCompletionRequestMessageContentPartText & {
515
+ type: 'text';
516
+ };
517
+
518
+ /**
519
+ * Tool message
520
+ */
521
+ export type ChatCompletionRequestToolMessage = {
522
+ /**
523
+ * The contents of the tool message.
524
+ */
525
+ content: ChatCompletionRequestToolMessageContent;
526
+ tool_call_id: string;
527
+ };
528
+
529
+ export type ChatCompletionRequestToolMessageContent = string | Array<ChatCompletionRequestToolMessageContentPart>;
530
+
531
+ export type ChatCompletionRequestToolMessageContentPart = ChatCompletionRequestMessageContentPartText & {
532
+ type: 'text';
533
+ };
534
+
535
+ export type ChatCompletionRequestUserMessage = {
536
+ /**
537
+ * The contents of the user message.
538
+ */
539
+ content: ChatCompletionRequestUserMessageContent;
540
+ /**
541
+ * An optional name for the participant. Provides the model information to differentiate between participants of the same role.
542
+ */
543
+ name?: string | null;
544
+ };
545
+
546
+ export type ChatCompletionRequestUserMessageContent = string | Array<ChatCompletionRequestUserMessageContentPart>;
547
+
548
+ export type ChatCompletionRequestUserMessageContentPart = (ChatCompletionRequestMessageContentPartText & {
549
+ type: 'text';
550
+ }) | (ChatCompletionRequestMessageContentPartImage & {
551
+ type: 'image_url';
552
+ }) | (ChatCompletionRequestMessageContentPartAudio & {
553
+ type: 'input_audio';
554
+ }) | (ChatCompletionRequestMessageContentPartFile & {
555
+ type: 'file';
556
+ });
557
+
558
+ /**
559
+ * A chat completion message generated by the model.
560
+ */
561
+ export type ChatCompletionResponseMessage = {
562
+ /**
563
+ * The contents of the message.
564
+ */
565
+ content?: string | null;
566
+ /**
567
+ * The refusal message generated by the model.
568
+ */
569
+ refusal?: string | null;
570
+ /**
571
+ * The tool calls generated by the model, such as function calls.
572
+ */
573
+ tool_calls?: Array<ChatCompletionMessageToolCalls> | null;
574
+ annotations?: Array<ChatCompletionResponseMessageAnnotation> | null;
575
+ /**
576
+ * The role of the author of this message.
577
+ */
578
+ role: Role;
579
+ function_call?: null | FunctionCall;
580
+ audio?: null | ChatCompletionResponseMessageAudio;
581
+ };
582
+
583
+ export type ChatCompletionResponseMessageAnnotation = {
584
+ url_citation: UrlCitation;
585
+ type: 'url_citation';
586
+ };
587
+
588
+ export type ChatCompletionResponseMessageAudio = {
589
+ /**
590
+ * Unique identifier for this audio response.
591
+ */
592
+ id: string;
593
+ /**
594
+ * The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations.
595
+ */
596
+ expires_at: number;
597
+ /**
598
+ * Base64 encoded audio bytes generated by the model, in the format specified in the request.
599
+ */
600
+ data: string;
601
+ /**
602
+ * Transcript of the audio generated by the model.
603
+ */
604
+ transcript: string;
605
+ };
606
+
607
+ /**
608
+ * Options for streaming response. Only set this when you set `stream: true`.
609
+ */
610
+ export type ChatCompletionStreamOptions = {
611
+ /**
612
+ * If set, an additional chunk will be streamed before the `data: [DONE]`
613
+ * message. The `usage` field on this chunk shows the token usage statistics
614
+ * for the entire request, and the `choices` field will always be an empty
615
+ * array.
616
+ *
617
+ * All other chunks will also include a `usage` field, but with a null
618
+ * value. **NOTE:** If the stream is interrupted, you may not receive the
619
+ * final usage chunk which contains the total token usage for the request.
620
+ */
621
+ include_usage?: boolean | null;
622
+ /**
623
+ * When true, stream obfuscation will be enabled. Stream obfuscation adds
624
+ * random characters to an `obfuscation` field on streaming delta events to
625
+ * normalize payload sizes as a mitigation to certain side-channel attacks.
626
+ * These obfuscation fields are included by default, but add a small amount
627
+ * of overhead to the data stream. You can set `include_obfuscation` to
628
+ * false to optimize for bandwidth if you trust the network links between
629
+ * your application and the OpenAI API.
630
+ */
631
+ include_obfuscation?: boolean | null;
632
+ };
633
+
634
+ /**
635
+ * A chat completion delta generated by streamed model responses.
636
+ */
637
+ export type ChatCompletionStreamResponseDelta = {
638
+ /**
639
+ * The contents of the chunk message.
640
+ */
641
+ content?: string | null;
642
+ function_call?: null | FunctionCallStream;
643
+ tool_calls?: Array<ChatCompletionMessageToolCallChunk> | null;
644
+ role?: null | Role;
645
+ /**
646
+ * The refusal message generated by the model.
647
+ */
648
+ refusal?: string | null;
649
+ };
650
+
651
+ export type ChatCompletionTokenLogprob = {
652
+ /**
653
+ * The token.
654
+ */
655
+ token: string;
656
+ /**
657
+ * The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
658
+ */
659
+ logprob: number;
660
+ /**
661
+ * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
662
+ */
663
+ bytes?: Array<number> | null;
664
+ /**
665
+ * List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.
666
+ */
667
+ top_logprobs: Array<TopLogprobs>;
668
+ };
669
+
670
+ export type ChatCompletionTool = {
671
+ function: FunctionObject;
672
+ };
673
+
674
+ /**
675
+ * Controls which (if any) tool is called by the model.
676
+ * `none` means the model will not call any tool and instead generates a message.
677
+ * `auto` means the model can pick between generating a message or calling one or more tools.
678
+ * `required` means the model must call one or more tools.
679
+ * Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool.
680
+ *
681
+ * `none` is the default when no tools are present. `auto` is the default if tools are present.
682
+ */
683
+ export type ChatCompletionToolChoiceOption = (ChatCompletionAllowedToolsChoice & {
684
+ type: 'allowed_tools';
685
+ }) | (ChatCompletionNamedToolChoice & {
686
+ type: 'function';
687
+ }) | (ChatCompletionNamedToolChoiceCustom & {
688
+ type: 'custom';
689
+ }) | (ToolChoiceOptions & {
690
+ type: 'mode';
691
+ });
692
+
693
+ export type ChatCompletionTools = (ChatCompletionTool & {
694
+ type: 'function';
695
+ }) | (CustomToolChatCompletions & {
696
+ type: 'custom';
697
+ });
698
+
699
+ export type ChatRequest = {
700
+ model: string;
701
+ messages: Array<Message>;
702
+ stream?: boolean | null;
703
+ format?: string | null;
704
+ keep_alive?: null | Duration;
705
+ options?: null | Options;
706
+ };
707
+
708
+ export type ClickButtonType = 'left' | 'right' | 'wheel' | 'back' | 'forward';
709
+
710
+ /**
711
+ * A click action.
712
+ */
713
+ export type ClickParam = {
714
+ /**
715
+ * Indicates which mouse button was pressed during the click. One of `left`,
716
+ * `right`, `wheel`, `back`, or `forward`.
717
+ */
718
+ button: ClickButtonType;
719
+ /**
720
+ * The x-coordinate where the click occurred.
721
+ */
722
+ x: number;
723
+ /**
724
+ * The y-coordinate where the click occurred.
725
+ */
726
+ y: number;
727
+ };
728
+
729
+ /**
730
+ * Auto configuration for code interpreter container.
731
+ */
732
+ export type CodeInterpreterContainerAuto = {
733
+ /**
734
+ * An optional list of uploaded files to make available to your code.
735
+ */
736
+ file_ids?: Array<string> | null;
737
+ memory_limit?: number | null;
738
+ };
739
+
740
+ export type CodeInterpreterOutputImage = {
741
+ /**
742
+ * The URL of the image output from the code interpreter.
743
+ */
744
+ url: string;
745
+ };
746
+
747
+ export type CodeInterpreterOutputLogs = {
748
+ /**
749
+ * The logs output from the code interpreter.
750
+ */
751
+ logs: string;
752
+ };
753
+
754
+ export type CodeInterpreterTool = {
755
+ /**
756
+ * The code interpreter container. Can be a container ID or an object that
757
+ * specifies uploaded file IDs to make available to your code, along with an
758
+ * optional `memory_limit` setting.
759
+ */
760
+ container: CodeInterpreterToolContainer;
761
+ };
762
+
763
+ /**
764
+ * Output of a code interpreter request.
765
+ */
766
+ export type CodeInterpreterToolCall = {
767
+ /**
768
+ * The code to run, or null if not available.
769
+ */
770
+ code?: string | null;
771
+ /**
772
+ * ID of the container used to run the code.
773
+ */
774
+ container_id: string;
775
+ /**
776
+ * The unique ID of the code interpreter tool call.
777
+ */
778
+ id: string;
779
+ /**
780
+ * The outputs generated by the code interpreter, such as logs or images.
781
+ * Can be null if no outputs are available.
782
+ */
783
+ outputs?: Array<CodeInterpreterToolCallOutput> | null;
784
+ /**
785
+ * The status of the code interpreter tool call.
786
+ * Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.
787
+ */
788
+ status: CodeInterpreterToolCallStatus;
789
+ };
790
+
791
+ /**
792
+ * Individual result from a code interpreter: either logs or files.
793
+ */
794
+ export type CodeInterpreterToolCallOutput = (CodeInterpreterOutputLogs & {
795
+ type: 'logs';
796
+ }) | (CodeInterpreterOutputImage & {
797
+ type: 'image';
798
+ });
799
+
800
+ export type CodeInterpreterToolCallStatus = 'in_progress' | 'completed' | 'incomplete' | 'interpreting' | 'failed';
801
+
802
+ /**
803
+ * Container configuration for a code interpreter.
804
+ */
805
+ export type CodeInterpreterToolContainer = (CodeInterpreterContainerAuto & {
806
+ type: 'auto';
807
+ }) | {
808
+ type: 'container_i_d';
809
+ };
810
+
811
+ /**
812
+ * A compaction item generated by the `/v1/responses/compact` API.
813
+ */
814
+ export type CompactionBody = {
815
+ /**
816
+ * The unique ID of the compaction item.
817
+ */
818
+ id: string;
819
+ /**
820
+ * The encrypted content that was produced by compaction.
821
+ */
822
+ encrypted_content: string;
823
+ /**
824
+ * The identifier of the actor that created the item.
825
+ */
826
+ created_by?: string | null;
827
+ };
828
+
829
+ /**
830
+ * A compaction item generated by the `/v1/responses/compact` API.
831
+ */
832
+ export type CompactionSummaryItemParam = {
833
+ /**
834
+ * The ID of the compaction item.
835
+ */
836
+ id?: string | null;
837
+ /**
838
+ * The encrypted content of the compaction summary.
839
+ */
840
+ encrypted_content: string;
841
+ };
842
+
843
+ /**
844
+ * Single comparison filter.
845
+ */
846
+ export type ComparisonFilter = {
847
+ /**
848
+ * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.
849
+ * - `eq`: equals
850
+ * - `ne`: not equal
851
+ * - `gt`: greater than
852
+ * - `gte`: greater than or equal
853
+ * - `lt`: less than
854
+ * - `lte`: less than or equal
855
+ * - `in`: in
856
+ * - `nin`: not in
857
+ */
858
+ type: ComparisonType;
859
+ /**
860
+ * The key to compare against the value.
861
+ */
862
+ key: string;
863
+ /**
864
+ * The value to compare against the attribute key; supports string, number, or boolean types.
865
+ */
866
+ value: {
867
+ [key: string]: unknown;
868
+ };
869
+ };
870
+
871
+ export type ComparisonType = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin';
872
+
873
+ /**
874
+ * Breakdown of tokens used in a completion.
875
+ */
876
+ export type CompletionTokensDetails = {
877
+ accepted_prediction_tokens?: number | null;
878
+ /**
879
+ * Audio input tokens generated by the model.
880
+ */
881
+ audio_tokens?: number | null;
882
+ /**
883
+ * Tokens generated by the model for reasoning.
884
+ */
885
+ reasoning_tokens?: number | null;
886
+ /**
887
+ * When using Predicted Outputs, the number of tokens in the
888
+ * prediction that did not appear in the completion. However, like
889
+ * reasoning tokens, these tokens are still counted in the total
890
+ * completion tokens for purposes of billing, output, and context
891
+ * window limits.
892
+ */
893
+ rejected_prediction_tokens?: number | null;
894
+ };
895
+
896
+ /**
897
+ * Usage statistics for the completion request.
898
+ */
899
+ export type CompletionUsage = {
900
+ /**
901
+ * Number of tokens in the prompt.
902
+ */
903
+ prompt_tokens: number;
904
+ /**
905
+ * Number of tokens in the generated completion.
906
+ */
907
+ completion_tokens: number;
908
+ /**
909
+ * Total number of tokens used in the request (prompt + completion).
910
+ */
911
+ total_tokens: number;
912
+ prompt_tokens_details?: null | PromptTokensDetails;
913
+ completion_tokens_details?: null | CompletionTokensDetails;
914
+ };
915
+
916
+ /**
917
+ * Combine multiple filters using `and` or `or`.
918
+ */
919
+ export type CompoundFilter = {
920
+ /**
921
+ * 'Type of operation: `and` or `or`.'
922
+ */
923
+ type: CompoundType;
924
+ /**
925
+ * Array of filters to combine. Items can be ComparisonFilter or CompoundFilter.
926
+ */
927
+ filters: Array<{
928
+ [key: string]: unknown;
929
+ }>;
930
+ };
931
+
932
+ export type CompoundType = 'and' | 'or';
933
+
934
+ /**
935
+ * Represents all user‐triggered actions.
936
+ */
937
+ export type ComputerAction = (ClickParam & {
938
+ type: 'click';
939
+ }) | (DoubleClickAction & {
940
+ type: 'double_click';
941
+ }) | (DragParam & {
942
+ type: 'drag';
943
+ }) | (KeyPressAction & {
944
+ type: 'keypress';
945
+ }) | (MoveParam & {
946
+ type: 'move';
947
+ }) | {
948
+ type: 'screenshot';
949
+ } | (ScrollParam & {
950
+ type: 'scroll';
951
+ }) | (TypeParam & {
952
+ type: 'type';
953
+ }) | {
954
+ type: 'wait';
955
+ };
956
+
957
+ export type ComputerCallOutputItemParam = {
958
+ /**
959
+ * The ID of the computer tool call that produced the output.
960
+ */
961
+ call_id: string;
962
+ /**
963
+ * A computer screenshot image used with the computer use tool.
964
+ */
965
+ output: ComputerScreenshotImage;
966
+ /**
967
+ * The safety checks reported by the API that have been acknowledged by the developer.
968
+ */
969
+ acknowledged_safety_checks?: Array<ComputerCallSafetyCheckParam> | null;
970
+ /**
971
+ * The unique ID of the computer tool call output. Optional when creating.
972
+ */
973
+ id?: string | null;
974
+ status?: null | OutputStatus;
975
+ };
976
+
977
+ export type ComputerCallSafetyCheckParam = {
978
+ /**
979
+ * The ID of the pending safety check.
980
+ */
981
+ id: string;
982
+ /**
983
+ * The type of the pending safety check.
984
+ */
985
+ code?: string | null;
986
+ /**
987
+ * Details about the pending safety check.
988
+ */
989
+ message?: string | null;
990
+ };
991
+
992
+ export type ComputerEnvironment = 'windows' | 'mac' | 'linux' | 'ubuntu' | 'browser';
993
+
994
+ /**
995
+ * A computer screenshot image used with the computer use tool.
996
+ */
997
+ export type ComputerScreenshotImage = {
998
+ /**
999
+ * Specifies the event type. For a computer screenshot, this property is always
1000
+ * set to `computer_screenshot`.
1001
+ */
1002
+ type: ComputerScreenshotImageType;
1003
+ /**
1004
+ * The identifier of an uploaded file that contains the screenshot.
1005
+ */
1006
+ file_id?: string | null;
1007
+ /**
1008
+ * The URL of the screenshot image.
1009
+ */
1010
+ image_url?: string | null;
1011
+ };
1012
+
1013
+ export type ComputerScreenshotImageType = 'computer_screenshot';
1014
+
1015
+ /**
1016
+ * A tool that controls a virtual computer. Learn more about the
1017
+ * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
1018
+ */
1019
+ export type ComputerTool = {
1020
+ [key: string]: unknown;
1021
+ };
1022
+
1023
+ /**
1024
+ * Output from a computer tool call.
1025
+ */
1026
+ export type ComputerToolCall = {
1027
+ action?: null | ComputerAction;
1028
+ /**
1029
+ * Flattened batched actions for `computer_use`. Each action includes a
1030
+ * `type` discriminator and action-specific fields.
1031
+ */
1032
+ actions?: Array<ComputerAction> | null;
1033
+ /**
1034
+ * An identifier used when responding to the tool call with output.
1035
+ */
1036
+ call_id: string;
1037
+ /**
1038
+ * The unique ID of the computer call.
1039
+ */
1040
+ id: string;
1041
+ /**
1042
+ * The pending safety checks for the computer call.
1043
+ */
1044
+ pending_safety_checks: Array<ComputerCallSafetyCheckParam>;
1045
+ /**
1046
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1047
+ * Populated when items are returned via API.
1048
+ */
1049
+ status: OutputStatus;
1050
+ };
1051
+
1052
+ export type ComputerUsePreviewTool = {
1053
+ /**
1054
+ * The type of computer environment to control.
1055
+ */
1056
+ environment: ComputerEnvironment;
1057
+ /**
1058
+ * The width of the computer display.
1059
+ */
1060
+ display_width: number;
1061
+ /**
1062
+ * The height of the computer display.
1063
+ */
1064
+ display_height: number;
1065
+ };
1066
+
1067
+ /**
1068
+ * Automatically creates a container for the request.
1069
+ */
1070
+ export type ContainerAutoParam = {
1071
+ /**
1072
+ * An optional list of uploaded file IDs to make available in the container.
1073
+ */
1074
+ file_ids?: Array<string> | null;
1075
+ network_policy?: null | ContainerNetworkPolicy;
1076
+ /**
1077
+ * An optional list of skills to make available in the container.
1078
+ */
1079
+ skills?: Array<SkillParam> | null;
1080
+ };
1081
+
1082
+ export type ContainerFileCitationBody = {
1083
+ /**
1084
+ * The ID of the container file.
1085
+ */
1086
+ container_id: string;
1087
+ /**
1088
+ * The index of the last character of the container file citation in the message.
1089
+ */
1090
+ end_index: number;
1091
+ /**
1092
+ * The ID of the file.
1093
+ */
1094
+ file_id: string;
1095
+ /**
1096
+ * The filename of the container file cited.
1097
+ */
1098
+ filename: string;
1099
+ /**
1100
+ * The index of the first character of the container file citation in the message.
1101
+ */
1102
+ start_index: number;
1103
+ };
1104
+
1105
+ /**
1106
+ * Network access policy for a container.
1107
+ */
1108
+ export type ContainerNetworkPolicy = {
1109
+ type: 'disabled';
1110
+ } | (ContainerNetworkPolicyAllowlistDetails & {
1111
+ type: 'allowlist';
1112
+ });
1113
+
1114
+ /**
1115
+ * Details for an allowlist network policy.
1116
+ */
1117
+ export type ContainerNetworkPolicyAllowlistDetails = {
1118
+ /**
1119
+ * A list of allowed domains.
1120
+ */
1121
+ allowed_domains: Array<string>;
1122
+ /**
1123
+ * Optional domain-scoped secrets for allowlisted domains.
1124
+ */
1125
+ domain_secrets?: Array<ContainerNetworkPolicyDomainSecretParam> | null;
1126
+ };
1127
+
1128
+ /**
1129
+ * A domain-scoped secret injected for allowlisted domains.
1130
+ */
1131
+ export type ContainerNetworkPolicyDomainSecretParam = {
1132
+ /**
1133
+ * The domain associated with the secret.
1134
+ */
1135
+ domain: string;
1136
+ /**
1137
+ * The name of the secret to inject for the domain.
1138
+ */
1139
+ name: string;
1140
+ /**
1141
+ * The secret value to inject for the domain.
1142
+ */
1143
+ value: string;
1144
+ };
1145
+
1146
+ /**
1147
+ * References a container created with the /v1/containers endpoint.
1148
+ */
1149
+ export type ContainerReferenceParam = {
1150
+ /**
1151
+ * The ID of the referenced container.
1152
+ */
1153
+ container_id: string;
1154
+ };
1155
+
1156
+ /**
1157
+ * A resource reference to a container by ID.
1158
+ */
1159
+ export type ContainerReferenceResource = {
1160
+ /**
1161
+ * The ID of the referenced container.
1162
+ */
1163
+ container_id: string;
1164
+ };
1165
+
1166
+ /**
1167
+ * The conversation that this response belonged to. Input items and output items from this
1168
+ * response were automatically added to this conversation.
1169
+ */
1170
+ export type Conversation = {
1171
+ /**
1172
+ * The unique ID of the conversation that this response was associated with.
1173
+ */
1174
+ id: string;
1175
+ };
1176
+
1177
+ export type ConversationParam = string | Conversation;
1178
+
1179
+ /**
1180
+ * An x/y coordinate pair.
1181
+ */
1182
+ export type CoordParam = {
1183
+ /**
1184
+ * The x-coordinate.
1185
+ */
1186
+ x: number;
1187
+ /**
1188
+ * The y-coordinate.
1189
+ */
1190
+ y: number;
1191
+ };
1192
+
1193
+ export type CreateChatCompletionRequest = {
1194
+ /**
1195
+ * A list of messages comprising the conversation so far. Depending on the
1196
+ * [model](https://platform.openai.com/docs/models) you use, different message types (modalities)
1197
+ * are supported, like [text](https://platform.openai.com/docs/guides/text-generation),
1198
+ * [images](https://platform.openai.com/docs/guides/vision), and
1199
+ * [audio](https://platform.openai.com/docs/guides/audio).
1200
+ */
1201
+ messages: Array<ChatCompletionRequestMessage>;
1202
+ /**
1203
+ * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
1204
+ * offers a wide range of models with different capabilities, performance
1205
+ * characteristics, and price points. Refer to the
1206
+ * [model guide](https://platform.openai.com/docs/models)
1207
+ * to browse and compare available models.
1208
+ */
1209
+ model: string;
1210
+ /**
1211
+ * Output types that you would like the model to generate. Most models are capable of generating
1212
+ * text, which is the default:
1213
+ *
1214
+ * `["text"]`
1215
+ * The `gpt-4o-audio-preview` model can also be used to
1216
+ * [generate audio](https://platform.openai.com/docs/guides/audio). To request that this model
1217
+ * generate both text and audio responses, you can use:
1218
+ *
1219
+ * `["text", "audio"]`
1220
+ */
1221
+ modalities?: Array<ResponseModalities> | null;
1222
+ verbosity?: null | Verbosity;
1223
+ reasoning_effort?: null | ReasoningEffort;
1224
+ /**
1225
+ * An upper bound for the number of tokens that can be generated for a completion, including
1226
+ * visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
1227
+ */
1228
+ max_completion_tokens?: number | null;
1229
+ /**
1230
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on
1231
+ * their existing frequency in the text so far, decreasing the model's
1232
+ * likelihood to repeat the same line verbatim.
1233
+ */
1234
+ frequency_penalty?: number | null;
1235
+ /**
1236
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on
1237
+ * whether they appear in the text so far, increasing the model's likelihood
1238
+ * to talk about new topics.
1239
+ */
1240
+ presence_penalty?: number | null;
1241
+ web_search_options?: null | WebSearchOptions;
1242
+ /**
1243
+ * An integer between 0 and 20 specifying the number of most likely tokens to
1244
+ * return at each token position, each with an associated log probability.
1245
+ * `logprobs` must be set to `true` if this parameter is used.
1246
+ */
1247
+ top_logprobs?: number | null;
1248
+ response_format?: null | ResponseFormat;
1249
+ audio?: null | ChatCompletionAudio;
1250
+ /**
1251
+ * Whether or not to store the output of this chat completion request for
1252
+ * use in our [model distillation](https://platform.openai.com/docs/guides/distillation) or
1253
+ * [evals](https://platform.openai.com/docs/guides/evals) products.
1254
+ *
1255
+ * Supports text and image inputs. Note: image inputs over 8MB will be dropped.
1256
+ */
1257
+ store?: boolean | null;
1258
+ /**
1259
+ * If set to true, the model response data will be streamed to the client
1260
+ * as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1261
+ * See the [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming)
1262
+ * for more information, along with the [streaming responses](https://platform.openai.com/docs/guides/streaming-responses)
1263
+ * guide for more information on how to handle the streaming events.
1264
+ */
1265
+ stream?: boolean | null;
1266
+ stop?: null | StopConfiguration;
1267
+ /**
1268
+ * Modify the likelihood of specified tokens appearing in the completion.
1269
+ *
1270
+ * Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100.
1271
+ * Mathematically, the bias is added to the logits generated by the model prior to sampling.
1272
+ * The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection;
1273
+ * values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
1274
+ */
1275
+ logit_bias?: {
1276
+ [key: string]: number;
1277
+ } | null;
1278
+ /**
1279
+ * Whether to return log probabilities of the output tokens or not. If true,
1280
+ * returns the log probabilities of each output token returned in the `content` of `message`.
1281
+ */
1282
+ logprobs?: boolean | null;
1283
+ /**
1284
+ * The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in
1285
+ * the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API.
1286
+ * This value is now deprecated in favor of `max_completion_tokens`, and is
1287
+ * not compatible with [o-series models](https://platform.openai.com/docs/guides/reasoning).
1288
+ * @deprecated
1289
+ */
1290
+ max_tokens?: number | null;
1291
+ /**
1292
+ * How many chat completion choices to generate for each input message. Note that you will be
1293
+ * charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to
1294
+ * minimize costs.
1295
+ */
1296
+ n?: number | null;
1297
+ prediction?: null | PredictionContent;
1298
+ /**
1299
+ * This feature is in Beta.
1300
+ *
1301
+ * If specified, our system will make a best effort to sample deterministically, such that
1302
+ * repeated requests with the same `seed` and parameters should return the same result.
1303
+ *
1304
+ * Determinism is not guaranteed, and you should refer to the `system_fingerprint` response
1305
+ * parameter to monitor changes in the backend.
1306
+ * @deprecated
1307
+ */
1308
+ seed?: number | null;
1309
+ stream_options?: null | ChatCompletionStreamOptions;
1310
+ service_tier?: null | ServiceTier;
1311
+ /**
1312
+ * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random,
1313
+ * while lower values like 0.2 will make it more focused and deterministic.
1314
+ *
1315
+ * We generally recommend altering this or `top_p` but not both.
1316
+ */
1317
+ temperature?: number | null;
1318
+ /**
1319
+ * An alternative to sampling with temperature, called nucleus sampling,
1320
+ * where the model considers the results of the tokens with top_p probability mass.
1321
+ * So 0.1 means only the tokens comprising the top 10% probability mass are considered.
1322
+ *
1323
+ * We generally recommend altering this or `temperature` but not both.
1324
+ */
1325
+ top_p?: number | null;
1326
+ /**
1327
+ * A list of tools the model may call. You can provide either
1328
+ * [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) or
1329
+ * [function tools](https://platform.openai.com/docs/guides/function-calling).
1330
+ */
1331
+ tools?: Array<ChatCompletionTools> | null;
1332
+ tool_choice?: null | ChatCompletionToolChoiceOption;
1333
+ /**
1334
+ * Whether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
1335
+ * during tool use.
1336
+ */
1337
+ parallel_tool_calls?: boolean | null;
1338
+ /**
1339
+ * This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key`
1340
+ * instead to maintain caching optimizations.
1341
+ * A stable identifier for your end-users.
1342
+ * Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and
1343
+ * prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
1344
+ * @deprecated
1345
+ */
1346
+ user?: string | null;
1347
+ /**
1348
+ * A stable identifier used to help detect users of your application that may be violating OpenAI's
1349
+ * usage policies.
1350
+ *
1351
+ * The IDs should be a string that uniquely identifies each user. We recommend hashing their username
1352
+ * or email address, in order to avoid sending us any identifying information. [Learn
1353
+ * more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
1354
+ */
1355
+ safety_identifier?: string | null;
1356
+ /**
1357
+ * Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces
1358
+ * the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
1359
+ */
1360
+ prompt_cache_key?: string | null;
1361
+ function_call?: null | ChatCompletionFunctionCall;
1362
+ /**
1363
+ * Deprecated in favor of `tools`.
1364
+ *
1365
+ * A list of functions the model may generate JSON inputs for.
1366
+ * @deprecated
1367
+ */
1368
+ functions?: Array<ChatCompletionFunctions> | null;
1369
+ metadata?: null | Metadata;
1370
+ };
1371
+
1372
+ /**
1373
+ * Represents a chat completion response returned by model, based on the provided input.
1374
+ */
1375
+ export type CreateChatCompletionResponse = {
1376
+ /**
1377
+ * A unique identifier for the chat completion.
1378
+ */
1379
+ id: string;
1380
+ /**
1381
+ * A list of chat completion choices. Can be more than one if `n` is greater than 1.
1382
+ */
1383
+ choices: Array<ChatChoice>;
1384
+ /**
1385
+ * The Unix timestamp (in seconds) of when the chat completion was created.
1386
+ */
1387
+ created: number;
1388
+ /**
1389
+ * The model used for the chat completion.
1390
+ */
1391
+ model: string;
1392
+ service_tier?: null | ServiceTier;
1393
+ /**
1394
+ * This fingerprint represents the backend configuration that the model runs with.
1395
+ *
1396
+ * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
1397
+ * @deprecated
1398
+ */
1399
+ system_fingerprint?: string | null;
1400
+ /**
1401
+ * The object type, which is always `chat.completion`.
1402
+ */
1403
+ object: string;
1404
+ usage?: null | CompletionUsage;
1405
+ };
1406
+
1407
+ /**
1408
+ * Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. [Learn more](https://platform.openai.com/docs/guides/streaming-responses).
1409
+ */
1410
+ export type CreateChatCompletionStreamResponse = {
1411
+ /**
1412
+ * A unique identifier for the chat completion. Each chunk has the same ID.
1413
+ */
1414
+ id: string;
1415
+ /**
1416
+ * A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the last chunk if you set `stream_options: {"include_usage": true}`.
1417
+ */
1418
+ choices: Array<ChatChoiceStream>;
1419
+ /**
1420
+ * The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
1421
+ */
1422
+ created: number;
1423
+ /**
1424
+ * The model to generate the completion.
1425
+ */
1426
+ model: string;
1427
+ service_tier?: null | ServiceTier;
1428
+ /**
1429
+ * This fingerprint represents the backend configuration that the model runs with.
1430
+ * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
1431
+ * @deprecated
1432
+ */
1433
+ system_fingerprint?: string | null;
1434
+ /**
1435
+ * The object type, which is always `chat.completion.chunk`.
1436
+ */
1437
+ object: string;
1438
+ usage?: null | CompletionUsage;
1439
+ };
1440
+
1441
+ export type CreateEmbeddingRequest = {
1442
+ /**
1443
+ * ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list)
1444
+ * API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models)
1445
+ * for descriptions of them.
1446
+ */
1447
+ model: string;
1448
+ /**
1449
+ * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single
1450
+ * request, pass an array of strings or array of token arrays. The input must not exceed the max
1451
+ * input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and
1452
+ * any array must be 2048 dimensions or less. [Example Python
1453
+ * code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.
1454
+ * In addition to the per-input token limit, all embedding models enforce a maximum of 300,000
1455
+ * tokens summed across all inputs in a single request.
1456
+ */
1457
+ input: EmbeddingInput;
1458
+ encoding_format?: null | EncodingFormat;
1459
+ /**
1460
+ * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
1461
+ * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
1462
+ */
1463
+ user?: string | null;
1464
+ /**
1465
+ * The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
1466
+ */
1467
+ dimensions?: number | null;
1468
+ };
1469
+
1470
+ export type CreateEmbeddingResponse = {
1471
+ object: string;
1472
+ /**
1473
+ * The name of the model used to generate the embedding.
1474
+ */
1475
+ model: string;
1476
+ /**
1477
+ * The list of embeddings generated by the model.
1478
+ */
1479
+ data: Array<Embedding>;
1480
+ /**
1481
+ * The usage information for the request.
1482
+ */
1483
+ usage: EmbeddingUsage;
1484
+ };
1485
+
1486
+ /**
1487
+ * Builder for a Responses API request.
1488
+ */
1489
+ export type CreateResponse = {
1490
+ /**
1491
+ * Whether to run the model response in the background.
1492
+ * [Learn more](https://platform.openai.com/docs/guides/background).
1493
+ */
1494
+ background?: boolean | null;
1495
+ conversation?: null | ConversationParam;
1496
+ /**
1497
+ * Specify additional output data to include in the model response. Currently supported
1498
+ * values are:
1499
+ *
1500
+ * - `web_search_call.action.sources`: Include the sources of the web search tool call.
1501
+ *
1502
+ * - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code
1503
+ * interpreter tool call items.
1504
+ *
1505
+ * - `computer_call_output.output.image_url`: Include image urls from the computer call
1506
+ * output.
1507
+ *
1508
+ * - `file_search_call.results`: Include the search results of the file search tool call.
1509
+ *
1510
+ * - `message.input_image.image_url`: Include image urls from the input message.
1511
+ *
1512
+ * - `message.output_text.logprobs`: Include logprobs with assistant messages.
1513
+ *
1514
+ * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in
1515
+ * reasoning item outputs. This enables reasoning items to be used in multi-turn
1516
+ * conversations when using the Responses API statelessly (like when the `store` parameter is
1517
+ * set to `false`, or when an organization is enrolled in the zero data retention program).
1518
+ */
1519
+ include?: Array<IncludeEnum> | null;
1520
+ /**
1521
+ * Text, image, or file inputs to the model, used to generate a response.
1522
+ *
1523
+ * Learn more:
1524
+ * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
1525
+ * - [Image inputs](https://platform.openai.com/docs/guides/images)
1526
+ * - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
1527
+ * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
1528
+ * - [Function calling](https://platform.openai.com/docs/guides/function-calling)
1529
+ */
1530
+ input: InputParam;
1531
+ /**
1532
+ * A system (or developer) message inserted into the model's context.
1533
+ *
1534
+ * When using along with `previous_response_id`, the instructions from a previous
1535
+ * response will not be carried over to the next response. This makes it simple
1536
+ * to swap out system (or developer) messages in new responses.
1537
+ */
1538
+ instructions?: string | null;
1539
+ /**
1540
+ * An upper bound for the number of tokens that can be generated for a response, including
1541
+ * visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
1542
+ */
1543
+ max_output_tokens?: number | null;
1544
+ /**
1545
+ * The maximum number of total calls to built-in tools that can be processed in a response. This
1546
+ * maximum number applies across all built-in tool calls, not per individual tool. Any further
1547
+ * attempts to call a tool by the model will be ignored.
1548
+ */
1549
+ max_tool_calls?: number | null;
1550
+ /**
1551
+ * Set of 16 key-value pairs that can be attached to an object. This can be
1552
+ * useful for storing additional information about the object in a structured
1553
+ * format, and querying for objects via API or the dashboard.
1554
+ *
1555
+ * Keys are strings with a maximum length of 64 characters. Values are
1556
+ * strings with a maximum length of 512 characters.
1557
+ */
1558
+ metadata?: {
1559
+ [key: string]: string;
1560
+ } | null;
1561
+ /**
1562
+ * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
1563
+ * offers a wide range of models with different capabilities, performance
1564
+ * characteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)
1565
+ * to browse and compare available models.
1566
+ */
1567
+ model?: string | null;
1568
+ /**
1569
+ * Whether to allow the model to run tool calls in parallel.
1570
+ */
1571
+ parallel_tool_calls?: boolean | null;
1572
+ /**
1573
+ * The unique ID of the previous response to the model. Use this to create multi-turn conversations.
1574
+ * Learn more about [conversation state](https://platform.openai.com/docs/guides/conversation-state).
1575
+ * Cannot be used in conjunction with `conversation`.
1576
+ */
1577
+ previous_response_id?: string | null;
1578
+ prompt?: null | Prompt;
1579
+ /**
1580
+ * Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces
1581
+ * the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
1582
+ */
1583
+ prompt_cache_key?: string | null;
1584
+ prompt_cache_retention?: null | PromptCacheRetention;
1585
+ reasoning?: null | Reasoning;
1586
+ /**
1587
+ * A stable identifier used to help detect users of your application that may be violating OpenAI's
1588
+ * usage policies.
1589
+ *
1590
+ * The IDs should be a string that uniquely identifies each user. We recommend hashing their username
1591
+ * or email address, in order to avoid sending us any identifying information. [Learn
1592
+ * more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
1593
+ */
1594
+ safety_identifier?: string | null;
1595
+ service_tier?: null | ServiceTier;
1596
+ /**
1597
+ * Whether to store the generated model response for later retrieval via API.
1598
+ */
1599
+ store?: boolean | null;
1600
+ /**
1601
+ * If set to true, the model response data will be streamed to the client
1602
+ * as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
1603
+ * See the [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)
1604
+ * for more information.
1605
+ */
1606
+ stream?: boolean | null;
1607
+ stream_options?: null | ResponseStreamOptions;
1608
+ /**
1609
+ * What sampling temperature to use, between 0 and 2. Higher values like 0.8
1610
+ * will make the output more random, while lower values like 0.2 will make it
1611
+ * more focused and deterministic. We generally recommend altering this or
1612
+ * `top_p` but not both.
1613
+ */
1614
+ temperature?: number | null;
1615
+ text?: null | ResponseTextParam;
1616
+ tool_choice?: null | ToolChoiceParam;
1617
+ /**
1618
+ * An array of tools the model may call while generating a response. You
1619
+ * can specify which tool to use by setting the `tool_choice` parameter.
1620
+ *
1621
+ * We support the following categories of tools:
1622
+ * - **Built-in tools**: Tools that are provided by OpenAI that extend the
1623
+ * model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)
1624
+ * or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about
1625
+ * [built-in tools](https://platform.openai.com/docs/guides/tools).
1626
+ * - **MCP Tools**: Integrations with third-party systems via custom MCP servers
1627
+ * or predefined connectors such as Google Drive and SharePoint. Learn more about
1628
+ * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
1629
+ * - **Function calls (custom tools)**: Functions that are defined by you,
1630
+ * enabling the model to call your own code with strongly typed arguments
1631
+ * and outputs. Learn more about
1632
+ * [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use
1633
+ * custom tools to call your own code.
1634
+ */
1635
+ tools?: Array<Tool> | null;
1636
+ /**
1637
+ * An integer between 0 and 20 specifying the number of most likely tokens to return at each
1638
+ * token position, each with an associated log probability.
1639
+ */
1640
+ top_logprobs?: number | null;
1641
+ /**
1642
+ * An alternative to sampling with temperature, called nucleus sampling,
1643
+ * where the model considers the results of the tokens with top_p probability
1644
+ * mass. So 0.1 means only the tokens comprising the top 10% probability mass
1645
+ * are considered.
1646
+ *
1647
+ * We generally recommend altering this or `temperature` but not both.
1648
+ */
1649
+ top_p?: number | null;
1650
+ truncation?: null | Truncation;
1651
+ };
1652
+
1653
+ export type CustomGrammarFormatParam = {
1654
+ /**
1655
+ * The grammar definition.
1656
+ */
1657
+ definition: string;
1658
+ /**
1659
+ * The syntax of the grammar definition. One of `lark` or `regex`.
1660
+ */
1661
+ syntax: GrammarSyntax;
1662
+ };
1663
+
1664
+ export type CustomName = {
1665
+ /**
1666
+ * The name of the custom tool to call.
1667
+ */
1668
+ name: string;
1669
+ };
1670
+
1671
+ export type CustomTool = {
1672
+ /**
1673
+ * The name of the custom tool to call.
1674
+ */
1675
+ name: string;
1676
+ /**
1677
+ * The input for the custom tool call generated by the model.
1678
+ */
1679
+ input: string;
1680
+ };
1681
+
1682
+ export type CustomToolCall = {
1683
+ /**
1684
+ * An identifier used to map this custom tool call to a tool call output.
1685
+ */
1686
+ call_id: string;
1687
+ /**
1688
+ * The namespace of the custom tool being called.
1689
+ */
1690
+ namespace?: string | null;
1691
+ /**
1692
+ * The input for the custom tool call generated by the model.
1693
+ */
1694
+ input: string;
1695
+ /**
1696
+ * The name of the custom tool being called.
1697
+ */
1698
+ name: string;
1699
+ /**
1700
+ * The unique ID of the custom tool call in the OpenAI platform.
1701
+ */
1702
+ id: string;
1703
+ };
1704
+
1705
+ export type CustomToolCallOutput = {
1706
+ /**
1707
+ * The call ID, used to map this custom tool call output to a custom tool call.
1708
+ */
1709
+ call_id: string;
1710
+ /**
1711
+ * The output from the custom tool call generated by your code.
1712
+ * Can be a string or an list of output content.
1713
+ */
1714
+ output: CustomToolCallOutputOutput;
1715
+ /**
1716
+ * The unique ID of the custom tool call output in the OpenAI platform.
1717
+ */
1718
+ id?: string | null;
1719
+ };
1720
+
1721
+ export type CustomToolCallOutputOutput = string | Array<InputContent>;
1722
+
1723
+ export type CustomToolChatCompletions = {
1724
+ custom: CustomToolProperties;
1725
+ };
1726
+
1727
+ export type CustomToolParam = {
1728
+ /**
1729
+ * The name of the custom tool, used to identify it in tool calls.
1730
+ */
1731
+ name: string;
1732
+ /**
1733
+ * Optional description of the custom tool, used to provide more context.
1734
+ */
1735
+ description?: string | null;
1736
+ /**
1737
+ * The input format for the custom tool. Default is unconstrained text.
1738
+ */
1739
+ format: CustomToolParamFormat;
1740
+ /**
1741
+ * Whether this tool should be deferred and discovered via tool search.
1742
+ */
1743
+ defer_loading?: boolean | null;
1744
+ };
1745
+
1746
+ export type CustomToolParamFormat = {
1747
+ type: 'text';
1748
+ } | (CustomGrammarFormatParam & {
1749
+ type: 'grammar';
1750
+ });
1751
+
1752
+ export type CustomToolProperties = {
1753
+ /**
1754
+ * The name of the custom tool, used to identify it in tool calls.
1755
+ */
1756
+ name: string;
1757
+ /**
1758
+ * Optional description of the custom tool, used to provide more context.
1759
+ */
1760
+ description?: string | null;
1761
+ /**
1762
+ * The input format for the custom tool. Default is unconstrained text.
1763
+ */
1764
+ format: CustomToolPropertiesFormat;
1765
+ };
1766
+
1767
+ export type CustomToolPropertiesFormat = {
1768
+ type: 'text';
1769
+ } | {
1770
+ grammar: CustomGrammarFormatParam;
1771
+ type: 'grammar';
1772
+ };
1773
+
1774
+ export type DeleteResponse = {
1775
+ object: string;
1776
+ deleted: boolean;
1777
+ id: string;
1778
+ };
1779
+
1780
+ /**
1781
+ * A double click action.
1782
+ */
1783
+ export type DoubleClickAction = {
1784
+ /**
1785
+ * The x-coordinate where the double click occurred.
1786
+ */
1787
+ x: number;
1788
+ /**
1789
+ * The y-coordinate where the double click occurred.
1790
+ */
1791
+ y: number;
1792
+ };
1793
+
1794
+ /**
1795
+ * A drag action.
1796
+ */
1797
+ export type DragParam = {
1798
+ /**
1799
+ * An array of coordinates representing the path of the drag action.
1800
+ */
1801
+ path: Array<CoordParam>;
1802
+ };
1803
+
1804
+ export type Duration = string;
1805
+
1806
+ /**
1807
+ * Content for EasyInputMessage - can be a simple string or structured list.
1808
+ */
1809
+ export type EasyInputContent = string | Array<InputContent>;
1810
+
1811
+ /**
1812
+ * A simplified message input to the model (EasyInputMessage in the OpenAPI spec).
1813
+ *
1814
+ * This is the most user-friendly way to provide messages, supporting both simple
1815
+ * string content and structured content. Role can include `assistant` for providing
1816
+ * previous assistant responses.
1817
+ */
1818
+ export type EasyInputMessage = {
1819
+ /**
1820
+ * The type of the message input. Defaults to `message` when omitted in JSON input.
1821
+ */
1822
+ type?: MessageType;
1823
+ /**
1824
+ * The role of the message input. One of `user`, `assistant`, `system`, or `developer`.
1825
+ */
1826
+ role: Role;
1827
+ /**
1828
+ * Text, image, or audio input to the model, used to generate a response.
1829
+ * Can also contain previous assistant responses.
1830
+ */
1831
+ content: EasyInputContent;
1832
+ phase?: null | MessagePhase;
1833
+ };
1834
+
1835
+ /**
1836
+ * Represents an embedding vector returned by embedding endpoint.
1837
+ */
1838
+ export type Embedding = {
1839
+ /**
1840
+ * The index of the embedding in the list of embeddings.
1841
+ */
1842
+ index: number;
1843
+ /**
1844
+ * The object type, which is always "embedding".
1845
+ */
1846
+ object: string;
1847
+ /**
1848
+ * The embedding vector, which is a list of floats. The length of vector
1849
+ * depends on the model as listed in the [embedding guide](https://platform.openai.com/docs/guides/embeddings).
1850
+ */
1851
+ embedding: Array<number>;
1852
+ };
1853
+
1854
+ export type EmbeddingInput = string | Array<string> | Array<number> | Array<Array<number>>;
1855
+
1856
+ export type EmbeddingUsage = {
1857
+ /**
1858
+ * The number of tokens used by the prompt.
1859
+ */
1860
+ prompt_tokens: number;
1861
+ /**
1862
+ * The total number of tokens used by the request.
1863
+ */
1864
+ total_tokens: number;
1865
+ };
1866
+
1867
+ export type EncodingFormat = 'float' | 'base64';
1868
+
1869
+ /**
1870
+ * An error that occurred while generating the response.
1871
+ */
1872
+ export type ErrorObject = {
1873
+ /**
1874
+ * A machine-readable error code that was returned.
1875
+ */
1876
+ code: string;
1877
+ /**
1878
+ * A human-readable description of the error that was returned.
1879
+ */
1880
+ message: string;
1881
+ };
1882
+
1883
+ export type FileCitationBody = {
1884
+ /**
1885
+ * The ID of the file.
1886
+ */
1887
+ file_id: string;
1888
+ /**
1889
+ * The filename of the file cited.
1890
+ */
1891
+ filename: string;
1892
+ /**
1893
+ * The index of the file in the list of files.
1894
+ */
1895
+ index: number;
1896
+ };
1897
+
1898
+ export type FileObject = {
1899
+ /**
1900
+ * The base64 encoded file data, used when passing the file to the model
1901
+ * as a string.
1902
+ */
1903
+ file_data?: string | null;
1904
+ /**
1905
+ * The ID of an uploaded file to use as input.
1906
+ */
1907
+ file_id?: string | null;
1908
+ /**
1909
+ * The name of the file, used when passing the file to the model as a
1910
+ * string.
1911
+ */
1912
+ filename?: string | null;
1913
+ };
1914
+
1915
+ export type FilePath = {
1916
+ /**
1917
+ * The ID of the file.
1918
+ */
1919
+ file_id: string;
1920
+ /**
1921
+ * The index of the file in the list of files.
1922
+ */
1923
+ index: number;
1924
+ };
1925
+
1926
+ export type FileSearchTool = {
1927
+ /**
1928
+ * The IDs of the vector stores to search.
1929
+ */
1930
+ vector_store_ids: Array<string>;
1931
+ /**
1932
+ * The maximum number of results to return. This number should be between 1 and 50 inclusive.
1933
+ */
1934
+ max_num_results?: number | null;
1935
+ filters?: null | Filter;
1936
+ ranking_options?: null | RankingOptions;
1937
+ };
1938
+
1939
+ /**
1940
+ * File search tool call output.
1941
+ */
1942
+ export type FileSearchToolCall = {
1943
+ /**
1944
+ * The unique ID of the file search tool call.
1945
+ */
1946
+ id: string;
1947
+ /**
1948
+ * The queries used to search for files.
1949
+ */
1950
+ queries: Array<string>;
1951
+ /**
1952
+ * The status of the file search tool call. One of `in_progress`, `searching`,
1953
+ * `incomplete`,`failed`, or `completed`.
1954
+ */
1955
+ status: FileSearchToolCallStatus;
1956
+ /**
1957
+ * The results of the file search tool call.
1958
+ */
1959
+ results?: Array<FileSearchToolCallResult> | null;
1960
+ };
1961
+
1962
+ /**
1963
+ * A single result from a file search.
1964
+ */
1965
+ export type FileSearchToolCallResult = {
1966
+ /**
1967
+ * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing
1968
+ * additional information about the object in a structured format, and querying for objects
1969
+ * API or the dashboard. Keys are strings with a maximum length of 64 characters
1970
+ * . Values are strings with a maximum length of 512 characters, booleans, or numbers.
1971
+ */
1972
+ attributes: {
1973
+ [key: string]: unknown;
1974
+ };
1975
+ /**
1976
+ * The unique ID of the file.
1977
+ */
1978
+ file_id: string;
1979
+ /**
1980
+ * The name of the file.
1981
+ */
1982
+ filename: string;
1983
+ /**
1984
+ * The relevance score of the file - a value between 0 and 1.
1985
+ */
1986
+ score: number;
1987
+ /**
1988
+ * The text that was retrieved from the file.
1989
+ */
1990
+ text: string;
1991
+ };
1992
+
1993
+ export type FileSearchToolCallStatus = 'in_progress' | 'searching' | 'incomplete' | 'failed' | 'completed';
1994
+
1995
+ /**
1996
+ * Filters for file search.
1997
+ */
1998
+ export type Filter = ComparisonFilter | CompoundFilter;
1999
+
2000
+ export type FinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
2001
+
2002
+ /**
2003
+ * The name and arguments of a function that should be called, as generated by the model.
2004
+ */
2005
+ export type FunctionCall = {
2006
+ /**
2007
+ * The name of the function to call.
2008
+ */
2009
+ name: string;
2010
+ /**
2011
+ * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
2012
+ */
2013
+ arguments: string;
2014
+ };
2015
+
2016
+ export type FunctionCallOutput = string | Array<InputContent>;
2017
+
2018
+ /**
2019
+ * Output from a function call that you're providing back to the model.
2020
+ */
2021
+ export type FunctionCallOutputItemParam = {
2022
+ /**
2023
+ * The unique ID of the function tool call generated by the model.
2024
+ */
2025
+ call_id: string;
2026
+ /**
2027
+ * Text, image, or file output of the function tool call.
2028
+ */
2029
+ output: FunctionCallOutput;
2030
+ /**
2031
+ * The unique ID of the function tool call output.
2032
+ * Populated when this item is returned via API.
2033
+ */
2034
+ id?: string | null;
2035
+ status?: null | OutputStatus;
2036
+ };
2037
+
2038
+ /**
2039
+ * The status of a function call output.
2040
+ */
2041
+ export type FunctionCallOutputStatusEnum = 'in_progress' | 'completed' | 'incomplete';
2042
+
2043
+ /**
2044
+ * The status of a function call.
2045
+ */
2046
+ export type FunctionCallStatus = 'in_progress' | 'completed' | 'incomplete';
2047
+
2048
+ export type FunctionCallStream = {
2049
+ /**
2050
+ * The name of the function to call.
2051
+ */
2052
+ name?: string | null;
2053
+ /**
2054
+ * The arguments to call the function with, as generated by the model in JSON format.
2055
+ * Note that the model does not always generate valid JSON, and may hallucinate
2056
+ * parameters not defined by your function schema. Validate the arguments in your
2057
+ * code before calling your function.
2058
+ */
2059
+ arguments?: string | null;
2060
+ };
2061
+
2062
+ export type FunctionName = {
2063
+ /**
2064
+ * The name of the function to call.
2065
+ */
2066
+ name: string;
2067
+ };
2068
+
2069
+ export type FunctionObject = {
2070
+ /**
2071
+ * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
2072
+ */
2073
+ name: string;
2074
+ /**
2075
+ * A description of what the function does, used by the model to choose when and how to call the function.
2076
+ */
2077
+ description?: string | null;
2078
+ /**
2079
+ * The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
2080
+ *
2081
+ * Omitting `parameters` defines a function with an empty parameter list.
2082
+ */
2083
+ parameters?: {
2084
+ [key: string]: unknown;
2085
+ } | null;
2086
+ /**
2087
+ * Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling).
2088
+ */
2089
+ strict?: boolean | null;
2090
+ };
2091
+
2092
+ /**
2093
+ * Shell exec action
2094
+ * Execute a shell command.
2095
+ */
2096
+ export type FunctionShellAction = {
2097
+ /**
2098
+ * A list of commands to run.
2099
+ */
2100
+ commands: Array<string>;
2101
+ /**
2102
+ * Optional timeout in milliseconds for the commands.
2103
+ */
2104
+ timeout_ms?: number | null;
2105
+ /**
2106
+ * Optional maximum number of characters to return from each command.
2107
+ */
2108
+ max_output_length?: number | null;
2109
+ };
2110
+
2111
+ /**
2112
+ * Commands and limits describing how to run the shell tool call.
2113
+ */
2114
+ export type FunctionShellActionParam = {
2115
+ /**
2116
+ * Ordered shell commands for the execution environment to run.
2117
+ */
2118
+ commands: Array<string>;
2119
+ /**
2120
+ * Maximum wall-clock time in milliseconds to allow the shell commands to run.
2121
+ */
2122
+ timeout_ms?: number | null;
2123
+ /**
2124
+ * Maximum number of UTF-8 characters to capture from combined stdout and stderr output.
2125
+ */
2126
+ max_output_length?: number | null;
2127
+ };
2128
+
2129
+ /**
2130
+ * A tool call that executes one or more shell commands in a managed environment.
2131
+ */
2132
+ export type FunctionShellCall = {
2133
+ /**
2134
+ * The unique ID of the function shell tool call. Populated when this item is returned via API.
2135
+ */
2136
+ id: string;
2137
+ /**
2138
+ * The unique ID of the function shell tool call generated by the model.
2139
+ */
2140
+ call_id: string;
2141
+ /**
2142
+ * The shell commands and limits that describe how to run the tool call.
2143
+ */
2144
+ action: FunctionShellAction;
2145
+ /**
2146
+ * The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.
2147
+ */
2148
+ status: LocalShellCallStatus;
2149
+ environment?: null | FunctionShellCallEnvironment;
2150
+ /**
2151
+ * The ID of the entity that created this tool call.
2152
+ */
2153
+ created_by?: string | null;
2154
+ };
2155
+
2156
+ /**
2157
+ * The environment for a shell call (response side).
2158
+ */
2159
+ export type FunctionShellCallEnvironment = {
2160
+ type: 'local';
2161
+ } | (ContainerReferenceResource & {
2162
+ type: 'container_reference';
2163
+ });
2164
+
2165
+ /**
2166
+ * The environment for a shell call item (request side).
2167
+ */
2168
+ export type FunctionShellCallItemEnvironment = (LocalEnvironmentParam & {
2169
+ type: 'local';
2170
+ }) | (ContainerReferenceParam & {
2171
+ type: 'container_reference';
2172
+ });
2173
+
2174
+ /**
2175
+ * A tool representing a request to execute one or more shell commands.
2176
+ */
2177
+ export type FunctionShellCallItemParam = {
2178
+ /**
2179
+ * The unique ID of the shell tool call. Populated when this item is returned via API.
2180
+ */
2181
+ id?: string | null;
2182
+ /**
2183
+ * The unique ID of the shell tool call generated by the model.
2184
+ */
2185
+ call_id: string;
2186
+ /**
2187
+ * The shell commands and limits that describe how to run the tool call.
2188
+ */
2189
+ action: FunctionShellActionParam;
2190
+ status?: null | FunctionShellCallItemStatus;
2191
+ environment?: null | FunctionShellCallItemEnvironment;
2192
+ };
2193
+
2194
+ /**
2195
+ * Status values reported for shell tool calls.
2196
+ */
2197
+ export type FunctionShellCallItemStatus = 'in_progress' | 'completed' | 'incomplete';
2198
+
2199
+ /**
2200
+ * The output of a shell tool call that was emitted.
2201
+ */
2202
+ export type FunctionShellCallOutput = {
2203
+ /**
2204
+ * The unique ID of the shell call output. Populated when this item is returned via API.
2205
+ */
2206
+ id: string;
2207
+ /**
2208
+ * The unique ID of the shell tool call generated by the model.
2209
+ */
2210
+ call_id: string;
2211
+ /**
2212
+ * An array of shell call output contents
2213
+ */
2214
+ output: Array<FunctionShellCallOutputContent>;
2215
+ /**
2216
+ * The maximum length of the shell command output. This is generated by the model and should be
2217
+ * passed back with the raw output.
2218
+ */
2219
+ max_output_length?: number | null;
2220
+ /**
2221
+ * The identifier of the actor that created the item.
2222
+ */
2223
+ created_by?: string | null;
2224
+ };
2225
+
2226
+ /**
2227
+ * The content of a shell tool call output that was emitted.
2228
+ */
2229
+ export type FunctionShellCallOutputContent = FunctionShellCallOutputOutcome & {
2230
+ /**
2231
+ * The standard output that was captured.
2232
+ */
2233
+ stdout: string;
2234
+ /**
2235
+ * The standard error output that was captured.
2236
+ */
2237
+ stderr: string;
2238
+ /**
2239
+ * The identifier of the actor that created the item.
2240
+ */
2241
+ created_by?: string | null;
2242
+ };
2243
+
2244
+ /**
2245
+ * Captured stdout and stderr for a portion of a shell tool call output.
2246
+ */
2247
+ export type FunctionShellCallOutputContentParam = {
2248
+ /**
2249
+ * Captured stdout output for this chunk of the shell call.
2250
+ */
2251
+ stdout: string;
2252
+ /**
2253
+ * Captured stderr output for this chunk of the shell call.
2254
+ */
2255
+ stderr: string;
2256
+ /**
2257
+ * The exit or timeout outcome associated with this chunk.
2258
+ */
2259
+ outcome: FunctionShellCallOutputOutcomeParam;
2260
+ };
2261
+
2262
+ /**
2263
+ * Indicates that the shell commands finished and returned an exit code.
2264
+ */
2265
+ export type FunctionShellCallOutputExitOutcome = {
2266
+ /**
2267
+ * Exit code from the shell process.
2268
+ */
2269
+ exit_code: number;
2270
+ };
2271
+
2272
+ /**
2273
+ * Indicates that the shell commands finished and returned an exit code.
2274
+ */
2275
+ export type FunctionShellCallOutputExitOutcomeParam = {
2276
+ /**
2277
+ * The exit code returned by the shell process.
2278
+ */
2279
+ exit_code: number;
2280
+ };
2281
+
2282
+ /**
2283
+ * The streamed output items emitted by a shell tool call.
2284
+ */
2285
+ export type FunctionShellCallOutputItemParam = {
2286
+ /**
2287
+ * The unique ID of the shell tool call output. Populated when this item is returned via API.
2288
+ */
2289
+ id?: string | null;
2290
+ /**
2291
+ * The unique ID of the shell tool call generated by the model.
2292
+ */
2293
+ call_id: string;
2294
+ /**
2295
+ * Captured chunks of stdout and stderr output, along with their associated outcomes.
2296
+ */
2297
+ output: Array<FunctionShellCallOutputContentParam>;
2298
+ /**
2299
+ * The maximum number of UTF-8 characters captured for this shell call's combined output.
2300
+ */
2301
+ max_output_length?: number | null;
2302
+ };
2303
+
2304
+ /**
2305
+ * Function shell call outcome
2306
+ */
2307
+ export type FunctionShellCallOutputOutcome = {
2308
+ type: 'timeout';
2309
+ } | (FunctionShellCallOutputExitOutcome & {
2310
+ type: 'exit';
2311
+ });
2312
+
2313
+ /**
2314
+ * The exit or timeout outcome associated with this chunk.
2315
+ */
2316
+ export type FunctionShellCallOutputOutcomeParam = {
2317
+ type: 'timeout';
2318
+ } | (FunctionShellCallOutputExitOutcomeParam & {
2319
+ type: 'exit';
2320
+ });
2321
+
2322
+ /**
2323
+ * The execution environment for a shell tool — container or local.
2324
+ */
2325
+ export type FunctionShellEnvironment = (ContainerAutoParam & {
2326
+ type: 'container_auto';
2327
+ }) | (LocalEnvironmentParam & {
2328
+ type: 'local';
2329
+ }) | (ContainerReferenceParam & {
2330
+ type: 'container_reference';
2331
+ });
2332
+
2333
+ /**
2334
+ * Parameters for the shell function tool.
2335
+ */
2336
+ export type FunctionShellToolParam = {
2337
+ environment?: null | FunctionShellEnvironment;
2338
+ };
2339
+
2340
+ export type FunctionTool = {
2341
+ /**
2342
+ * The name of the function to call.
2343
+ */
2344
+ name: string;
2345
+ /**
2346
+ * A JSON schema object describing the parameters of the function.
2347
+ */
2348
+ parameters?: {
2349
+ [key: string]: unknown;
2350
+ } | null;
2351
+ /**
2352
+ * Whether to enforce strict parameter validation. Default `true`.
2353
+ */
2354
+ strict?: boolean | null;
2355
+ /**
2356
+ * A description of the function. Used by the model to determine whether or not to call the
2357
+ * function.
2358
+ */
2359
+ description?: string | null;
2360
+ /**
2361
+ * Whether this function is deferred and loaded via tool search.
2362
+ */
2363
+ defer_loading?: boolean | null;
2364
+ };
2365
+
2366
+ export type FunctionToolCall = {
2367
+ /**
2368
+ * A JSON string of the arguments to pass to the function.
2369
+ */
2370
+ arguments: string;
2371
+ /**
2372
+ * The unique ID of the function tool call generated by the model.
2373
+ */
2374
+ call_id: string;
2375
+ /**
2376
+ * The namespace of the function to run.
2377
+ */
2378
+ namespace?: string | null;
2379
+ /**
2380
+ * The name of the function to run.
2381
+ */
2382
+ name: string;
2383
+ /**
2384
+ * The unique ID of the function tool call.
2385
+ */
2386
+ id?: string | null;
2387
+ status?: null | OutputStatus;
2388
+ };
2389
+
2390
+ /**
2391
+ * A function tool that can be used within a namespace or with tool search.
2392
+ */
2393
+ export type FunctionToolParam = {
2394
+ /**
2395
+ * The name of the function.
2396
+ */
2397
+ name: string;
2398
+ /**
2399
+ * A description of the function.
2400
+ */
2401
+ description?: string | null;
2402
+ /**
2403
+ * A JSON schema object describing the parameters of the function.
2404
+ */
2405
+ parameters?: {
2406
+ [key: string]: unknown;
2407
+ } | null;
2408
+ /**
2409
+ * Whether to enforce strict parameter validation.
2410
+ */
2411
+ strict?: boolean | null;
2412
+ /**
2413
+ * Whether this function should be deferred and discovered via tool search.
2414
+ */
2415
+ defer_loading?: boolean | null;
2416
+ };
2417
+
2418
+ export type FunctionType = 'function';
2419
+
2420
+ export type GrammarSyntax = 'lark' | 'regex';
2421
+
2422
+ export type HybridSearch = {
2423
+ /**
2424
+ * The weight of the embedding in the reciprocal ranking fusion.
2425
+ */
2426
+ embedding_weight: number;
2427
+ /**
2428
+ * The weight of the text in the reciprocal ranking fusion.
2429
+ */
2430
+ text_weight: number;
2431
+ };
2432
+
2433
+ export type ImageDetail = 'auto' | 'low' | 'high' | 'original';
2434
+
2435
+ /**
2436
+ * Whether to generate a new image or edit an existing image.
2437
+ */
2438
+ export type ImageGenActionEnum = 'generate' | 'edit' | 'auto';
2439
+
2440
+ /**
2441
+ * Image generation tool definition.
2442
+ */
2443
+ export type ImageGenTool = {
2444
+ background?: null | ImageGenToolBackground;
2445
+ input_fidelity?: null | InputFidelity;
2446
+ input_image_mask?: null | ImageGenToolInputImageMask;
2447
+ /**
2448
+ * The image generation model to use. Default: `gpt-image-1`.
2449
+ */
2450
+ model?: string | null;
2451
+ moderation?: null | ImageGenToolModeration;
2452
+ /**
2453
+ * Compression level for the output image. Default: 100.
2454
+ */
2455
+ output_compression?: number | null;
2456
+ output_format?: null | ImageGenToolOutputFormat;
2457
+ /**
2458
+ * Number of partial images to generate in streaming mode, from 0 (default value) to 3.
2459
+ */
2460
+ partial_images?: number | null;
2461
+ quality?: null | ImageGenToolQuality;
2462
+ size?: null | ImageGenToolSize;
2463
+ action?: null | ImageGenActionEnum;
2464
+ };
2465
+
2466
+ export type ImageGenToolBackground = 'transparent' | 'opaque' | 'auto';
2467
+
2468
+ export type ImageGenToolCall = {
2469
+ /**
2470
+ * The unique ID of the image generation call.
2471
+ */
2472
+ id: string;
2473
+ /**
2474
+ * The generated image encoded in base64.
2475
+ */
2476
+ result?: string | null;
2477
+ /**
2478
+ * The status of the image generation call.
2479
+ */
2480
+ status: ImageGenToolCallStatus;
2481
+ };
2482
+
2483
+ export type ImageGenToolCallStatus = 'in_progress' | 'completed' | 'generating' | 'failed';
2484
+
2485
+ export type ImageGenToolInputImageMask = {
2486
+ /**
2487
+ * Base64-encoded mask image.
2488
+ */
2489
+ image_url?: string | null;
2490
+ /**
2491
+ * File ID for the mask image.
2492
+ */
2493
+ file_id?: string | null;
2494
+ };
2495
+
2496
+ export type ImageGenToolModeration = 'auto' | 'low';
2497
+
2498
+ export type ImageGenToolOutputFormat = 'png' | 'webp' | 'jpeg';
2499
+
2500
+ export type ImageGenToolQuality = 'low' | 'medium' | 'high' | 'auto';
2501
+
2502
+ export type ImageGenToolSize = 'auto' | '1024x1024' | '1024x1536' | '1536x1024';
2503
+
2504
+ export type ImageUrl = {
2505
+ /**
2506
+ * Either a URL of the image or the base64 encoded image data.
2507
+ */
2508
+ url: string;
2509
+ detail?: null | ImageDetail;
2510
+ };
2511
+
2512
+ export type IncludeEnum = 'file_search_call.results' | 'web_search_call.results' | 'web_search_call.action.sources' | 'message.input_image.image_url' | 'computer_call_output.output.image_url' | 'code_interpreter_call.outputs' | 'reasoning.encrypted_content' | 'message.output_text.logprobs';
2513
+
2514
+ /**
2515
+ * Details about an incomplete response.
2516
+ */
2517
+ export type IncompleteDetails = {
2518
+ /**
2519
+ * The reason why the response is incomplete.
2520
+ */
2521
+ reason: string;
2522
+ };
2523
+
2524
+ /**
2525
+ * An inline skill definition.
2526
+ */
2527
+ export type InlineSkillParam = {
2528
+ /**
2529
+ * The name of the skill.
2530
+ */
2531
+ name: string;
2532
+ /**
2533
+ * The description of the skill.
2534
+ */
2535
+ description: string;
2536
+ /**
2537
+ * The inline source for the skill.
2538
+ */
2539
+ source: InlineSkillSourceParam;
2540
+ };
2541
+
2542
+ /**
2543
+ * An inline skill source (base64-encoded zip).
2544
+ */
2545
+ export type InlineSkillSourceParam = {
2546
+ /**
2547
+ * The media type. Always `"application/zip"`.
2548
+ */
2549
+ media_type: string;
2550
+ /**
2551
+ * The base64-encoded skill data.
2552
+ */
2553
+ data: string;
2554
+ };
2555
+
2556
+ export type InputAudio = {
2557
+ /**
2558
+ * Base64 encoded audio data.
2559
+ */
2560
+ data: string;
2561
+ /**
2562
+ * The format of the encoded audio data. Currently supports "wav" and "mp3".
2563
+ */
2564
+ format: InputAudioFormat;
2565
+ };
2566
+
2567
+ export type InputAudioFormat = 'wav' | 'mp3';
2568
+
2569
+ /**
2570
+ * Parts of a message: text, image, file, or audio.
2571
+ */
2572
+ export type InputContent = (InputTextContent & {
2573
+ type: 'input_text';
2574
+ }) | (InputImageContent & {
2575
+ type: 'input_image';
2576
+ }) | (InputFileContent & {
2577
+ type: 'input_file';
2578
+ });
2579
+
2580
+ export type InputFidelity = 'high' | 'low';
2581
+
2582
+ export type InputFileContent = {
2583
+ /**
2584
+ * The content of the file to be sent to the model.
2585
+ */
2586
+ file_data?: string | null;
2587
+ /**
2588
+ * The ID of the file to be sent to the model.
2589
+ */
2590
+ file_id?: string | null;
2591
+ /**
2592
+ * The URL of the file to be sent to the model.
2593
+ */
2594
+ file_url?: string | null;
2595
+ /**
2596
+ * The name of the file to be sent to the model.
2597
+ */
2598
+ filename?: string | null;
2599
+ };
2600
+
2601
+ export type InputImageContent = {
2602
+ /**
2603
+ * The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`.
2604
+ * Defaults to `auto`.
2605
+ */
2606
+ detail: ImageDetail;
2607
+ /**
2608
+ * The ID of the file to be sent to the model.
2609
+ */
2610
+ file_id?: string | null;
2611
+ /**
2612
+ * The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image
2613
+ * in a data URL.
2614
+ */
2615
+ image_url?: string | null;
2616
+ };
2617
+
2618
+ /**
2619
+ * Input item that can be used in the context for generating a response.
2620
+ *
2621
+ * This represents the OpenAPI `InputItem` schema which is an `anyOf`:
2622
+ * 1. `EasyInputMessage` - Simple, user-friendly message input (can use string content)
2623
+ * 2. `Item` - Structured items with proper type discrimination (including InputMessage, OutputMessage, tool calls)
2624
+ * 3. `ItemReferenceParam` - Reference to an existing item by ID (type can be null)
2625
+ *
2626
+ * Uses untagged deserialization because these types overlap in structure.
2627
+ * Order matters: more specific structures are tried first.
2628
+ *
2629
+ * # OpenAPI Specification
2630
+ * Corresponds to the `InputItem` schema: `anyOf[EasyInputMessage, Item, ItemReferenceParam]`
2631
+ */
2632
+ export type InputItem = ItemReference | Item | EasyInputMessage;
2633
+
2634
+ /**
2635
+ * A structured message input to the model (InputMessage in the OpenAPI spec).
2636
+ *
2637
+ * This variant requires structured content (not a simple string) and does not support
2638
+ * the `assistant` role (use OutputMessage for that). status is populated when items are returned via API.
2639
+ */
2640
+ export type InputMessage = {
2641
+ /**
2642
+ * A list of one or many input items to the model, containing different content types.
2643
+ */
2644
+ content: Array<InputContent>;
2645
+ /**
2646
+ * The role of the message input. One of `user`, `system`, or `developer`.
2647
+ * Note: `assistant` is NOT allowed here; use OutputMessage instead.
2648
+ */
2649
+ role: InputRole;
2650
+ status?: null | OutputStatus;
2651
+ };
2652
+
2653
+ export type InputParam = string | Array<InputItem>;
2654
+
2655
+ /**
2656
+ * The role for an input message - can only be `user`, `system`, or `developer`.
2657
+ * This type ensures type safety by excluding the `assistant` role (use OutputMessage for that).
2658
+ */
2659
+ export type InputRole = 'user' | 'system' | 'developer';
2660
+
2661
+ export type InputTextContent = {
2662
+ /**
2663
+ * The text input to the model.
2664
+ */
2665
+ text: string;
2666
+ };
2667
+
2668
+ export type InputTokenDetails = {
2669
+ /**
2670
+ * The number of tokens that were retrieved from the cache.
2671
+ * [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
2672
+ */
2673
+ cached_tokens: number;
2674
+ };
2675
+
2676
+ export type Instructions = string | Array<InputItem>;
2677
+
2678
+ /**
2679
+ * Content item used to generate a response.
2680
+ *
2681
+ * This is a properly discriminated union based on the `type` field, using Rust's
2682
+ * type-safe enum with serde's tag attribute for efficient deserialization.
2683
+ *
2684
+ * # OpenAPI Specification
2685
+ * Corresponds to the `Item` schema in the OpenAPI spec with a `type` discriminator.
2686
+ */
2687
+ export type Item = (MessageItem & {
2688
+ type: 'message';
2689
+ }) | (FileSearchToolCall & {
2690
+ type: 'file_search_call';
2691
+ }) | (ComputerToolCall & {
2692
+ type: 'computer_call';
2693
+ }) | (ComputerCallOutputItemParam & {
2694
+ type: 'computer_call_output';
2695
+ }) | (WebSearchToolCall & {
2696
+ type: 'web_search_call';
2697
+ }) | (FunctionToolCall & {
2698
+ type: 'function_call';
2699
+ }) | (FunctionCallOutputItemParam & {
2700
+ type: 'function_call_output';
2701
+ }) | (ToolSearchCallItemParam & {
2702
+ type: 'tool_search_call';
2703
+ }) | (ToolSearchOutputItemParam & {
2704
+ type: 'tool_search_output';
2705
+ }) | (ReasoningItem & {
2706
+ type: 'reasoning';
2707
+ }) | (CompactionSummaryItemParam & {
2708
+ type: 'compaction';
2709
+ }) | (ImageGenToolCall & {
2710
+ type: 'image_generation_call';
2711
+ }) | (CodeInterpreterToolCall & {
2712
+ type: 'code_interpreter_call';
2713
+ }) | (LocalShellToolCall & {
2714
+ type: 'local_shell_call';
2715
+ }) | (LocalShellToolCallOutput & {
2716
+ type: 'local_shell_call_output';
2717
+ }) | (FunctionShellCallItemParam & {
2718
+ type: 'shell_call';
2719
+ }) | (FunctionShellCallOutputItemParam & {
2720
+ type: 'shell_call_output';
2721
+ }) | (ApplyPatchToolCallItemParam & {
2722
+ type: 'apply_patch_call';
2723
+ }) | (ApplyPatchToolCallOutputItemParam & {
2724
+ type: 'apply_patch_call_output';
2725
+ }) | (McpListTools & {
2726
+ type: 'mcp_list_tools';
2727
+ }) | (McpApprovalRequest & {
2728
+ type: 'mcp_approval_request';
2729
+ }) | (McpApprovalResponse & {
2730
+ type: 'mcp_approval_response';
2731
+ }) | (McpToolCall & {
2732
+ type: 'mcp_call';
2733
+ }) | (CustomToolCallOutput & {
2734
+ type: 'custom_tool_call_output';
2735
+ }) | (CustomToolCall & {
2736
+ type: 'custom_tool_call';
2737
+ });
2738
+
2739
+ /**
2740
+ * A reference to an existing item by ID.
2741
+ */
2742
+ export type ItemReference = {
2743
+ type?: null | ItemReferenceType;
2744
+ /**
2745
+ * The ID of the item to reference.
2746
+ */
2747
+ id: string;
2748
+ };
2749
+
2750
+ export type ItemReferenceType = 'item_reference';
2751
+
2752
+ /**
2753
+ * A keypress action.
2754
+ */
2755
+ export type KeyPressAction = {
2756
+ /**
2757
+ * The combination of keys the model is requesting to be pressed.
2758
+ * This is an array of strings, each representing a key.
2759
+ */
2760
+ keys: Array<string>;
2761
+ };
2762
+
2763
+ export type ListModelResponse = {
2764
+ object: string;
2765
+ data: Array<Model>;
2766
+ };
2767
+
2768
+ /**
2769
+ * Uses a local computer environment.
2770
+ */
2771
+ export type LocalEnvironmentParam = {
2772
+ /**
2773
+ * An optional list of local skills.
2774
+ */
2775
+ skills?: Array<LocalSkillParam> | null;
2776
+ };
2777
+
2778
+ /**
2779
+ * Status values reported for function shell tool calls.
2780
+ */
2781
+ export type LocalShellCallStatus = 'in_progress' | 'completed' | 'incomplete';
2782
+
2783
+ /**
2784
+ * Define the shape of a local shell action (exec).
2785
+ */
2786
+ export type LocalShellExecAction = {
2787
+ /**
2788
+ * The command to run.
2789
+ */
2790
+ command: Array<string>;
2791
+ /**
2792
+ * Environment variables to set for the command.
2793
+ */
2794
+ env: {
2795
+ [key: string]: string;
2796
+ };
2797
+ /**
2798
+ * Optional timeout in milliseconds for the command.
2799
+ */
2800
+ timeout_ms?: number | null;
2801
+ /**
2802
+ * Optional user to run the command as.
2803
+ */
2804
+ user?: string | null;
2805
+ /**
2806
+ * Optional working directory to run the command in.
2807
+ */
2808
+ working_directory?: string | null;
2809
+ };
2810
+
2811
+ export type LocalShellToolCall = {
2812
+ /**
2813
+ * Execute a shell command on the server.
2814
+ */
2815
+ action: LocalShellExecAction;
2816
+ /**
2817
+ * The unique ID of the local shell tool call generated by the model.
2818
+ */
2819
+ call_id: string;
2820
+ /**
2821
+ * The unique ID of the local shell call.
2822
+ */
2823
+ id: string;
2824
+ /**
2825
+ * The status of the local shell call.
2826
+ */
2827
+ status: OutputStatus;
2828
+ };
2829
+
2830
+ /**
2831
+ * Output from a local shell tool call that you're providing back to the model.
2832
+ */
2833
+ export type LocalShellToolCallOutput = {
2834
+ /**
2835
+ * The unique ID of the local shell tool call generated by the model.
2836
+ */
2837
+ id: string;
2838
+ /**
2839
+ * A JSON string of the output of the local shell tool call.
2840
+ */
2841
+ output: string;
2842
+ status?: null | OutputStatus;
2843
+ };
2844
+
2845
+ /**
2846
+ * A local skill available in a local environment.
2847
+ */
2848
+ export type LocalSkillParam = {
2849
+ /**
2850
+ * The name of the skill.
2851
+ */
2852
+ name: string;
2853
+ /**
2854
+ * The description of the skill.
2855
+ */
2856
+ description: string;
2857
+ /**
2858
+ * The path to the directory containing the skill.
2859
+ */
2860
+ path: string;
2861
+ };
2862
+
2863
+ export type LogProb = {
2864
+ bytes: Array<number>;
2865
+ logprob: number;
2866
+ token: string;
2867
+ top_logprobs: Array<TopLogProb>;
2868
+ };
2869
+
2870
+ export type McpApprovalRequest = {
2871
+ /**
2872
+ * JSON string of arguments for the tool.
2873
+ */
2874
+ arguments: string;
2875
+ /**
2876
+ * The unique ID of the approval request.
2877
+ */
2878
+ id: string;
2879
+ /**
2880
+ * The name of the tool to run.
2881
+ */
2882
+ name: string;
2883
+ /**
2884
+ * The label of the MCP server making the request.
2885
+ */
2886
+ server_label: string;
2887
+ };
2888
+
2889
+ /**
2890
+ * An MCP approval response that you're providing back to the model.
2891
+ */
2892
+ export type McpApprovalResponse = {
2893
+ /**
2894
+ * The ID of the approval request being answered.
2895
+ */
2896
+ approval_request_id: string;
2897
+ /**
2898
+ * Whether the request was approved.
2899
+ */
2900
+ approve: boolean;
2901
+ /**
2902
+ * The unique ID of the approval response
2903
+ */
2904
+ id?: string | null;
2905
+ /**
2906
+ * Optional reason for the decision.
2907
+ */
2908
+ reason?: string | null;
2909
+ };
2910
+
2911
+ export type McpListTools = {
2912
+ /**
2913
+ * The unique ID of the list.
2914
+ */
2915
+ id: string;
2916
+ /**
2917
+ * The label of the MCP server.
2918
+ */
2919
+ server_label: string;
2920
+ /**
2921
+ * The tools available on the server.
2922
+ */
2923
+ tools: Array<McpListToolsTool>;
2924
+ /**
2925
+ * Error message if listing failed.
2926
+ */
2927
+ error?: string | null;
2928
+ };
2929
+
2930
+ export type McpListToolsTool = {
2931
+ /**
2932
+ * The JSON schema describing the tool's input.
2933
+ */
2934
+ input_schema: {
2935
+ [key: string]: unknown;
2936
+ };
2937
+ /**
2938
+ * The name of the tool.
2939
+ */
2940
+ name: string;
2941
+ /**
2942
+ * Additional annotations about the tool.
2943
+ */
2944
+ annotations?: {
2945
+ [key: string]: unknown;
2946
+ } | null;
2947
+ /**
2948
+ * The description of the tool.
2949
+ */
2950
+ description?: string | null;
2951
+ };
2952
+
2953
+ export type McpTool = {
2954
+ /**
2955
+ * A label for this MCP server, used to identify it in tool calls.
2956
+ */
2957
+ server_label: string;
2958
+ allowed_tools?: null | McpToolAllowedTools;
2959
+ /**
2960
+ * An OAuth access token that can be used with a remote MCP server, either with a custom MCP
2961
+ * server URL or a service connector. Your application must handle the OAuth authorization
2962
+ * flow and provide the token here.
2963
+ */
2964
+ authorization?: string | null;
2965
+ connector_id?: null | McpToolConnectorId;
2966
+ /**
2967
+ * Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
2968
+ */
2969
+ headers?: {
2970
+ [key: string]: unknown;
2971
+ } | null;
2972
+ require_approval?: null | McpToolRequireApproval;
2973
+ /**
2974
+ * Optional description of the MCP server, used to provide more context.
2975
+ */
2976
+ server_description?: string | null;
2977
+ /**
2978
+ * The URL for the MCP server. One of `server_url` or `connector_id` must be provided.
2979
+ */
2980
+ server_url?: string | null;
2981
+ /**
2982
+ * Whether this MCP tool is deferred and discovered via tool search.
2983
+ */
2984
+ defer_loading?: boolean | null;
2985
+ };
2986
+
2987
+ export type McpToolAllowedTools = Array<string> | McpToolFilter;
2988
+
2989
+ export type McpToolApprovalFilter = {
2990
+ always?: null | McpToolFilter;
2991
+ never?: null | McpToolFilter;
2992
+ };
2993
+
2994
+ export type McpToolApprovalSetting = 'always' | 'never';
2995
+
2996
+ /**
2997
+ * Output of an MCP server tool invocation.
2998
+ */
2999
+ export type McpToolCall = {
3000
+ /**
3001
+ * A JSON string of the arguments passed to the tool.
3002
+ */
3003
+ arguments: string;
3004
+ /**
3005
+ * The unique ID of the tool call.
3006
+ */
3007
+ id: string;
3008
+ /**
3009
+ * The name of the tool that was run.
3010
+ */
3011
+ name: string;
3012
+ /**
3013
+ * The label of the MCP server running the tool.
3014
+ */
3015
+ server_label: string;
3016
+ /**
3017
+ * Unique identifier for the MCP tool call approval request. Include this value
3018
+ * in a subsequent `mcp_approval_response` input to approve or reject the corresponding
3019
+ * tool call.
3020
+ */
3021
+ approval_request_id?: string | null;
3022
+ /**
3023
+ * Error message from the call, if any.
3024
+ */
3025
+ error?: string | null;
3026
+ /**
3027
+ * The output from the tool call.
3028
+ */
3029
+ output?: string | null;
3030
+ status?: null | McpToolCallStatus;
3031
+ };
3032
+
3033
+ export type McpToolCallStatus = 'in_progress' | 'completed' | 'incomplete' | 'calling' | 'failed';
3034
+
3035
+ export type McpToolFilter = {
3036
+ /**
3037
+ * Indicates whether or not a tool modifies data or is read-only.
3038
+ * If an MCP server is annotated with [readOnlyHint](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
3039
+ * it will match this filter.
3040
+ */
3041
+ read_only?: boolean | null;
3042
+ /**
3043
+ * List of allowed tool names.
3044
+ */
3045
+ tool_names?: Array<string> | null;
3046
+ };
3047
+
3048
+ /**
3049
+ * Approval policy or filter for MCP tools.
3050
+ */
3051
+ export type McpToolRequireApproval = McpToolApprovalFilter | McpToolApprovalSetting;
3052
+
3053
+ export type McpToolConnectorId = 'connector_dropbox' | 'connector_gmail' | 'connector_googlecalendar' | 'connector_googledrive' | 'connector_microsoftteams' | 'connector_outlookcalendar' | 'connector_outlookemail' | 'connector_sharepoint';
3054
+
3055
+ export type Message = {
3056
+ role: string;
3057
+ content: string;
3058
+ images?: Array<string> | null;
3059
+ };
3060
+
3061
+ /**
3062
+ * A message item used within the `Item` enum.
3063
+ *
3064
+ * Both InputMessage and OutputMessage have `type: "message"`, so we use an untagged
3065
+ * enum to distinguish them based on their structure:
3066
+ * - OutputMessage: role=assistant, required id & status fields
3067
+ * - InputMessage: role=user/system/developer, content is `Vec<ContentType>`, optional id/status
3068
+ *
3069
+ * Note: EasyInputMessage is NOT included here - it's a separate variant in `InputItem`,
3070
+ * not part of the structured `Item` enum.
3071
+ */
3072
+ export type MessageItem = OutputMessage | InputMessage;
3073
+
3074
+ /**
3075
+ * Labels an `assistant` message as intermediate commentary or the final answer.
3076
+ * For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend
3077
+ * phase on all assistant messages — dropping it can degrade performance.
3078
+ */
3079
+ export type MessagePhase = 'commentary' | 'final_answer';
3080
+
3081
+ export type MessageType = 'message';
3082
+
3083
+ /**
3084
+ * Set of 16 key-value pairs that can be attached to an object.
3085
+ * This can be useful for storing additional information about the
3086
+ * object in a structured format, and querying for objects via API
3087
+ * or the dashboard. Keys are strings with a maximum length of 64
3088
+ * characters. Values are strings with a maximum length of 512
3089
+ * characters.
3090
+ */
3091
+ export type Metadata = unknown;
3092
+
3093
+ /**
3094
+ * Describes an OpenAI model offering that can be used with the API.
3095
+ */
3096
+ export type Model = {
3097
+ /**
3098
+ * The model identifier, which can be referenced in the API endpoints.
3099
+ */
3100
+ id: string;
3101
+ /**
3102
+ * The object type, which is always "model".
3103
+ */
3104
+ object: string;
3105
+ /**
3106
+ * The Unix timestamp (in seconds) when the model was created.
3107
+ */
3108
+ created: number;
3109
+ /**
3110
+ * The organization that owns the model.
3111
+ */
3112
+ owned_by: string;
3113
+ };
3114
+
3115
+ export type ModelDetails = {
3116
+ parent_model?: string | null;
3117
+ format: string;
3118
+ family: string;
3119
+ families?: Array<string> | null;
3120
+ parameter_size: string;
3121
+ quantization_level: string;
3122
+ };
3123
+
3124
+ export type ModelsResponse = {
3125
+ models: Array<OllamaModel>;
3126
+ };
3127
+
3128
+ /**
3129
+ * A mouse move action.
3130
+ */
3131
+ export type MoveParam = {
3132
+ /**
3133
+ * The x-coordinate to move to.
3134
+ */
3135
+ x: number;
3136
+ /**
3137
+ * The y-coordinate to move to.
3138
+ */
3139
+ y: number;
3140
+ };
3141
+
3142
+ /**
3143
+ * Groups function/custom tools under a shared namespace.
3144
+ */
3145
+ export type NamespaceToolParam = {
3146
+ /**
3147
+ * The namespace name used in tool calls (for example, `crm`).
3148
+ */
3149
+ name: string;
3150
+ /**
3151
+ * A description of the namespace shown to the model.
3152
+ */
3153
+ description: string;
3154
+ /**
3155
+ * The function/custom tools available inside this namespace.
3156
+ */
3157
+ tools: Array<NamespaceToolParamTool>;
3158
+ };
3159
+
3160
+ /**
3161
+ * A function or custom tool that belongs to a namespace.
3162
+ */
3163
+ export type NamespaceToolParamTool = (FunctionToolParam & {
3164
+ type: 'function';
3165
+ }) | (CustomToolParam & {
3166
+ type: 'custom';
3167
+ });
3168
+
3169
+ export type OllamaError = {
3170
+ error: string;
3171
+ };
3172
+
3173
+ export type OllamaModel = {
3174
+ model: string;
3175
+ modified_at: number;
3176
+ size: number;
3177
+ digest: string;
3178
+ details: ModelDetails;
3179
+ };
3180
+
3181
+ export type Options = {
3182
+ num_keep?: number | null;
3183
+ seed?: number | null;
3184
+ num_predict?: number | null;
3185
+ top_k?: number | null;
3186
+ top_p?: number | null;
3187
+ tfs_z?: number | null;
3188
+ typical_p?: number | null;
3189
+ repeat_last_n?: number | null;
3190
+ temperature?: number | null;
3191
+ repeat_penalty?: number | null;
3192
+ presence_penalty?: number | null;
3193
+ frequency_penalty?: number | null;
3194
+ mirostat?: number | null;
3195
+ mirostat_tau?: number | null;
3196
+ mirostat_eta?: number | null;
3197
+ penalize_newline?: boolean | null;
3198
+ stop?: Array<string> | null;
3199
+ numa?: boolean | null;
3200
+ num_ctx?: number | null;
3201
+ num_batch?: number | null;
3202
+ num_gpu?: number | null;
3203
+ main_gpu?: number | null;
3204
+ low_vram?: boolean | null;
3205
+ f16_kv?: boolean | null;
3206
+ logits_all?: boolean | null;
3207
+ vocab_only?: boolean | null;
3208
+ use_mmap?: boolean | null;
3209
+ use_mlock?: boolean | null;
3210
+ num_thread?: number | null;
3211
+ };
3212
+
3213
+ /**
3214
+ * Output item
3215
+ */
3216
+ export type OutputItem = (OutputMessage & {
3217
+ type: 'message';
3218
+ }) | (FileSearchToolCall & {
3219
+ type: 'file_search_call';
3220
+ }) | (FunctionToolCall & {
3221
+ type: 'function_call';
3222
+ }) | (WebSearchToolCall & {
3223
+ type: 'web_search_call';
3224
+ }) | (ComputerToolCall & {
3225
+ type: 'computer_call';
3226
+ }) | (ReasoningItem & {
3227
+ type: 'reasoning';
3228
+ }) | (CompactionBody & {
3229
+ type: 'compaction';
3230
+ }) | (ImageGenToolCall & {
3231
+ type: 'image_generation_call';
3232
+ }) | (CodeInterpreterToolCall & {
3233
+ type: 'code_interpreter_call';
3234
+ }) | (LocalShellToolCall & {
3235
+ type: 'local_shell_call';
3236
+ }) | (FunctionShellCall & {
3237
+ type: 'shell_call';
3238
+ }) | (FunctionShellCallOutput & {
3239
+ type: 'shell_call_output';
3240
+ }) | (ApplyPatchToolCall & {
3241
+ type: 'apply_patch_call';
3242
+ }) | (ApplyPatchToolCallOutput & {
3243
+ type: 'apply_patch_call_output';
3244
+ }) | (McpToolCall & {
3245
+ type: 'mcp_call';
3246
+ }) | (McpListTools & {
3247
+ type: 'mcp_list_tools';
3248
+ }) | (McpApprovalRequest & {
3249
+ type: 'mcp_approval_request';
3250
+ }) | (CustomToolCall & {
3251
+ type: 'custom_tool_call';
3252
+ }) | (ToolSearchCall & {
3253
+ type: 'tool_search_call';
3254
+ }) | (ToolSearchOutput & {
3255
+ type: 'tool_search_output';
3256
+ });
3257
+
3258
+ /**
3259
+ * A message generated by the model.
3260
+ */
3261
+ export type OutputMessage = {
3262
+ /**
3263
+ * The content of the output message.
3264
+ */
3265
+ content: Array<OutputMessageContent>;
3266
+ /**
3267
+ * The unique ID of the output message.
3268
+ */
3269
+ id: string;
3270
+ /**
3271
+ * The role of the output message. Always `assistant`.
3272
+ */
3273
+ role: AssistantRole;
3274
+ phase?: null | MessagePhase;
3275
+ /**
3276
+ * The status of the message input. One of `in_progress`, `completed`, or
3277
+ * `incomplete`. Populated when input items are returned via API.
3278
+ */
3279
+ status: OutputStatus;
3280
+ };
3281
+
3282
+ export type OutputMessageContent = (OutputTextContent & {
3283
+ type: 'output_text';
3284
+ }) | (RefusalContent & {
3285
+ type: 'refusal';
3286
+ });
3287
+
3288
+ /**
3289
+ * Status of input/output items.
3290
+ */
3291
+ export type OutputStatus = 'in_progress' | 'completed' | 'incomplete';
3292
+
3293
+ /**
3294
+ * A simple text output from the model.
3295
+ */
3296
+ export type OutputTextContent = {
3297
+ /**
3298
+ * The annotations of the text output.
3299
+ */
3300
+ annotations: Array<Annotation>;
3301
+ logprobs?: Array<LogProb> | null;
3302
+ /**
3303
+ * The text output from the model.
3304
+ */
3305
+ text: string;
3306
+ };
3307
+
3308
+ export type OutputTokenDetails = {
3309
+ /**
3310
+ * The number of reasoning tokens.
3311
+ */
3312
+ reasoning_tokens: number;
3313
+ };
3314
+
3315
+ /**
3316
+ * The type of the predicted content you want to provide. This type is
3317
+ * currently always `content`.
3318
+ */
3319
+ export type PredictionContent = {
3320
+ /**
3321
+ * The type of the predicted content you want to provide. This type is
3322
+ * currently always `content`.
3323
+ */
3324
+ content: PredictionContentContent;
3325
+ type: 'content';
3326
+ };
3327
+
3328
+ /**
3329
+ * The content that should be matched when generating a model response. If generated tokens would match this content, the entire model response can be returned much more quickly.
3330
+ */
3331
+ export type PredictionContentContent = string | Array<ChatCompletionRequestMessageContentPartText>;
3332
+
3333
+ export type Prompt = {
3334
+ /**
3335
+ * The unique identifier of the prompt template to use.
3336
+ */
3337
+ id: string;
3338
+ /**
3339
+ * Optional version of the prompt template.
3340
+ */
3341
+ version?: string | null;
3342
+ variables?: null | ResponsePromptVariables;
3343
+ };
3344
+
3345
+ /**
3346
+ * The retention policy for the prompt cache.
3347
+ */
3348
+ export type PromptCacheRetention = 'in_memory' | '24h';
3349
+
3350
+ /**
3351
+ * Breakdown of tokens used in a completion.
3352
+ */
3353
+ export type PromptTokensDetails = {
3354
+ /**
3355
+ * Audio input tokens present in the prompt.
3356
+ */
3357
+ audio_tokens?: number | null;
3358
+ /**
3359
+ * Cached tokens present in the prompt.
3360
+ */
3361
+ cached_tokens?: number | null;
3362
+ };
3363
+
3364
+ export type RankVersionType = 'auto' | 'default-2024-11-15';
3365
+
3366
+ /**
3367
+ * Options for search result ranking.
3368
+ */
3369
+ export type RankingOptions = {
3370
+ hybrid_search?: null | HybridSearch;
3371
+ /**
3372
+ * The ranker to use for the file search.
3373
+ */
3374
+ ranker: RankVersionType;
3375
+ /**
3376
+ * The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will
3377
+ * attempt to return only the most relevant results, but may return fewer results.
3378
+ */
3379
+ score_threshold?: number | null;
3380
+ };
3381
+
3382
+ /**
3383
+ * o-series reasoning settings.
3384
+ */
3385
+ export type Reasoning = {
3386
+ effort?: null | ReasoningEffort;
3387
+ summary?: null | ReasoningSummary;
3388
+ };
3389
+
3390
+ export type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
3391
+
3392
+ /**
3393
+ * A reasoning item representing the model's chain of thought, including summary paragraphs.
3394
+ */
3395
+ export type ReasoningItem = {
3396
+ /**
3397
+ * Unique identifier of the reasoning content.
3398
+ */
3399
+ id: string;
3400
+ /**
3401
+ * Reasoning summary content.
3402
+ */
3403
+ summary: Array<SummaryPart>;
3404
+ /**
3405
+ * Reasoning text content.
3406
+ */
3407
+ content?: Array<ReasoningTextContent> | null;
3408
+ /**
3409
+ * The encrypted content of the reasoning item - populated when a response is generated with
3410
+ * `reasoning.encrypted_content` in the `include` parameter.
3411
+ */
3412
+ encrypted_content?: string | null;
3413
+ status?: null | OutputStatus;
3414
+ };
3415
+
3416
+ export type ReasoningSummary = 'auto' | 'concise' | 'detailed';
3417
+
3418
+ export type ReasoningTextContent = {
3419
+ /**
3420
+ * The reasoning text from the model.
3421
+ */
3422
+ text: string;
3423
+ };
3424
+
3425
+ /**
3426
+ * A refusal explanation from the model.
3427
+ */
3428
+ export type RefusalContent = {
3429
+ /**
3430
+ * The refusal explanation from the model.
3431
+ */
3432
+ refusal: string;
3433
+ };
3434
+
3435
+ /**
3436
+ * The complete response returned by the Responses API.
3437
+ */
3438
+ export type Response = {
3439
+ /**
3440
+ * Whether to run the model response in the background.
3441
+ * [Learn more](https://platform.openai.com/docs/guides/background).
3442
+ */
3443
+ background?: boolean | null;
3444
+ billing?: null | Billing;
3445
+ conversation?: null | Conversation;
3446
+ /**
3447
+ * Unix timestamp (in seconds) when this Response was created.
3448
+ */
3449
+ created_at: number;
3450
+ /**
3451
+ * Unix timestamp (in seconds) of when this Response was completed.
3452
+ * Only present when the status is `completed`.
3453
+ */
3454
+ completed_at?: number | null;
3455
+ error?: null | ErrorObject;
3456
+ /**
3457
+ * Unique identifier for this response.
3458
+ */
3459
+ id: string;
3460
+ incomplete_details?: null | IncompleteDetails;
3461
+ instructions?: null | Instructions;
3462
+ /**
3463
+ * An upper bound for the number of tokens that can be generated for a response,
3464
+ * including visible output tokens and
3465
+ * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
3466
+ */
3467
+ max_output_tokens?: number | null;
3468
+ /**
3469
+ * Set of 16 key-value pairs that can be attached to an object. This can be
3470
+ * useful for storing additional information about the object in a structured
3471
+ * format, and querying for objects via API or the dashboard.
3472
+ *
3473
+ * Keys are strings with a maximum length of 64 characters. Values are strings
3474
+ * with a maximum length of 512 characters.
3475
+ */
3476
+ metadata?: {
3477
+ [key: string]: string;
3478
+ } | null;
3479
+ /**
3480
+ * Model ID used to generate the response, like gpt-4o or o3. OpenAI offers a
3481
+ * wide range of models with different capabilities, performance characteristics,
3482
+ * and price points. Refer to the [model guide](https://platform.openai.com/docs/models) to browse and compare available models.
3483
+ */
3484
+ model: string;
3485
+ /**
3486
+ * The object type of this resource - always set to `response`.
3487
+ */
3488
+ object: string;
3489
+ /**
3490
+ * An array of content items generated by the model.
3491
+ *
3492
+ * - The length and order of items in the output array is dependent on the model's response.
3493
+ * - Rather than accessing the first item in the output array and assuming it's an assistant
3494
+ * message with the content generated by the model, you might consider using
3495
+ * the `output_text` property where supported in SDKs.
3496
+ */
3497
+ output: Array<OutputItem>;
3498
+ /**
3499
+ * SDK-only convenience property that contains the aggregated text output from all
3500
+ * `output_text` items in the `output` array, if any are present.
3501
+ * Supported in the Python and JavaScript SDKs.
3502
+ * Whether to allow the model to run tool calls in parallel.
3503
+ */
3504
+ parallel_tool_calls?: boolean | null;
3505
+ /**
3506
+ * The unique ID of the previous response to the model. Use this to create multi-turn conversations.
3507
+ * Learn more about [conversation state](https://platform.openai.com/docs/guides/conversation-state).
3508
+ * Cannot be used in conjunction with `conversation`.
3509
+ */
3510
+ previous_response_id?: string | null;
3511
+ prompt?: null | Prompt;
3512
+ /**
3513
+ * Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces
3514
+ * the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
3515
+ */
3516
+ prompt_cache_key?: string | null;
3517
+ prompt_cache_retention?: null | PromptCacheRetention;
3518
+ reasoning?: null | Reasoning;
3519
+ /**
3520
+ * A stable identifier used to help detect users of your application that may be violating OpenAI's
3521
+ * usage policies.
3522
+ *
3523
+ * The IDs should be a string that uniquely identifies each user. We recommend hashing their username
3524
+ * or email address, in order to avoid sending us any identifying information. [Learn
3525
+ * more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
3526
+ */
3527
+ safety_identifier?: string | null;
3528
+ service_tier?: null | ServiceTier;
3529
+ /**
3530
+ * The status of the response generation.
3531
+ * One of `completed`, `failed`, `in_progress`, `cancelled`, `queued`, or `incomplete`.
3532
+ */
3533
+ status: Status;
3534
+ /**
3535
+ * What sampling temperature was used, between 0 and 2. Higher values like 0.8 make
3536
+ * outputs more random, lower values like 0.2 make output more focused and deterministic.
3537
+ *
3538
+ * We generally recommend altering this or `top_p` but not both.
3539
+ */
3540
+ temperature?: number | null;
3541
+ text?: null | ResponseTextParam;
3542
+ tool_choice?: null | ToolChoiceParam;
3543
+ /**
3544
+ * An array of tools the model may call while generating a response. You
3545
+ * can specify which tool to use by setting the `tool_choice` parameter.
3546
+ *
3547
+ * We support the following categories of tools:
3548
+ * - **Built-in tools**: Tools that are provided by OpenAI that extend the
3549
+ * model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)
3550
+ * or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about
3551
+ * [built-in tools](https://platform.openai.com/docs/guides/tools).
3552
+ * - **MCP Tools**: Integrations with third-party systems via custom MCP servers
3553
+ * or predefined connectors such as Google Drive and SharePoint. Learn more about
3554
+ * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
3555
+ * - **Function calls (custom tools)**: Functions that are defined by you,
3556
+ * enabling the model to call your own code with strongly typed arguments
3557
+ * and outputs. Learn more about
3558
+ * [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use
3559
+ * custom tools to call your own code.
3560
+ */
3561
+ tools?: Array<Tool> | null;
3562
+ /**
3563
+ * An integer between 0 and 20 specifying the number of most likely tokens to return at each
3564
+ * token position, each with an associated log probability.
3565
+ */
3566
+ top_logprobs?: number | null;
3567
+ /**
3568
+ * An alternative to sampling with temperature, called nucleus sampling,
3569
+ * where the model considers the results of the tokens with top_p probability
3570
+ * mass. So 0.1 means only the tokens comprising the top 10% probability mass
3571
+ * are considered.
3572
+ *
3573
+ * We generally recommend altering this or `temperature` but not both.
3574
+ */
3575
+ top_p?: number | null;
3576
+ truncation?: null | Truncation;
3577
+ usage?: null | ResponseUsage;
3578
+ };
3579
+
3580
+ export type ResponseFormat = {
3581
+ type: 'text';
3582
+ } | {
3583
+ type: 'json_object';
3584
+ } | {
3585
+ json_schema: ResponseFormatJsonSchema;
3586
+ type: 'json_schema';
3587
+ };
3588
+
3589
+ export type ResponseFormatJsonSchema = {
3590
+ /**
3591
+ * A description of what the response format is for, used by the model to determine how to respond in the format.
3592
+ */
3593
+ description?: string | null;
3594
+ /**
3595
+ * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
3596
+ */
3597
+ name: string;
3598
+ /**
3599
+ * The schema for the response format, described as a JSON Schema object.
3600
+ * Learn how to build JSON schemas [here](https://json-schema.org/).
3601
+ */
3602
+ schema?: {
3603
+ [key: string]: unknown;
3604
+ } | null;
3605
+ /**
3606
+ * Whether to enable strict schema adherence when generating the output.
3607
+ * If set to true, the model will always follow the exact schema defined
3608
+ * in the `schema` field. Only a subset of JSON Schema is supported when
3609
+ * `strict` is `true`. To learn more, read the [Structured Outputs
3610
+ * guide](https://platform.openai.com/docs/guides/structured-outputs).
3611
+ */
3612
+ strict?: boolean | null;
3613
+ };
3614
+
3615
+ /**
3616
+ * Output types that you would like the model to generate for this request.
3617
+ *
3618
+ * Most models are capable of generating text, which is the default: `["text"]`
3619
+ *
3620
+ * The `gpt-4o-audio-preview` model can also be used to [generate
3621
+ * audio](https://platform.openai.com/docs/guides/audio). To request that this model generate both text and audio responses, you can use: `["text", "audio"]`
3622
+ */
3623
+ export type ResponseModalities = 'text' | 'audio';
3624
+
3625
+ export type ResponsePromptVariables = string | InputContent | {
3626
+ [key: string]: unknown;
3627
+ };
3628
+
3629
+ export type ResponseStreamOptions = {
3630
+ /**
3631
+ * When true, stream obfuscation will be enabled. Stream obfuscation adds
3632
+ * random characters to an `obfuscation` field on streaming delta events to
3633
+ * normalize payload sizes as a mitigation to certain side-channel attacks.
3634
+ * These obfuscation fields are included by default, but add a small amount
3635
+ * of overhead to the data stream. You can set `include_obfuscation` to
3636
+ * false to optimize for bandwidth if you trust the network links between
3637
+ * your application and the OpenAI API.
3638
+ */
3639
+ include_obfuscation?: boolean | null;
3640
+ };
3641
+
3642
+ /**
3643
+ * Configuration for text response format.
3644
+ */
3645
+ export type ResponseTextParam = {
3646
+ /**
3647
+ * An object specifying the format that the model must output.
3648
+ *
3649
+ * Configuring `{ "type": "json_schema" }` enables Structured Outputs,
3650
+ * which ensures the model will match your supplied JSON schema. Learn more in the
3651
+ * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
3652
+ *
3653
+ * The default format is `{ "type": "text" }` with no additional options.
3654
+ *
3655
+ * **Not recommended for gpt-4o and newer models:**
3656
+ *
3657
+ * Setting to `{ "type": "json_object" }` enables the older JSON mode, which
3658
+ * ensures the message the model generates is valid JSON. Using `json_schema`
3659
+ * is preferred for models that support it.
3660
+ */
3661
+ format: TextResponseFormatConfiguration;
3662
+ verbosity?: null | Verbosity;
3663
+ };
3664
+
3665
+ /**
3666
+ * Usage statistics for a response.
3667
+ */
3668
+ export type ResponseUsage = {
3669
+ /**
3670
+ * The number of input tokens.
3671
+ */
3672
+ input_tokens: number;
3673
+ /**
3674
+ * A detailed breakdown of the input tokens.
3675
+ */
3676
+ input_tokens_details: InputTokenDetails;
3677
+ /**
3678
+ * The number of output tokens.
3679
+ */
3680
+ output_tokens: number;
3681
+ /**
3682
+ * A detailed breakdown of the output tokens.
3683
+ */
3684
+ output_tokens_details: OutputTokenDetails;
3685
+ /**
3686
+ * The total number of tokens used.
3687
+ */
3688
+ total_tokens: number;
3689
+ };
3690
+
3691
+ /**
3692
+ * Role of messages in the API.
3693
+ */
3694
+ export type Role = 'user' | 'assistant' | 'system' | 'developer';
3695
+
3696
+ /**
3697
+ * A scroll action.
3698
+ */
3699
+ export type ScrollParam = {
3700
+ /**
3701
+ * The horizontal scroll distance.
3702
+ */
3703
+ scroll_x: number;
3704
+ /**
3705
+ * The vertical scroll distance.
3706
+ */
3707
+ scroll_y: number;
3708
+ /**
3709
+ * The x-coordinate where the scroll occurred.
3710
+ */
3711
+ x: number;
3712
+ /**
3713
+ * The y-coordinate where the scroll occurred.
3714
+ */
3715
+ y: number;
3716
+ };
3717
+
3718
+ /**
3719
+ * The type of content to search for.
3720
+ */
3721
+ export type SearchContentType = 'text' | 'image';
3722
+
3723
+ export type ServiceTier = 'auto' | 'default' | 'flex' | 'scale' | 'priority';
3724
+
3725
+ export type ShowRequest = {
3726
+ name: string;
3727
+ };
3728
+
3729
+ export type ShowResponse = {
3730
+ details: ModelDetails;
3731
+ license: string;
3732
+ model_info: {};
3733
+ modelfile: string;
3734
+ modified_at: number;
3735
+ parameters: string;
3736
+ template: string;
3737
+ };
3738
+
3739
+ /**
3740
+ * A skill parameter — either a reference or inline definition.
3741
+ */
3742
+ export type SkillParam = (SkillReferenceParam & {
3743
+ type: 'skill_reference';
3744
+ }) | (InlineSkillParam & {
3745
+ type: 'inline';
3746
+ });
3747
+
3748
+ /**
3749
+ * A skill referenced by ID.
3750
+ */
3751
+ export type SkillReferenceParam = {
3752
+ /**
3753
+ * The ID of the skill to reference.
3754
+ */
3755
+ skill_id: string;
3756
+ /**
3757
+ * An optional specific version to use.
3758
+ */
3759
+ version?: string | null;
3760
+ };
3761
+
3762
+ export type Status = 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete';
3763
+
3764
+ export type StopConfiguration = string | Array<string>;
3765
+
3766
+ export type SummaryPart = SummaryTextContent & {
3767
+ type: 'summary_text';
3768
+ };
3769
+
3770
+ export type SummaryTextContent = {
3771
+ /**
3772
+ * A summary of the reasoning output from the model so far.
3773
+ */
3774
+ text: string;
3775
+ };
3776
+
3777
+ export type TextResponseFormatConfiguration = {
3778
+ type: 'text';
3779
+ } | {
3780
+ type: 'json_object';
3781
+ } | (ResponseFormatJsonSchema & {
3782
+ type: 'json_schema';
3783
+ });
3784
+
3785
+ /**
3786
+ * Definitions for model-callable tools.
3787
+ */
3788
+ export type Tool = (FunctionTool & {
3789
+ type: 'function';
3790
+ }) | (FileSearchTool & {
3791
+ type: 'file_search';
3792
+ }) | (ComputerUsePreviewTool & {
3793
+ type: 'computer_use_preview';
3794
+ }) | (WebSearchTool & {
3795
+ type: 'web_search';
3796
+ }) | (WebSearchTool & {
3797
+ type: 'web_search_2025_08_26';
3798
+ }) | (McpTool & {
3799
+ type: 'mcp';
3800
+ }) | (CodeInterpreterTool & {
3801
+ type: 'code_interpreter';
3802
+ }) | (ImageGenTool & {
3803
+ type: 'image_generation';
3804
+ }) | {
3805
+ type: 'local_shell';
3806
+ } | (FunctionShellToolParam & {
3807
+ type: 'shell';
3808
+ }) | (CustomToolParam & {
3809
+ type: 'custom';
3810
+ }) | (ComputerTool & {
3811
+ type: 'computer';
3812
+ }) | (NamespaceToolParam & {
3813
+ type: 'namespace';
3814
+ }) | (ToolSearchToolParam & {
3815
+ type: 'tool_search';
3816
+ }) | (WebSearchTool & {
3817
+ type: 'web_search_preview';
3818
+ }) | (WebSearchTool & {
3819
+ type: 'web_search_preview_2025_03_11';
3820
+ }) | {
3821
+ type: 'apply_patch';
3822
+ };
3823
+
3824
+ export type ToolChoiceAllowed = {
3825
+ /**
3826
+ * Constrains the tools available to the model to a pre-defined set.
3827
+ *
3828
+ * `auto` allows the model to pick from among the allowed tools and generate a
3829
+ * message.
3830
+ *
3831
+ * `required` requires the model to call one or more of the allowed tools.
3832
+ */
3833
+ mode: ToolChoiceAllowedMode;
3834
+ /**
3835
+ * A list of tool definitions that the model should be allowed to call.
3836
+ *
3837
+ * For the Responses API, the list of tool definitions might look like:
3838
+ * ```json
3839
+ * [
3840
+ * { "type": "function", "name": "get_weather" },
3841
+ * { "type": "mcp", "server_label": "deepwiki" },
3842
+ * { "type": "image_generation" }
3843
+ * ]
3844
+ * ```
3845
+ */
3846
+ tools: Array<{
3847
+ [key: string]: unknown;
3848
+ }>;
3849
+ };
3850
+
3851
+ export type ToolChoiceAllowedMode = 'auto' | 'required';
3852
+
3853
+ export type ToolChoiceCustom = {
3854
+ /**
3855
+ * The name of the custom tool to call.
3856
+ */
3857
+ name: string;
3858
+ };
3859
+
3860
+ export type ToolChoiceFunction = {
3861
+ /**
3862
+ * The name of the function to call.
3863
+ */
3864
+ name: string;
3865
+ };
3866
+
3867
+ export type ToolChoiceMcp = {
3868
+ /**
3869
+ * The name of the tool to call on the server.
3870
+ */
3871
+ name: string;
3872
+ /**
3873
+ * The label of the MCP server to use.
3874
+ */
3875
+ server_label: string;
3876
+ };
3877
+
3878
+ export type ToolChoiceOptions = 'none' | 'auto' | 'required';
3879
+
3880
+ export type ToolChoiceParam = (ToolChoiceAllowed & {
3881
+ type: 'allowed_tools';
3882
+ }) | (ToolChoiceFunction & {
3883
+ type: 'function';
3884
+ }) | (ToolChoiceMcp & {
3885
+ type: 'mcp';
3886
+ }) | (ToolChoiceCustom & {
3887
+ type: 'custom';
3888
+ }) | {
3889
+ type: 'apply_patch';
3890
+ } | {
3891
+ type: 'shell';
3892
+ } | (ToolChoiceTypes & {
3893
+ type: 'hosted';
3894
+ }) | (ToolChoiceOptions & {
3895
+ type: 'mode';
3896
+ });
3897
+
3898
+ /**
3899
+ * The type of hosted tool the model should to use. Learn more about
3900
+ * [built-in tools](https://platform.openai.com/docs/guides/tools).
3901
+ */
3902
+ export type ToolChoiceTypes = {
3903
+ type: 'file_search';
3904
+ } | {
3905
+ type: 'web_search_preview';
3906
+ } | {
3907
+ type: 'computer';
3908
+ } | {
3909
+ type: 'computer_use_preview';
3910
+ } | {
3911
+ type: 'computer_use';
3912
+ } | {
3913
+ type: 'web_search_preview_2025_03_11';
3914
+ } | {
3915
+ type: 'code_interpreter';
3916
+ } | {
3917
+ type: 'image_generation';
3918
+ };
3919
+
3920
+ /**
3921
+ * A tool search call output item.
3922
+ */
3923
+ export type ToolSearchCall = {
3924
+ /**
3925
+ * The unique ID of the tool search call item.
3926
+ */
3927
+ id: string;
3928
+ /**
3929
+ * The unique ID of the tool search call generated by the model.
3930
+ */
3931
+ call_id?: string | null;
3932
+ /**
3933
+ * Whether tool search was executed by the server or by the client.
3934
+ */
3935
+ execution: ToolSearchExecutionType;
3936
+ /**
3937
+ * Arguments used for the tool search call.
3938
+ */
3939
+ arguments: {
3940
+ [key: string]: unknown;
3941
+ };
3942
+ /**
3943
+ * The status of the tool search call item.
3944
+ */
3945
+ status: FunctionCallStatus;
3946
+ /**
3947
+ * The identifier of the actor that created the item.
3948
+ */
3949
+ created_by?: string | null;
3950
+ };
3951
+
3952
+ /**
3953
+ * A tool search call input item.
3954
+ */
3955
+ export type ToolSearchCallItemParam = {
3956
+ /**
3957
+ * The unique ID of this tool search call.
3958
+ */
3959
+ id?: string | null;
3960
+ /**
3961
+ * The unique ID of the tool search call generated by the model.
3962
+ */
3963
+ call_id?: string | null;
3964
+ execution?: null | ToolSearchExecutionType;
3965
+ /**
3966
+ * The arguments supplied to the tool search call.
3967
+ */
3968
+ arguments?: {
3969
+ [key: string]: unknown;
3970
+ };
3971
+ status?: null | OutputStatus;
3972
+ };
3973
+
3974
+ /**
3975
+ * Whether tool search was executed by the server or by the client.
3976
+ */
3977
+ export type ToolSearchExecutionType = 'server' | 'client';
3978
+
3979
+ /**
3980
+ * A tool search output item.
3981
+ */
3982
+ export type ToolSearchOutput = {
3983
+ /**
3984
+ * The unique ID of the tool search output item.
3985
+ */
3986
+ id: string;
3987
+ /**
3988
+ * The unique ID of the tool search call generated by the model.
3989
+ */
3990
+ call_id?: string | null;
3991
+ /**
3992
+ * Whether tool search was executed by the server or by the client.
3993
+ */
3994
+ execution: ToolSearchExecutionType;
3995
+ /**
3996
+ * The loaded tool definitions returned by tool search.
3997
+ */
3998
+ tools: Array<Tool>;
3999
+ /**
4000
+ * The status of the tool search output item.
4001
+ */
4002
+ status: FunctionCallOutputStatusEnum;
4003
+ /**
4004
+ * The identifier of the actor that created the item.
4005
+ */
4006
+ created_by?: string | null;
4007
+ };
4008
+
4009
+ /**
4010
+ * A tool search output input item.
4011
+ */
4012
+ export type ToolSearchOutputItemParam = {
4013
+ /**
4014
+ * The unique ID of this tool search output.
4015
+ */
4016
+ id?: string | null;
4017
+ /**
4018
+ * The unique ID of the tool search call generated by the model.
4019
+ */
4020
+ call_id?: string | null;
4021
+ execution?: null | ToolSearchExecutionType;
4022
+ /**
4023
+ * The loaded tool definitions returned by the tool search output.
4024
+ */
4025
+ tools: Array<Tool>;
4026
+ status?: null | OutputStatus;
4027
+ };
4028
+
4029
+ /**
4030
+ * Hosted or BYOT tool search configuration for deferred tools.
4031
+ */
4032
+ export type ToolSearchToolParam = {
4033
+ execution?: null | ToolSearchExecutionType;
4034
+ /**
4035
+ * Description shown to the model for a client-executed tool search tool.
4036
+ */
4037
+ description?: string | null;
4038
+ /**
4039
+ * Parameter schema for a client-executed tool search tool.
4040
+ */
4041
+ parameters?: {
4042
+ [key: string]: unknown;
4043
+ } | null;
4044
+ };
4045
+
4046
+ export type TopLogProb = {
4047
+ bytes: Array<number>;
4048
+ logprob: number;
4049
+ token: string;
4050
+ };
4051
+
4052
+ export type TopLogprobs = {
4053
+ /**
4054
+ * The token.
4055
+ */
4056
+ token: string;
4057
+ /**
4058
+ * The log probability of this token.
4059
+ */
4060
+ logprob: number;
4061
+ /**
4062
+ * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
4063
+ */
4064
+ bytes?: Array<number> | null;
4065
+ };
4066
+
4067
+ /**
4068
+ * Truncation strategies.
4069
+ */
4070
+ export type Truncation = 'auto' | 'disabled';
4071
+
4072
+ /**
4073
+ * A typing (text entry) action.
4074
+ */
4075
+ export type TypeParam = {
4076
+ /**
4077
+ * The text to type.
4078
+ */
4079
+ text: string;
4080
+ };
4081
+
4082
+ export type UrlCitation = {
4083
+ /**
4084
+ * The index of the last character of the URL citation in the message.
4085
+ */
4086
+ end_index: number;
4087
+ /**
4088
+ * The index of the first character of the URL citation in the message.
4089
+ */
4090
+ start_index: number;
4091
+ /**
4092
+ * The title of the web resource.
4093
+ */
4094
+ title: string;
4095
+ /**
4096
+ * The URL of the web resource.
4097
+ */
4098
+ url: string;
4099
+ };
4100
+
4101
+ export type UrlCitationBody = {
4102
+ /**
4103
+ * The index of the last character of the URL citation in the message.
4104
+ */
4105
+ end_index: number;
4106
+ /**
4107
+ * The index of the first character of the URL citation in the message.
4108
+ */
4109
+ start_index: number;
4110
+ /**
4111
+ * The title of the web resource.
4112
+ */
4113
+ title: string;
4114
+ /**
4115
+ * The URL of the web resource.
4116
+ */
4117
+ url: string;
4118
+ };
4119
+
4120
+ /**
4121
+ * o-series reasoning settings.
4122
+ */
4123
+ export type Verbosity = 'low' | 'medium' | 'high';
4124
+
4125
+ export type WebSearchActionFind = {
4126
+ /**
4127
+ * The URL of the page searched for the pattern.
4128
+ */
4129
+ url: string;
4130
+ /**
4131
+ * The pattern or text to search for within the page.
4132
+ */
4133
+ pattern: string;
4134
+ };
4135
+
4136
+ export type WebSearchActionOpenPage = {
4137
+ /**
4138
+ * The URL opened by the model.
4139
+ */
4140
+ url?: string | null;
4141
+ };
4142
+
4143
+ export type WebSearchActionSearch = {
4144
+ /**
4145
+ * The search query.
4146
+ */
4147
+ query: string;
4148
+ /**
4149
+ * The sources used in the search.
4150
+ */
4151
+ sources?: Array<WebSearchActionSearchSource> | null;
4152
+ };
4153
+
4154
+ export type WebSearchActionSearchSource = {
4155
+ /**
4156
+ * The type of source. Always `url`.
4157
+ */
4158
+ type: string;
4159
+ /**
4160
+ * The URL of the source.
4161
+ */
4162
+ url: string;
4163
+ };
4164
+
4165
+ /**
4166
+ * Approximate user location for web search.
4167
+ */
4168
+ export type WebSearchApproximateLocation = {
4169
+ /**
4170
+ * The type of location approximation. Defaults to `approximate` when omitted in JSON input.
4171
+ */
4172
+ type?: WebSearchApproximateLocationType;
4173
+ /**
4174
+ * Free text input for the city of the user, e.g. `San Francisco`.
4175
+ */
4176
+ city?: string | null;
4177
+ /**
4178
+ * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,
4179
+ * e.g. `US`.
4180
+ */
4181
+ country?: string | null;
4182
+ /**
4183
+ * Free text input for the region of the user, e.g. `California`.
4184
+ */
4185
+ region?: string | null;
4186
+ /**
4187
+ * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g.
4188
+ * `America/Los_Angeles`.
4189
+ */
4190
+ timezone?: string | null;
4191
+ };
4192
+
4193
+ export type WebSearchApproximateLocationType = 'approximate';
4194
+
4195
+ /**
4196
+ * The amount of context window space to use for the search.
4197
+ */
4198
+ export type WebSearchContextSize = 'low' | 'medium' | 'high';
4199
+
4200
+ /**
4201
+ * Approximate location parameters for the search.
4202
+ */
4203
+ export type WebSearchLocation = {
4204
+ /**
4205
+ * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.
4206
+ */
4207
+ country?: string | null;
4208
+ /**
4209
+ * Free text input for the region of the user, e.g. `California`.
4210
+ */
4211
+ region?: string | null;
4212
+ /**
4213
+ * Free text input for the city of the user, e.g. `San Francisco`.
4214
+ */
4215
+ city?: string | null;
4216
+ /**
4217
+ * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.
4218
+ */
4219
+ timezone?: string | null;
4220
+ };
4221
+
4222
+ /**
4223
+ * Options for the web search tool.
4224
+ */
4225
+ export type WebSearchOptions = {
4226
+ search_context_size?: null | WebSearchContextSize;
4227
+ user_location?: null | WebSearchUserLocation;
4228
+ };
4229
+
4230
+ export type WebSearchTool = {
4231
+ filters?: null | WebSearchToolFilters;
4232
+ user_location?: null | WebSearchApproximateLocation;
4233
+ search_context_size?: null | WebSearchToolSearchContextSize;
4234
+ /**
4235
+ * The types of content to search for.
4236
+ */
4237
+ search_content_types?: Array<SearchContentType> | null;
4238
+ };
4239
+
4240
+ /**
4241
+ * Web search tool call output.
4242
+ */
4243
+ export type WebSearchToolCall = {
4244
+ /**
4245
+ * An object describing the specific action taken in this web search call. Includes
4246
+ * details on how the model used the web (search, open_page, find, find_in_page).
4247
+ */
4248
+ action: WebSearchToolCallAction;
4249
+ /**
4250
+ * The unique ID of the web search tool call.
4251
+ */
4252
+ id: string;
4253
+ /**
4254
+ * The status of the web search tool call.
4255
+ */
4256
+ status: WebSearchToolCallStatus;
4257
+ };
4258
+
4259
+ export type WebSearchToolCallAction = (WebSearchActionSearch & {
4260
+ type: 'search';
4261
+ }) | (WebSearchActionOpenPage & {
4262
+ type: 'open_page';
4263
+ }) | (WebSearchActionFind & {
4264
+ type: 'find';
4265
+ }) | (WebSearchActionFind & {
4266
+ type: 'find_in_page';
4267
+ });
4268
+
4269
+ export type WebSearchToolCallStatus = 'in_progress' | 'searching' | 'completed' | 'failed';
4270
+
4271
+ export type WebSearchToolFilters = {
4272
+ /**
4273
+ * Allowed domains for the search. If not provided, all domains are allowed.
4274
+ * Subdomains of the provided domains are allowed as well.
4275
+ *
4276
+ * Example: `["pubmed.ncbi.nlm.nih.gov"]`
4277
+ */
4278
+ allowed_domains?: Array<string> | null;
4279
+ };
4280
+
4281
+ export type WebSearchToolSearchContextSize = 'low' | 'medium' | 'high';
4282
+
4283
+ export type WebSearchUserLocation = {
4284
+ type: WebSearchUserLocationType;
4285
+ approximate: WebSearchLocation;
4286
+ };
4287
+
4288
+ export type WebSearchUserLocationType = 'approximate';
4289
+
4290
+ /**
4291
+ * Wrapper to deserialize the error object nested in "error" JSON key
4292
+ */
4293
+ export type WrappedError = {
4294
+ error: ApiError;
4295
+ };
4296
+
4297
+ export type ChatOllamaModelData = {
4298
+ /**
4299
+ * Chat request in Ollama format
4300
+ */
4301
+ body: ChatRequest;
4302
+ path?: never;
4303
+ query?: never;
4304
+ url: '/api/chat';
4305
+ };
4306
+
4307
+ export type ChatOllamaModelErrors = {
4308
+ /**
4309
+ * Invalid request parameters
4310
+ */
4311
+ 400: WrappedError;
4312
+ /**
4313
+ * Not authenticated
4314
+ */
4315
+ 401: WrappedError;
4316
+ /**
4317
+ * Insufficient permissions
4318
+ */
4319
+ 403: WrappedError;
4320
+ /**
4321
+ * Model not found
4322
+ */
4323
+ 404: OllamaError;
4324
+ /**
4325
+ * Internal server error
4326
+ */
4327
+ 500: WrappedError;
4328
+ };
4329
+
4330
+ export type ChatOllamaModelError = ChatOllamaModelErrors[keyof ChatOllamaModelErrors];
4331
+
4332
+ export type ChatOllamaModelResponses = {
4333
+ /**
4334
+ * Chat response
4335
+ */
4336
+ 200: unknown;
4337
+ };
4338
+
4339
+ export type ShowOllamaModelData = {
4340
+ /**
4341
+ * Model name to get details for
4342
+ */
4343
+ body: ShowRequest;
4344
+ path?: never;
4345
+ query?: never;
4346
+ url: '/api/show';
4347
+ };
4348
+
4349
+ export type ShowOllamaModelErrors = {
4350
+ /**
4351
+ * Invalid request parameters
4352
+ */
4353
+ 400: WrappedError;
4354
+ /**
4355
+ * Not authenticated
4356
+ */
4357
+ 401: WrappedError;
4358
+ /**
4359
+ * Insufficient permissions
4360
+ */
4361
+ 403: WrappedError;
4362
+ /**
4363
+ * Model not found
4364
+ */
4365
+ 404: OllamaError;
4366
+ /**
4367
+ * Internal server error
4368
+ */
4369
+ 500: WrappedError;
4370
+ };
4371
+
4372
+ export type ShowOllamaModelError = ShowOllamaModelErrors[keyof ShowOllamaModelErrors];
4373
+
4374
+ export type ShowOllamaModelResponses = {
4375
+ /**
4376
+ * Model details
4377
+ */
4378
+ 200: ShowResponse;
4379
+ };
4380
+
4381
+ export type ShowOllamaModelResponse = ShowOllamaModelResponses[keyof ShowOllamaModelResponses];
4382
+
4383
+ export type ListOllamaModelsData = {
4384
+ body?: never;
4385
+ path?: never;
4386
+ query?: never;
4387
+ url: '/api/tags';
4388
+ };
4389
+
4390
+ export type ListOllamaModelsErrors = {
4391
+ /**
4392
+ * Invalid request parameters
4393
+ */
4394
+ 400: WrappedError;
4395
+ /**
4396
+ * Not authenticated
4397
+ */
4398
+ 401: WrappedError;
4399
+ /**
4400
+ * Insufficient permissions
4401
+ */
4402
+ 403: WrappedError;
4403
+ /**
4404
+ * Internal server error
4405
+ */
4406
+ 500: WrappedError;
4407
+ };
4408
+
4409
+ export type ListOllamaModelsError = ListOllamaModelsErrors[keyof ListOllamaModelsErrors];
4410
+
4411
+ export type ListOllamaModelsResponses = {
4412
+ /**
4413
+ * List of available models
4414
+ */
4415
+ 200: ModelsResponse;
4416
+ };
4417
+
4418
+ export type ListOllamaModelsResponse = ListOllamaModelsResponses[keyof ListOllamaModelsResponses];
4419
+
4420
+ export type CreateChatCompletionData = {
4421
+ body: CreateChatCompletionRequest;
4422
+ path?: never;
4423
+ query?: never;
4424
+ url: '/v1/chat/completions';
4425
+ };
4426
+
4427
+ export type CreateChatCompletionErrors = {
4428
+ /**
4429
+ * Invalid request parameters
4430
+ */
4431
+ 400: WrappedError;
4432
+ /**
4433
+ * Not authenticated
4434
+ */
4435
+ 401: WrappedError;
4436
+ /**
4437
+ * Insufficient permissions
4438
+ */
4439
+ 403: WrappedError;
4440
+ /**
4441
+ * Internal server error
4442
+ */
4443
+ 500: WrappedError;
4444
+ };
4445
+
4446
+ export type CreateChatCompletionError = CreateChatCompletionErrors[keyof CreateChatCompletionErrors];
4447
+
4448
+ export type CreateChatCompletionResponses = {
4449
+ /**
4450
+ * Chat completion response
4451
+ */
4452
+ 200: CreateChatCompletionResponse;
4453
+ /**
4454
+ * Chat completion stream, the status is 200, using 201 to avoid OpenAPI format limitation.
4455
+ */
4456
+ 201: CreateChatCompletionStreamResponse;
4457
+ };
4458
+
4459
+ export type CreateChatCompletionResponse2 = CreateChatCompletionResponses[keyof CreateChatCompletionResponses];
4460
+
4461
+ export type CreateEmbeddingData = {
4462
+ body: CreateEmbeddingRequest;
4463
+ path?: never;
4464
+ query?: never;
4465
+ url: '/v1/embeddings';
4466
+ };
4467
+
4468
+ export type CreateEmbeddingErrors = {
4469
+ /**
4470
+ * Invalid request parameters
4471
+ */
4472
+ 400: WrappedError;
4473
+ /**
4474
+ * Not authenticated
4475
+ */
4476
+ 401: WrappedError;
4477
+ /**
4478
+ * Insufficient permissions
4479
+ */
4480
+ 403: WrappedError;
4481
+ /**
4482
+ * Internal server error
4483
+ */
4484
+ 500: WrappedError;
4485
+ };
4486
+
4487
+ export type CreateEmbeddingError = CreateEmbeddingErrors[keyof CreateEmbeddingErrors];
4488
+
4489
+ export type CreateEmbeddingResponses = {
4490
+ /**
4491
+ * Embedding response
4492
+ */
4493
+ 200: CreateEmbeddingResponse;
4494
+ };
4495
+
4496
+ export type CreateEmbeddingResponse2 = CreateEmbeddingResponses[keyof CreateEmbeddingResponses];
4497
+
4498
+ export type ListModelsData = {
4499
+ body?: never;
4500
+ path?: never;
4501
+ query?: never;
4502
+ url: '/v1/models';
4503
+ };
4504
+
4505
+ export type ListModelsErrors = {
4506
+ /**
4507
+ * Invalid request parameters
4508
+ */
4509
+ 400: WrappedError;
4510
+ /**
4511
+ * Not authenticated
4512
+ */
4513
+ 401: WrappedError;
4514
+ /**
4515
+ * Insufficient permissions
4516
+ */
4517
+ 403: WrappedError;
4518
+ /**
4519
+ * Internal server error
4520
+ */
4521
+ 500: WrappedError;
4522
+ };
4523
+
4524
+ export type ListModelsError = ListModelsErrors[keyof ListModelsErrors];
4525
+
4526
+ export type ListModelsResponses = {
4527
+ /**
4528
+ * List of available models
4529
+ */
4530
+ 200: ListModelResponse;
4531
+ };
4532
+
4533
+ export type ListModelsResponse = ListModelsResponses[keyof ListModelsResponses];
4534
+
4535
+ export type GetModelData = {
4536
+ body?: never;
4537
+ path: {
4538
+ /**
4539
+ * Model identifier - can be user alias (e.g., 'llama2:chat'), model alias, or API provider alias
4540
+ */
4541
+ id: string;
4542
+ };
4543
+ query?: never;
4544
+ url: '/v1/models/{id}';
4545
+ };
4546
+
4547
+ export type GetModelErrors = {
4548
+ /**
4549
+ * Invalid request parameters
4550
+ */
4551
+ 400: WrappedError;
4552
+ /**
4553
+ * Not authenticated
4554
+ */
4555
+ 401: WrappedError;
4556
+ /**
4557
+ * Insufficient permissions
4558
+ */
4559
+ 403: WrappedError;
4560
+ /**
4561
+ * Model not found
4562
+ */
4563
+ 404: WrappedError;
4564
+ /**
4565
+ * Internal server error
4566
+ */
4567
+ 500: WrappedError;
4568
+ };
4569
+
4570
+ export type GetModelError = GetModelErrors[keyof GetModelErrors];
4571
+
4572
+ export type GetModelResponses = {
4573
+ /**
4574
+ * Model details
4575
+ */
4576
+ 200: Model;
4577
+ };
4578
+
4579
+ export type GetModelResponse = GetModelResponses[keyof GetModelResponses];
4580
+
4581
+ export type CreateResponseData = {
4582
+ body: CreateResponse;
4583
+ path?: never;
4584
+ query?: never;
4585
+ url: '/v1/responses';
4586
+ };
4587
+
4588
+ export type CreateResponseErrors = {
4589
+ /**
4590
+ * Invalid request parameters
4591
+ */
4592
+ 400: WrappedError;
4593
+ /**
4594
+ * Not authenticated
4595
+ */
4596
+ 401: WrappedError;
4597
+ /**
4598
+ * Insufficient permissions
4599
+ */
4600
+ 403: WrappedError;
4601
+ /**
4602
+ * Internal server error
4603
+ */
4604
+ 500: WrappedError;
4605
+ };
4606
+
4607
+ export type CreateResponseError = CreateResponseErrors[keyof CreateResponseErrors];
4608
+
4609
+ export type CreateResponseResponses = {
4610
+ /**
4611
+ * Response created
4612
+ */
4613
+ 200: Response;
4614
+ /**
4615
+ * Response stream (actual status is 200, using 201 to avoid OpenAPI limitation).
4616
+ */
4617
+ 201: unknown;
4618
+ };
4619
+
4620
+ export type CreateResponseResponse = CreateResponseResponses[keyof CreateResponseResponses];
4621
+
4622
+ export type DeleteResponseData = {
4623
+ body?: never;
4624
+ path: {
4625
+ /**
4626
+ * The response ID
4627
+ */
4628
+ response_id: string;
4629
+ };
4630
+ query: {
4631
+ /**
4632
+ * Model name for routing to the correct upstream provider
4633
+ */
4634
+ model: string;
4635
+ };
4636
+ url: '/v1/responses/{response_id}';
4637
+ };
4638
+
4639
+ export type DeleteResponseErrors = {
4640
+ /**
4641
+ * Invalid request parameters
4642
+ */
4643
+ 400: WrappedError;
4644
+ /**
4645
+ * Not authenticated
4646
+ */
4647
+ 401: WrappedError;
4648
+ /**
4649
+ * Insufficient permissions
4650
+ */
4651
+ 403: WrappedError;
4652
+ /**
4653
+ * Internal server error
4654
+ */
4655
+ 500: WrappedError;
4656
+ };
4657
+
4658
+ export type DeleteResponseError = DeleteResponseErrors[keyof DeleteResponseErrors];
4659
+
4660
+ export type DeleteResponseResponses = {
4661
+ /**
4662
+ * Response deleted
4663
+ */
4664
+ 200: DeleteResponse;
4665
+ };
4666
+
4667
+ export type DeleteResponseResponse = DeleteResponseResponses[keyof DeleteResponseResponses];
4668
+
4669
+ export type GetResponseData = {
4670
+ body?: never;
4671
+ path: {
4672
+ /**
4673
+ * The response ID
4674
+ */
4675
+ response_id: string;
4676
+ };
4677
+ query: {
4678
+ /**
4679
+ * Model name for routing to the correct upstream provider
4680
+ */
4681
+ model: string;
4682
+ };
4683
+ url: '/v1/responses/{response_id}';
4684
+ };
4685
+
4686
+ export type GetResponseErrors = {
4687
+ /**
4688
+ * Invalid request parameters
4689
+ */
4690
+ 400: WrappedError;
4691
+ /**
4692
+ * Not authenticated
4693
+ */
4694
+ 401: WrappedError;
4695
+ /**
4696
+ * Insufficient permissions
4697
+ */
4698
+ 403: WrappedError;
4699
+ /**
4700
+ * Internal server error
4701
+ */
4702
+ 500: WrappedError;
4703
+ };
4704
+
4705
+ export type GetResponseError = GetResponseErrors[keyof GetResponseErrors];
4706
+
4707
+ export type GetResponseResponses = {
4708
+ /**
4709
+ * Response retrieved
4710
+ */
4711
+ 200: Response;
4712
+ };
4713
+
4714
+ export type GetResponseResponse = GetResponseResponses[keyof GetResponseResponses];
4715
+
4716
+ export type CancelResponseData = {
4717
+ body?: never;
4718
+ path: {
4719
+ /**
4720
+ * The response ID
4721
+ */
4722
+ response_id: string;
4723
+ };
4724
+ query: {
4725
+ /**
4726
+ * Model name for routing to the correct upstream provider
4727
+ */
4728
+ model: string;
4729
+ };
4730
+ url: '/v1/responses/{response_id}/cancel';
4731
+ };
4732
+
4733
+ export type CancelResponseErrors = {
4734
+ /**
4735
+ * Invalid request parameters
4736
+ */
4737
+ 400: WrappedError;
4738
+ /**
4739
+ * Not authenticated
4740
+ */
4741
+ 401: WrappedError;
4742
+ /**
4743
+ * Insufficient permissions
4744
+ */
4745
+ 403: WrappedError;
4746
+ /**
4747
+ * Internal server error
4748
+ */
4749
+ 500: WrappedError;
4750
+ };
4751
+
4752
+ export type CancelResponseError = CancelResponseErrors[keyof CancelResponseErrors];
4753
+
4754
+ export type CancelResponseResponses = {
4755
+ /**
4756
+ * Response cancelled
4757
+ */
4758
+ 200: Response;
4759
+ };
4760
+
4761
+ export type CancelResponseResponse = CancelResponseResponses[keyof CancelResponseResponses];
4762
+
4763
+ export type ListResponseInputItemsData = {
4764
+ body?: never;
4765
+ path: {
4766
+ /**
4767
+ * The response ID
4768
+ */
4769
+ response_id: string;
4770
+ };
4771
+ query: {
4772
+ /**
4773
+ * Model name for routing to the correct upstream provider
4774
+ */
4775
+ model: string;
4776
+ };
4777
+ url: '/v1/responses/{response_id}/input_items';
4778
+ };
4779
+
4780
+ export type ListResponseInputItemsErrors = {
4781
+ /**
4782
+ * Invalid request parameters
4783
+ */
4784
+ 400: WrappedError;
4785
+ /**
4786
+ * Not authenticated
4787
+ */
4788
+ 401: WrappedError;
4789
+ /**
4790
+ * Insufficient permissions
4791
+ */
4792
+ 403: WrappedError;
4793
+ /**
4794
+ * Internal server error
4795
+ */
4796
+ 500: WrappedError;
4797
+ };
4798
+
4799
+ export type ListResponseInputItemsError = ListResponseInputItemsErrors[keyof ListResponseInputItemsErrors];
4800
+
4801
+ export type ListResponseInputItemsResponses = {
4802
+ /**
4803
+ * Input items retrieved
4804
+ */
4805
+ 200: unknown;
4806
+ };
4807
+
4808
+ export type ClientOptions = {
4809
+ baseUrl: 'http://localhost:1135' | (string & {});
4810
+ };