ruby/resources/responses/subresources/input_tokens/index.md +0 −3471 deleted
File Deleted View Diff
1# Input Tokens
2
3## Get input token counts
4
5`responses.input_tokens.count(**kwargs) -> InputTokenCountResponse`
6
7**post** `/responses/input_tokens`
8
9Returns input token counts of the request.
10
11Returns an object with `object` set to `response.input_tokens` and an `input_tokens` count.
12
13### Parameters
14
15- `conversation: String | ResponseConversationParam`
16
17 The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.
18 Input items and output items from this response are automatically added to this conversation after this response completes.
19
20 - `String = String`
21
22 The unique ID of the conversation.
23
24 - `class ResponseConversationParam`
25
26 The conversation that this response belongs to.
27
28 - `id: String`
29
30 The unique ID of the conversation.
31
32- `input: String | Array[ResponseInputItem]`
33
34 Text, image, or file inputs to the model, used to generate a response
35
36 - `String = String`
37
38 A text input to the model, equivalent to a text input with the `user` role.
39
40 - `UnionMember1 = Array[ResponseInputItem]`
41
42 A list of one or many input items to the model, containing different content types.
43
44 - `class EasyInputMessage`
45
46 A message input to the model with a role indicating instruction following
47 hierarchy. Instructions given with the `developer` or `system` role take
48 precedence over instructions given with the `user` role. Messages with the
49 `assistant` role are presumed to have been generated by the model in previous
50 interactions.
51
52 - `content: String | ResponseInputMessageContentList`
53
54 Text, image, or audio input to the model, used to generate a response.
55 Can also contain previous assistant responses.
56
57 - `String = String`
58
59 A text input to the model.
60
61 - `ResponseInputMessageContentList = Array[ResponseInputContent]`
62
63 A list of one or many input items to the model, containing different content
64 types.
65
66 - `class ResponseInputText`
67
68 A text input to the model.
69
70 - `text: String`
71
72 The text input to the model.
73
74 - `type: :input_text`
75
76 The type of the input item. Always `input_text`.
77
78 - `:input_text`
79
80 - `class ResponseInputImage`
81
82 An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
83
84 - `detail: :low | :high | :auto | :original`
85
86 The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.
87
88 - `:low`
89
90 - `:high`
91
92 - `:auto`
93
94 - `:original`
95
96 - `type: :input_image`
97
98 The type of the input item. Always `input_image`.
99
100 - `:input_image`
101
102 - `file_id: String`
103
104 The ID of the file to be sent to the model.
105
106 - `image_url: String`
107
108 The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
109
110 - `class ResponseInputFile`
111
112 A file input to the model.
113
114 - `type: :input_file`
115
116 The type of the input item. Always `input_file`.
117
118 - `:input_file`
119
120 - `detail: :low | :high`
121
122 The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`.
123
124 - `:low`
125
126 - `:high`
127
128 - `file_data: String`
129
130 The content of the file to be sent to the model.
131
132 - `file_id: String`
133
134 The ID of the file to be sent to the model.
135
136 - `file_url: String`
137
138 The URL of the file to be sent to the model.
139
140 - `filename: String`
141
142 The name of the file to be sent to the model.
143
144 - `role: :user | :assistant | :system | :developer`
145
146 The role of the message input. One of `user`, `assistant`, `system`, or
147 `developer`.
148
149 - `:user`
150
151 - `:assistant`
152
153 - `:system`
154
155 - `:developer`
156
157 - `phase: :commentary | :final_answer`
158
159 Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`).
160 For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend
161 phase on all assistant messages — dropping it can degrade performance. Not used for user messages.
162
163 - `:commentary`
164
165 - `:final_answer`
166
167 - `type: :message`
168
169 The type of the message input. Always `message`.
170
171 - `:message`
172
173 - `class Message`
174
175 A message input to the model with a role indicating instruction following
176 hierarchy. Instructions given with the `developer` or `system` role take
177 precedence over instructions given with the `user` role.
178
179 - `content: ResponseInputMessageContentList`
180
181 A list of one or many input items to the model, containing different content
182 types.
183
184 - `role: :user | :system | :developer`
185
186 The role of the message input. One of `user`, `system`, or `developer`.
187
188 - `:user`
189
190 - `:system`
191
192 - `:developer`
193
194 - `status: :in_progress | :completed | :incomplete`
195
196 The status of item. One of `in_progress`, `completed`, or
197 `incomplete`. Populated when items are returned via API.
198
199 - `:in_progress`
200
201 - `:completed`
202
203 - `:incomplete`
204
205 - `type: :message`
206
207 The type of the message input. Always set to `message`.
208
209 - `:message`
210
211 - `class ResponseOutputMessage`
212
213 An output message from the model.
214
215 - `id: String`
216
217 The unique ID of the output message.
218
219 - `content: Array[ResponseOutputText | ResponseOutputRefusal]`
220
221 The content of the output message.
222
223 - `class ResponseOutputText`
224
225 A text output from the model.
226
227 - `annotations: Array[FileCitation{ file_id, filename, index, type} | URLCitation{ end_index, start_index, title, 2 more} | ContainerFileCitation{ container_id, end_index, file_id, 3 more} | FilePath{ file_id, index, type}]`
228
229 The annotations of the text output.
230
231 - `class FileCitation`
232
233 A citation to a file.
234
235 - `file_id: String`
236
237 The ID of the file.
238
239 - `filename: String`
240
241 The filename of the file cited.
242
243 - `index: Integer`
244
245 The index of the file in the list of files.
246
247 - `type: :file_citation`
248
249 The type of the file citation. Always `file_citation`.
250
251 - `:file_citation`
252
253 - `class URLCitation`
254
255 A citation for a web resource used to generate a model response.
256
257 - `end_index: Integer`
258
259 The index of the last character of the URL citation in the message.
260
261 - `start_index: Integer`
262
263 The index of the first character of the URL citation in the message.
264
265 - `title: String`
266
267 The title of the web resource.
268
269 - `type: :url_citation`
270
271 The type of the URL citation. Always `url_citation`.
272
273 - `:url_citation`
274
275 - `url: String`
276
277 The URL of the web resource.
278
279 - `class ContainerFileCitation`
280
281 A citation for a container file used to generate a model response.
282
283 - `container_id: String`
284
285 The ID of the container file.
286
287 - `end_index: Integer`
288
289 The index of the last character of the container file citation in the message.
290
291 - `file_id: String`
292
293 The ID of the file.
294
295 - `filename: String`
296
297 The filename of the container file cited.
298
299 - `start_index: Integer`
300
301 The index of the first character of the container file citation in the message.
302
303 - `type: :container_file_citation`
304
305 The type of the container file citation. Always `container_file_citation`.
306
307 - `:container_file_citation`
308
309 - `class FilePath`
310
311 A path to a file.
312
313 - `file_id: String`
314
315 The ID of the file.
316
317 - `index: Integer`
318
319 The index of the file in the list of files.
320
321 - `type: :file_path`
322
323 The type of the file path. Always `file_path`.
324
325 - `:file_path`
326
327 - `text: String`
328
329 The text output from the model.
330
331 - `type: :output_text`
332
333 The type of the output text. Always `output_text`.
334
335 - `:output_text`
336
337 - `logprobs: Array[Logprob{ token, bytes, logprob, top_logprobs}]`
338
339 - `token: String`
340
341 - `bytes: Array[Integer]`
342
343 - `logprob: Float`
344
345 - `top_logprobs: Array[TopLogprob{ token, bytes, logprob}]`
346
347 - `token: String`
348
349 - `bytes: Array[Integer]`
350
351 - `logprob: Float`
352
353 - `class ResponseOutputRefusal`
354
355 A refusal from the model.
356
357 - `refusal: String`
358
359 The refusal explanation from the model.
360
361 - `type: :refusal`
362
363 The type of the refusal. Always `refusal`.
364
365 - `:refusal`
366
367 - `role: :assistant`
368
369 The role of the output message. Always `assistant`.
370
371 - `:assistant`
372
373 - `status: :in_progress | :completed | :incomplete`
374
375 The status of the message input. One of `in_progress`, `completed`, or
376 `incomplete`. Populated when input items are returned via API.
377
378 - `:in_progress`
379
380 - `:completed`
381
382 - `:incomplete`
383
384 - `type: :message`
385
386 The type of the output message. Always `message`.
387
388 - `:message`
389
390 - `phase: :commentary | :final_answer`
391
392 Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`).
393 For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend
394 phase on all assistant messages — dropping it can degrade performance. Not used for user messages.
395
396 - `:commentary`
397
398 - `:final_answer`
399
400 - `class ResponseFileSearchToolCall`
401
402 The results of a file search tool call. See the
403 [file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.
404
405 - `id: String`
406
407 The unique ID of the file search tool call.
408
409 - `queries: Array[String]`
410
411 The queries used to search for files.
412
413 - `status: :in_progress | :searching | :completed | 2 more`
414
415 The status of the file search tool call. One of `in_progress`,
416 `searching`, `incomplete` or `failed`,
417
418 - `:in_progress`
419
420 - `:searching`
421
422 - `:completed`
423
424 - `:incomplete`
425
426 - `:failed`
427
428 - `type: :file_search_call`
429
430 The type of the file search tool call. Always `file_search_call`.
431
432 - `:file_search_call`
433
434 - `results: Array[Result{ attributes, file_id, filename, 2 more}]`
435
436 The results of the file search tool call.
437
438 - `attributes: Hash[Symbol, String | Float | bool]`
439
440 Set of 16 key-value pairs that can be attached to an object. This can be
441 useful for storing additional information about the object in a structured
442 format, and querying for objects via API or the dashboard. Keys are strings
443 with a maximum length of 64 characters. Values are strings with a maximum
444 length of 512 characters, booleans, or numbers.
445
446 - `String = String`
447
448 - `Float = Float`
449
450 - `UnionMember2 = bool`
451
452 - `file_id: String`
453
454 The unique ID of the file.
455
456 - `filename: String`
457
458 The name of the file.
459
460 - `score: Float`
461
462 The relevance score of the file - a value between 0 and 1.
463
464 - `text: String`
465
466 The text that was retrieved from the file.
467
468 - `class ResponseComputerToolCall`
469
470 A tool call to a computer use tool. See the
471 [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.
472
473 - `id: String`
474
475 The unique ID of the computer call.
476
477 - `call_id: String`
478
479 An identifier used when responding to the tool call with output.
480
481 - `pending_safety_checks: Array[PendingSafetyCheck{ id, code, message}]`
482
483 The pending safety checks for the computer call.
484
485 - `id: String`
486
487 The ID of the pending safety check.
488
489 - `code: String`
490
491 The type of the pending safety check.
492
493 - `message: String`
494
495 Details about the pending safety check.
496
497 - `status: :in_progress | :completed | :incomplete`
498
499 The status of the item. One of `in_progress`, `completed`, or
500 `incomplete`. Populated when items are returned via API.
501
502 - `:in_progress`
503
504 - `:completed`
505
506 - `:incomplete`
507
508 - `type: :computer_call`
509
510 The type of the computer call. Always `computer_call`.
511
512 - `:computer_call`
513
514 - `action: Click{ button, type, x, 2 more} | DoubleClick{ keys, type, x, y_} | Drag{ path, type, keys} | 6 more`
515
516 A click action.
517
518 - `class Click`
519
520 A click action.
521
522 - `button: :left | :right | :wheel | 2 more`
523
524 Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.
525
526 - `:left`
527
528 - `:right`
529
530 - `:wheel`
531
532 - `:back`
533
534 - `:forward`
535
536 - `type: :click`
537
538 Specifies the event type. For a click action, this property is always `click`.
539
540 - `:click`
541
542 - `x: Integer`
543
544 The x-coordinate where the click occurred.
545
546 - `y_: Integer`
547
548 The y-coordinate where the click occurred.
549
550 - `keys: Array[String]`
551
552 The keys being held while clicking.
553
554 - `class DoubleClick`
555
556 A double click action.
557
558 - `keys: Array[String]`
559
560 The keys being held while double-clicking.
561
562 - `type: :double_click`
563
564 Specifies the event type. For a double click action, this property is always set to `double_click`.
565
566 - `:double_click`
567
568 - `x: Integer`
569
570 The x-coordinate where the double click occurred.
571
572 - `y_: Integer`
573
574 The y-coordinate where the double click occurred.
575
576 - `class Drag`
577
578 A drag action.
579
580 - `path: Array[Path{ x, y_}]`
581
582 An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg
583
584 ```
585 [
586 { x: 100, y: 200 },
587 { x: 200, y: 300 }
588 ]
589 ```
590
591 - `x: Integer`
592
593 The x-coordinate.
594
595 - `y_: Integer`
596
597 The y-coordinate.
598
599 - `type: :drag`
600
601 Specifies the event type. For a drag action, this property is always set to `drag`.
602
603 - `:drag`
604
605 - `keys: Array[String]`
606
607 The keys being held while dragging the mouse.
608
609 - `class Keypress`
610
611 A collection of keypresses the model would like to perform.
612
613 - `keys: Array[String]`
614
615 The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.
616
617 - `type: :keypress`
618
619 Specifies the event type. For a keypress action, this property is always set to `keypress`.
620
621 - `:keypress`
622
623 - `class Move`
624
625 A mouse move action.
626
627 - `type: :move`
628
629 Specifies the event type. For a move action, this property is always set to `move`.
630
631 - `:move`
632
633 - `x: Integer`
634
635 The x-coordinate to move to.
636
637 - `y_: Integer`
638
639 The y-coordinate to move to.
640
641 - `keys: Array[String]`
642
643 The keys being held while moving the mouse.
644
645 - `class Screenshot`
646
647 A screenshot action.
648
649 - `type: :screenshot`
650
651 Specifies the event type. For a screenshot action, this property is always set to `screenshot`.
652
653 - `:screenshot`
654
655 - `class Scroll`
656
657 A scroll action.
658
659 - `scroll_x: Integer`
660
661 The horizontal scroll distance.
662
663 - `scroll_y: Integer`
664
665 The vertical scroll distance.
666
667 - `type: :scroll`
668
669 Specifies the event type. For a scroll action, this property is always set to `scroll`.
670
671 - `:scroll`
672
673 - `x: Integer`
674
675 The x-coordinate where the scroll occurred.
676
677 - `y_: Integer`
678
679 The y-coordinate where the scroll occurred.
680
681 - `keys: Array[String]`
682
683 The keys being held while scrolling.
684
685 - `class Type`
686
687 An action to type in text.
688
689 - `text: String`
690
691 The text to type.
692
693 - `type: :type`
694
695 Specifies the event type. For a type action, this property is always set to `type`.
696
697 - `:type`
698
699 - `class Wait`
700
701 A wait action.
702
703 - `type: :wait`
704
705 Specifies the event type. For a wait action, this property is always set to `wait`.
706
707 - `:wait`
708
709 - `actions: ComputerActionList`
710
711 Flattened batched actions for `computer_use`. Each action includes an
712 `type` discriminator and action-specific fields.
713
714 - `class Click`
715
716 A click action.
717
718 - `button: :left | :right | :wheel | 2 more`
719
720 Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.
721
722 - `:left`
723
724 - `:right`
725
726 - `:wheel`
727
728 - `:back`
729
730 - `:forward`
731
732 - `type: :click`
733
734 Specifies the event type. For a click action, this property is always `click`.
735
736 - `:click`
737
738 - `x: Integer`
739
740 The x-coordinate where the click occurred.
741
742 - `y_: Integer`
743
744 The y-coordinate where the click occurred.
745
746 - `keys: Array[String]`
747
748 The keys being held while clicking.
749
750 - `class DoubleClick`
751
752 A double click action.
753
754 - `keys: Array[String]`
755
756 The keys being held while double-clicking.
757
758 - `type: :double_click`
759
760 Specifies the event type. For a double click action, this property is always set to `double_click`.
761
762 - `:double_click`
763
764 - `x: Integer`
765
766 The x-coordinate where the double click occurred.
767
768 - `y_: Integer`
769
770 The y-coordinate where the double click occurred.
771
772 - `class Drag`
773
774 A drag action.
775
776 - `path: Array[Path{ x, y_}]`
777
778 An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg
779
780 ```
781 [
782 { x: 100, y: 200 },
783 { x: 200, y: 300 }
784 ]
785 ```
786
787 - `x: Integer`
788
789 The x-coordinate.
790
791 - `y_: Integer`
792
793 The y-coordinate.
794
795 - `type: :drag`
796
797 Specifies the event type. For a drag action, this property is always set to `drag`.
798
799 - `:drag`
800
801 - `keys: Array[String]`
802
803 The keys being held while dragging the mouse.
804
805 - `class Keypress`
806
807 A collection of keypresses the model would like to perform.
808
809 - `keys: Array[String]`
810
811 The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.
812
813 - `type: :keypress`
814
815 Specifies the event type. For a keypress action, this property is always set to `keypress`.
816
817 - `:keypress`
818
819 - `class Move`
820
821 A mouse move action.
822
823 - `type: :move`
824
825 Specifies the event type. For a move action, this property is always set to `move`.
826
827 - `:move`
828
829 - `x: Integer`
830
831 The x-coordinate to move to.
832
833 - `y_: Integer`
834
835 The y-coordinate to move to.
836
837 - `keys: Array[String]`
838
839 The keys being held while moving the mouse.
840
841 - `class Screenshot`
842
843 A screenshot action.
844
845 - `type: :screenshot`
846
847 Specifies the event type. For a screenshot action, this property is always set to `screenshot`.
848
849 - `:screenshot`
850
851 - `class Scroll`
852
853 A scroll action.
854
855 - `scroll_x: Integer`
856
857 The horizontal scroll distance.
858
859 - `scroll_y: Integer`
860
861 The vertical scroll distance.
862
863 - `type: :scroll`
864
865 Specifies the event type. For a scroll action, this property is always set to `scroll`.
866
867 - `:scroll`
868
869 - `x: Integer`
870
871 The x-coordinate where the scroll occurred.
872
873 - `y_: Integer`
874
875 The y-coordinate where the scroll occurred.
876
877 - `keys: Array[String]`
878
879 The keys being held while scrolling.
880
881 - `class Type`
882
883 An action to type in text.
884
885 - `text: String`
886
887 The text to type.
888
889 - `type: :type`
890
891 Specifies the event type. For a type action, this property is always set to `type`.
892
893 - `:type`
894
895 - `class Wait`
896
897 A wait action.
898
899 - `type: :wait`
900
901 Specifies the event type. For a wait action, this property is always set to `wait`.
902
903 - `:wait`
904
905 - `class ComputerCallOutput`
906
907 The output of a computer tool call.
908
909 - `call_id: String`
910
911 The ID of the computer tool call that produced the output.
912
913 - `output: ResponseComputerToolCallOutputScreenshot`
914
915 A computer screenshot image used with the computer use tool.
916
917 - `type: :computer_screenshot`
918
919 Specifies the event type. For a computer screenshot, this property is
920 always set to `computer_screenshot`.
921
922 - `:computer_screenshot`
923
924 - `file_id: String`
925
926 The identifier of an uploaded file that contains the screenshot.
927
928 - `image_url: String`
929
930 The URL of the screenshot image.
931
932 - `type: :computer_call_output`
933
934 The type of the computer tool call output. Always `computer_call_output`.
935
936 - `:computer_call_output`
937
938 - `id: String`
939
940 The ID of the computer tool call output.
941
942 - `acknowledged_safety_checks: Array[AcknowledgedSafetyCheck{ id, code, message}]`
943
944 The safety checks reported by the API that have been acknowledged by the developer.
945
946 - `id: String`
947
948 The ID of the pending safety check.
949
950 - `code: String`
951
952 The type of the pending safety check.
953
954 - `message: String`
955
956 Details about the pending safety check.
957
958 - `status: :in_progress | :completed | :incomplete`
959
960 The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.
961
962 - `:in_progress`
963
964 - `:completed`
965
966 - `:incomplete`
967
968 - `class ResponseFunctionWebSearch`
969
970 The results of a web search tool call. See the
971 [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.
972
973 - `id: String`
974
975 The unique ID of the web search tool call.
976
977 - `action: Search{ query, type, queries, sources} | OpenPage{ type, url} | FindInPage{ pattern, type, url}`
978
979 An object describing the specific action taken in this web search call.
980 Includes details on how the model used the web (search, open_page, find_in_page).
981
982 - `class Search`
983
984 Action type "search" - Performs a web search query.
985
986 - `query: String`
987
988 [DEPRECATED] The search query.
989
990 - `type: :search`
991
992 The action type.
993
994 - `:search`
995
996 - `queries: Array[String]`
997
998 The search queries.
999
1000 - `sources: Array[Source{ type, url}]`
1001
1002 The sources used in the search.
1003
1004 - `type: :url`
1005
1006 The type of source. Always `url`.
1007
1008 - `:url`
1009
1010 - `url: String`
1011
1012 The URL of the source.
1013
1014 - `class OpenPage`
1015
1016 Action type "open_page" - Opens a specific URL from search results.
1017
1018 - `type: :open_page`
1019
1020 The action type.
1021
1022 - `:open_page`
1023
1024 - `url: String`
1025
1026 The URL opened by the model.
1027
1028 - `class FindInPage`
1029
1030 Action type "find_in_page": Searches for a pattern within a loaded page.
1031
1032 - `pattern: String`
1033
1034 The pattern or text to search for within the page.
1035
1036 - `type: :find_in_page`
1037
1038 The action type.
1039
1040 - `:find_in_page`
1041
1042 - `url: String`
1043
1044 The URL of the page searched for the pattern.
1045
1046 - `status: :in_progress | :searching | :completed | :failed`
1047
1048 The status of the web search tool call.
1049
1050 - `:in_progress`
1051
1052 - `:searching`
1053
1054 - `:completed`
1055
1056 - `:failed`
1057
1058 - `type: :web_search_call`
1059
1060 The type of the web search tool call. Always `web_search_call`.
1061
1062 - `:web_search_call`
1063
1064 - `class ResponseFunctionToolCall`
1065
1066 A tool call to run a function. See the
1067 [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.
1068
1069 - `arguments: String`
1070
1071 A JSON string of the arguments to pass to the function.
1072
1073 - `call_id: String`
1074
1075 The unique ID of the function tool call generated by the model.
1076
1077 - `name: String`
1078
1079 The name of the function to run.
1080
1081 - `type: :function_call`
1082
1083 The type of the function tool call. Always `function_call`.
1084
1085 - `:function_call`
1086
1087 - `id: String`
1088
1089 The unique ID of the function tool call.
1090
1091 - `namespace: String`
1092
1093 The namespace of the function to run.
1094
1095 - `status: :in_progress | :completed | :incomplete`
1096
1097 The status of the item. One of `in_progress`, `completed`, or
1098 `incomplete`. Populated when items are returned via API.
1099
1100 - `:in_progress`
1101
1102 - `:completed`
1103
1104 - `:incomplete`
1105
1106 - `class FunctionCallOutput`
1107
1108 The output of a function tool call.
1109
1110 - `call_id: String`
1111
1112 The unique ID of the function tool call generated by the model.
1113
1114 - `output: String | ResponseFunctionCallOutputItemList`
1115
1116 Text, image, or file output of the function tool call.
1117
1118 - `String = String`
1119
1120 A JSON string of the output of the function tool call.
1121
1122 - `ResponseFunctionCallOutputItemList = Array[ResponseFunctionCallOutputItem]`
1123
1124 An array of content outputs (text, image, file) for the function tool call.
1125
1126 - `class ResponseInputTextContent`
1127
1128 A text input to the model.
1129
1130 - `text: String`
1131
1132 The text input to the model.
1133
1134 - `type: :input_text`
1135
1136 The type of the input item. Always `input_text`.
1137
1138 - `:input_text`
1139
1140 - `class ResponseInputImageContent`
1141
1142 An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision)
1143
1144 - `type: :input_image`
1145
1146 The type of the input item. Always `input_image`.
1147
1148 - `:input_image`
1149
1150 - `detail: :low | :high | :auto | :original`
1151
1152 The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.
1153
1154 - `:low`
1155
1156 - `:high`
1157
1158 - `:auto`
1159
1160 - `:original`
1161
1162 - `file_id: String`
1163
1164 The ID of the file to be sent to the model.
1165
1166 - `image_url: String`
1167
1168 The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
1169
1170 - `class ResponseInputFileContent`
1171
1172 A file input to the model.
1173
1174 - `type: :input_file`
1175
1176 The type of the input item. Always `input_file`.
1177
1178 - `:input_file`
1179
1180 - `detail: :low | :high`
1181
1182 The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`.
1183
1184 - `:low`
1185
1186 - `:high`
1187
1188 - `file_data: String`
1189
1190 The base64-encoded data of the file to be sent to the model.
1191
1192 - `file_id: String`
1193
1194 The ID of the file to be sent to the model.
1195
1196 - `file_url: String`
1197
1198 The URL of the file to be sent to the model.
1199
1200 - `filename: String`
1201
1202 The name of the file to be sent to the model.
1203
1204 - `type: :function_call_output`
1205
1206 The type of the function tool call output. Always `function_call_output`.
1207
1208 - `:function_call_output`
1209
1210 - `id: String`
1211
1212 The unique ID of the function tool call output. Populated when this item is returned via API.
1213
1214 - `status: :in_progress | :completed | :incomplete`
1215
1216 The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
1217
1218 - `:in_progress`
1219
1220 - `:completed`
1221
1222 - `:incomplete`
1223
1224 - `class ToolSearchCall`
1225
1226 - `arguments: untyped`
1227
1228 The arguments supplied to the tool search call.
1229
1230 - `type: :tool_search_call`
1231
1232 The item type. Always `tool_search_call`.
1233
1234 - `:tool_search_call`
1235
1236 - `id: String`
1237
1238 The unique ID of this tool search call.
1239
1240 - `call_id: String`
1241
1242 The unique ID of the tool search call generated by the model.
1243
1244 - `execution: :server | :client`
1245
1246 Whether tool search was executed by the server or by the client.
1247
1248 - `:server`
1249
1250 - `:client`
1251
1252 - `status: :in_progress | :completed | :incomplete`
1253
1254 The status of the tool search call.
1255
1256 - `:in_progress`
1257
1258 - `:completed`
1259
1260 - `:incomplete`
1261
1262 - `class ResponseToolSearchOutputItemParam`
1263
1264 - `tools: Array[Tool]`
1265
1266 The loaded tool definitions returned by the tool search output.
1267
1268 - `class FunctionTool`
1269
1270 Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).
1271
1272 - `name: String`
1273
1274 The name of the function to call.
1275
1276 - `parameters: Hash[Symbol, untyped]`
1277
1278 A JSON schema object describing the parameters of the function.
1279
1280 - `strict: bool`
1281
1282 Whether to enforce strict parameter validation. Default `true`.
1283
1284 - `type: :function`
1285
1286 The type of the function tool. Always `function`.
1287
1288 - `:function`
1289
1290 - `defer_loading: bool`
1291
1292 Whether this function is deferred and loaded via tool search.
1293
1294 - `description: String`
1295
1296 A description of the function. Used by the model to determine whether or not to call the function.
1297
1298 - `class FileSearchTool`
1299
1300 A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
1301
1302 - `type: :file_search`
1303
1304 The type of the file search tool. Always `file_search`.
1305
1306 - `:file_search`
1307
1308 - `vector_store_ids: Array[String]`
1309
1310 The IDs of the vector stores to search.
1311
1312 - `filters: ComparisonFilter | CompoundFilter`
1313
1314 A filter to apply.
1315
1316 - `class ComparisonFilter`
1317
1318 A filter used to compare a specified attribute key to a given value using a defined comparison operation.
1319
1320 - `key: String`
1321
1322 The key to compare against the value.
1323
1324 - `type: :eq | :ne | :gt | 5 more`
1325
1326 Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.
1327
1328 - `eq`: equals
1329 - `ne`: not equal
1330 - `gt`: greater than
1331 - `gte`: greater than or equal
1332 - `lt`: less than
1333 - `lte`: less than or equal
1334 - `in`: in
1335 - `nin`: not in
1336
1337 - `:eq`
1338
1339 - `:ne`
1340
1341 - `:gt`
1342
1343 - `:gte`
1344
1345 - `:lt`
1346
1347 - `:lte`
1348
1349 - `:in`
1350
1351 - `:nin`
1352
1353 - `value: String | Float | bool | Array[String | Float]`
1354
1355 The value to compare against the attribute key; supports string, number, or boolean types.
1356
1357 - `String = String`
1358
1359 - `Float = Float`
1360
1361 - `UnionMember2 = bool`
1362
1363 - `UnionMember3 = Array[String | Float]`
1364
1365 - `String = String`
1366
1367 - `Float = Float`
1368
1369 - `class CompoundFilter`
1370
1371 Combine multiple filters using `and` or `or`.
1372
1373 - `filters: Array[ComparisonFilter | untyped]`
1374
1375 Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.
1376
1377 - `class ComparisonFilter`
1378
1379 A filter used to compare a specified attribute key to a given value using a defined comparison operation.
1380
1381 - `UnionMember1 = untyped`
1382
1383 - `type: :and | :or`
1384
1385 Type of operation: `and` or `or`.
1386
1387 - `:and`
1388
1389 - `:or`
1390
1391 - `max_num_results: Integer`
1392
1393 The maximum number of results to return. This number should be between 1 and 50 inclusive.
1394
1395 - `ranking_options: RankingOptions{ hybrid_search, ranker, score_threshold}`
1396
1397 Ranking options for search.
1398
1399 - `hybrid_search: HybridSearch{ embedding_weight, text_weight}`
1400
1401 Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
1402
1403 - `embedding_weight: Float`
1404
1405 The weight of the embedding in the reciprocal ranking fusion.
1406
1407 - `text_weight: Float`
1408
1409 The weight of the text in the reciprocal ranking fusion.
1410
1411 - `ranker: :auto | :"default-2024-11-15"`
1412
1413 The ranker to use for the file search.
1414
1415 - `:auto`
1416
1417 - `:"default-2024-11-15"`
1418
1419 - `score_threshold: Float`
1420
1421 The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.
1422
1423 - `class ComputerTool`
1424
1425 A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
1426
1427 - `type: :computer`
1428
1429 The type of the computer tool. Always `computer`.
1430
1431 - `:computer`
1432
1433 - `class ComputerUsePreviewTool`
1434
1435 A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
1436
1437 - `display_height: Integer`
1438
1439 The height of the computer display.
1440
1441 - `display_width: Integer`
1442
1443 The width of the computer display.
1444
1445 - `environment: :windows | :mac | :linux | 2 more`
1446
1447 The type of computer environment to control.
1448
1449 - `:windows`
1450
1451 - `:mac`
1452
1453 - `:linux`
1454
1455 - `:ubuntu`
1456
1457 - `:browser`
1458
1459 - `type: :computer_use_preview`
1460
1461 The type of the computer use tool. Always `computer_use_preview`.
1462
1463 - `:computer_use_preview`
1464
1465 - `class WebSearchTool`
1466
1467 Search the Internet for sources related to the prompt. Learn more about the
1468 [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
1469
1470 - `type: :web_search | :web_search_2025_08_26`
1471
1472 The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.
1473
1474 - `:web_search`
1475
1476 - `:web_search_2025_08_26`
1477
1478 - `filters: Filters{ allowed_domains}`
1479
1480 Filters for the search.
1481
1482 - `allowed_domains: Array[String]`
1483
1484 Allowed domains for the search. If not provided, all domains are allowed.
1485 Subdomains of the provided domains are allowed as well.
1486
1487 Example: `["pubmed.ncbi.nlm.nih.gov"]`
1488
1489 - `search_context_size: :low | :medium | :high`
1490
1491 High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.
1492
1493 - `:low`
1494
1495 - `:medium`
1496
1497 - `:high`
1498
1499 - `user_location: UserLocation{ city, country, region, 2 more}`
1500
1501 The approximate location of the user.
1502
1503 - `city: String`
1504
1505 Free text input for the city of the user, e.g. `San Francisco`.
1506
1507 - `country: String`
1508
1509 The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.
1510
1511 - `region: String`
1512
1513 Free text input for the region of the user, e.g. `California`.
1514
1515 - `timezone: String`
1516
1517 The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.
1518
1519 - `type: :approximate`
1520
1521 The type of location approximation. Always `approximate`.
1522
1523 - `:approximate`
1524
1525 - `class Mcp`
1526
1527 Give the model access to additional tools via remote Model Context Protocol
1528 (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
1529
1530 - `server_label: String`
1531
1532 A label for this MCP server, used to identify it in tool calls.
1533
1534 - `type: :mcp`
1535
1536 The type of the MCP tool. Always `mcp`.
1537
1538 - `:mcp`
1539
1540 - `allowed_tools: Array[String] | McpToolFilter{ read_only, tool_names}`
1541
1542 List of allowed tool names or a filter object.
1543
1544 - `McpAllowedTools = Array[String]`
1545
1546 A string array of allowed tool names
1547
1548 - `class McpToolFilter`
1549
1550 A filter object to specify which tools are allowed.
1551
1552 - `read_only: bool`
1553
1554 Indicates whether or not a tool modifies data or is read-only. If an
1555 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
1556 it will match this filter.
1557
1558 - `tool_names: Array[String]`
1559
1560 List of allowed tool names.
1561
1562 - `authorization: String`
1563
1564 An OAuth access token that can be used with a remote MCP server, either
1565 with a custom MCP server URL or a service connector. Your application
1566 must handle the OAuth authorization flow and provide the token here.
1567
1568 - `connector_id: :connector_dropbox | :connector_gmail | :connector_googlecalendar | 5 more`
1569
1570 Identifier for service connectors, like those available in ChatGPT. One of
1571 `server_url` or `connector_id` must be provided. Learn more about service
1572 connectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
1573
1574 Currently supported `connector_id` values are:
1575
1576 - Dropbox: `connector_dropbox`
1577 - Gmail: `connector_gmail`
1578 - Google Calendar: `connector_googlecalendar`
1579 - Google Drive: `connector_googledrive`
1580 - Microsoft Teams: `connector_microsoftteams`
1581 - Outlook Calendar: `connector_outlookcalendar`
1582 - Outlook Email: `connector_outlookemail`
1583 - SharePoint: `connector_sharepoint`
1584
1585 - `:connector_dropbox`
1586
1587 - `:connector_gmail`
1588
1589 - `:connector_googlecalendar`
1590
1591 - `:connector_googledrive`
1592
1593 - `:connector_microsoftteams`
1594
1595 - `:connector_outlookcalendar`
1596
1597 - `:connector_outlookemail`
1598
1599 - `:connector_sharepoint`
1600
1601 - `defer_loading: bool`
1602
1603 Whether this MCP tool is deferred and discovered via tool search.
1604
1605 - `headers: Hash[Symbol, String]`
1606
1607 Optional HTTP headers to send to the MCP server. Use for authentication
1608 or other purposes.
1609
1610 - `require_approval: McpToolApprovalFilter{ always, never} | :always | :never`
1611
1612 Specify which of the MCP server's tools require approval.
1613
1614 - `class McpToolApprovalFilter`
1615
1616 Specify which of the MCP server's tools require approval. Can be
1617 `always`, `never`, or a filter object associated with tools
1618 that require approval.
1619
1620 - `always: Always{ read_only, tool_names}`
1621
1622 A filter object to specify which tools are allowed.
1623
1624 - `read_only: bool`
1625
1626 Indicates whether or not a tool modifies data or is read-only. If an
1627 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
1628 it will match this filter.
1629
1630 - `tool_names: Array[String]`
1631
1632 List of allowed tool names.
1633
1634 - `never: Never{ read_only, tool_names}`
1635
1636 A filter object to specify which tools are allowed.
1637
1638 - `read_only: bool`
1639
1640 Indicates whether or not a tool modifies data or is read-only. If an
1641 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
1642 it will match this filter.
1643
1644 - `tool_names: Array[String]`
1645
1646 List of allowed tool names.
1647
1648 - `McpToolApprovalSetting = :always | :never`
1649
1650 Specify a single approval policy for all tools. One of `always` or
1651 `never`. When set to `always`, all tools will require approval. When
1652 set to `never`, all tools will not require approval.
1653
1654 - `:always`
1655
1656 - `:never`
1657
1658 - `server_description: String`
1659
1660 Optional description of the MCP server, used to provide more context.
1661
1662 - `server_url: String`
1663
1664 The URL for the MCP server. One of `server_url` or `connector_id` must be
1665 provided.
1666
1667 - `class CodeInterpreter`
1668
1669 A tool that runs Python code to help generate a response to a prompt.
1670
1671 - `container: String | CodeInterpreterToolAuto{ type, file_ids, memory_limit, network_policy}`
1672
1673 The code interpreter container. Can be a container ID or an object that
1674 specifies uploaded file IDs to make available to your code, along with an
1675 optional `memory_limit` setting.
1676
1677 - `String = String`
1678
1679 The container ID.
1680
1681 - `class CodeInterpreterToolAuto`
1682
1683 Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
1684
1685 - `type: :auto`
1686
1687 Always `auto`.
1688
1689 - `:auto`
1690
1691 - `file_ids: Array[String]`
1692
1693 An optional list of uploaded files to make available to your code.
1694
1695 - `memory_limit: :"1g" | :"4g" | :"16g" | :"64g"`
1696
1697 The memory limit for the code interpreter container.
1698
1699 - `:"1g"`
1700
1701 - `:"4g"`
1702
1703 - `:"16g"`
1704
1705 - `:"64g"`
1706
1707 - `network_policy: ContainerNetworkPolicyDisabled | ContainerNetworkPolicyAllowlist`
1708
1709 Network access policy for the container.
1710
1711 - `class ContainerNetworkPolicyDisabled`
1712
1713 - `type: :disabled`
1714
1715 Disable outbound network access. Always `disabled`.
1716
1717 - `:disabled`
1718
1719 - `class ContainerNetworkPolicyAllowlist`
1720
1721 - `allowed_domains: Array[String]`
1722
1723 A list of allowed domains when type is `allowlist`.
1724
1725 - `type: :allowlist`
1726
1727 Allow outbound network access only to specified domains. Always `allowlist`.
1728
1729 - `:allowlist`
1730
1731 - `domain_secrets: Array[ContainerNetworkPolicyDomainSecret]`
1732
1733 Optional domain-scoped secrets for allowlisted domains.
1734
1735 - `domain: String`
1736
1737 The domain associated with the secret.
1738
1739 - `name: String`
1740
1741 The name of the secret to inject for the domain.
1742
1743 - `value: String`
1744
1745 The secret value to inject for the domain.
1746
1747 - `type: :code_interpreter`
1748
1749 The type of the code interpreter tool. Always `code_interpreter`.
1750
1751 - `:code_interpreter`
1752
1753 - `class ImageGeneration`
1754
1755 A tool that generates images using the GPT image models.
1756
1757 - `type: :image_generation`
1758
1759 The type of the image generation tool. Always `image_generation`.
1760
1761 - `:image_generation`
1762
1763 - `action: :generate | :edit | :auto`
1764
1765 Whether to generate a new image or edit an existing image. Default: `auto`.
1766
1767 - `:generate`
1768
1769 - `:edit`
1770
1771 - `:auto`
1772
1773 - `background: :transparent | :opaque | :auto`
1774
1775 Allows to set transparency for the background of the generated image(s).
1776 This parameter is only supported for GPT image models that support
1777 transparent backgrounds. Must be one of `transparent`, `opaque`, or
1778 `auto` (default value). When `auto` is used, the model will
1779 automatically determine the best background for the image.
1780
1781 `gpt-image-2` and `gpt-image-2-2026-04-21` do not support
1782 transparent backgrounds. Requests with `background` set to
1783 `transparent` will return an error for these models; use `opaque` or
1784 `auto` instead.
1785
1786 If `transparent`, the output format needs to support transparency,
1787 so it should be set to either `png` (default value) or `webp`.
1788
1789 - `:transparent`
1790
1791 - `:opaque`
1792
1793 - `:auto`
1794
1795 - `input_fidelity: :high | :low`
1796
1797 Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
1798
1799 - `:high`
1800
1801 - `:low`
1802
1803 - `input_image_mask: InputImageMask{ file_id, image_url}`
1804
1805 Optional mask for inpainting. Contains `image_url`
1806 (string, optional) and `file_id` (string, optional).
1807
1808 - `file_id: String`
1809
1810 File ID for the mask image.
1811
1812 - `image_url: String`
1813
1814 Base64-encoded mask image.
1815
1816 - `model: String | :"gpt-image-1" | :"gpt-image-1-mini" | :"gpt-image-2" | 3 more`
1817
1818 The image generation model to use. Default: `gpt-image-1`.
1819
1820 - `String = String`
1821
1822 - `Model = :"gpt-image-1" | :"gpt-image-1-mini" | :"gpt-image-2" | 3 more`
1823
1824 The image generation model to use. Default: `gpt-image-1`.
1825
1826 - `:"gpt-image-1"`
1827
1828 - `:"gpt-image-1-mini"`
1829
1830 - `:"gpt-image-2"`
1831
1832 - `:"gpt-image-2-2026-04-21"`
1833
1834 - `:"gpt-image-1.5"`
1835
1836 - `:"chatgpt-image-latest"`
1837
1838 - `moderation: :auto | :low`
1839
1840 Moderation level for the generated image. Default: `auto`.
1841
1842 - `:auto`
1843
1844 - `:low`
1845
1846 - `output_compression: Integer`
1847
1848 Compression level for the output image. Default: 100.
1849
1850 - `output_format: :png | :webp | :jpeg`
1851
1852 The output format of the generated image. One of `png`, `webp`, or
1853 `jpeg`. Default: `png`.
1854
1855 - `:png`
1856
1857 - `:webp`
1858
1859 - `:jpeg`
1860
1861 - `partial_images: Integer`
1862
1863 Number of partial images to generate in streaming mode, from 0 (default value) to 3.
1864
1865 - `quality: :low | :medium | :high | :auto`
1866
1867 The quality of the generated image. One of `low`, `medium`, `high`,
1868 or `auto`. Default: `auto`.
1869
1870 - `:low`
1871
1872 - `:medium`
1873
1874 - `:high`
1875
1876 - `:auto`
1877
1878 - `size: String | :"1024x1024" | :"1024x1536" | :"1536x1024" | :auto`
1879
1880 The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`.
1881
1882 - `String = String`
1883
1884 - `Size = :"1024x1024" | :"1024x1536" | :"1536x1024" | :auto`
1885
1886 The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`.
1887
1888 - `:"1024x1024"`
1889
1890 - `:"1024x1536"`
1891
1892 - `:"1536x1024"`
1893
1894 - `:auto`
1895
1896 - `class LocalShell`
1897
1898 A tool that allows the model to execute shell commands in a local environment.
1899
1900 - `type: :local_shell`
1901
1902 The type of the local shell tool. Always `local_shell`.
1903
1904 - `:local_shell`
1905
1906 - `class FunctionShellTool`
1907
1908 A tool that allows the model to execute shell commands.
1909
1910 - `type: :shell`
1911
1912 The type of the shell tool. Always `shell`.
1913
1914 - `:shell`
1915
1916 - `environment: ContainerAuto | LocalEnvironment | ContainerReference`
1917
1918 - `class ContainerAuto`
1919
1920 - `type: :container_auto`
1921
1922 Automatically creates a container for this request
1923
1924 - `:container_auto`
1925
1926 - `file_ids: Array[String]`
1927
1928 An optional list of uploaded files to make available to your code.
1929
1930 - `memory_limit: :"1g" | :"4g" | :"16g" | :"64g"`
1931
1932 The memory limit for the container.
1933
1934 - `:"1g"`
1935
1936 - `:"4g"`
1937
1938 - `:"16g"`
1939
1940 - `:"64g"`
1941
1942 - `network_policy: ContainerNetworkPolicyDisabled | ContainerNetworkPolicyAllowlist`
1943
1944 Network access policy for the container.
1945
1946 - `class ContainerNetworkPolicyDisabled`
1947
1948 - `class ContainerNetworkPolicyAllowlist`
1949
1950 - `skills: Array[SkillReference | InlineSkill]`
1951
1952 An optional list of skills referenced by id or inline data.
1953
1954 - `class SkillReference`
1955
1956 - `skill_id: String`
1957
1958 The ID of the referenced skill.
1959
1960 - `type: :skill_reference`
1961
1962 References a skill created with the /v1/skills endpoint.
1963
1964 - `:skill_reference`
1965
1966 - `version: String`
1967
1968 Optional skill version. Use a positive integer or 'latest'. Omit for default.
1969
1970 - `class InlineSkill`
1971
1972 - `description: String`
1973
1974 The description of the skill.
1975
1976 - `name: String`
1977
1978 The name of the skill.
1979
1980 - `source: InlineSkillSource`
1981
1982 Inline skill payload
1983
1984 - `data: String`
1985
1986 Base64-encoded skill zip bundle.
1987
1988 - `media_type: :"application/zip"`
1989
1990 The media type of the inline skill payload. Must be `application/zip`.
1991
1992 - `:"application/zip"`
1993
1994 - `type: :base64`
1995
1996 The type of the inline skill source. Must be `base64`.
1997
1998 - `:base64`
1999
2000 - `type: :inline`
2001
2002 Defines an inline skill for this request.
2003
2004 - `:inline`
2005
2006 - `class LocalEnvironment`
2007
2008 - `type: :local`
2009
2010 Use a local computer environment.
2011
2012 - `:local`
2013
2014 - `skills: Array[LocalSkill]`
2015
2016 An optional list of skills.
2017
2018 - `description: String`
2019
2020 The description of the skill.
2021
2022 - `name: String`
2023
2024 The name of the skill.
2025
2026 - `path: String`
2027
2028 The path to the directory containing the skill.
2029
2030 - `class ContainerReference`
2031
2032 - `container_id: String`
2033
2034 The ID of the referenced container.
2035
2036 - `type: :container_reference`
2037
2038 References a container created with the /v1/containers endpoint
2039
2040 - `:container_reference`
2041
2042 - `class CustomTool`
2043
2044 A custom tool that processes input using a specified format. Learn more about [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
2045
2046 - `name: String`
2047
2048 The name of the custom tool, used to identify it in tool calls.
2049
2050 - `type: :custom`
2051
2052 The type of the custom tool. Always `custom`.
2053
2054 - `:custom`
2055
2056 - `defer_loading: bool`
2057
2058 Whether this tool should be deferred and discovered via tool search.
2059
2060 - `description: String`
2061
2062 Optional description of the custom tool, used to provide more context.
2063
2064 - `format_: CustomToolInputFormat`
2065
2066 The input format for the custom tool. Default is unconstrained text.
2067
2068 - `class Text`
2069
2070 Unconstrained free-form text.
2071
2072 - `type: :text`
2073
2074 Unconstrained text format. Always `text`.
2075
2076 - `:text`
2077
2078 - `class Grammar`
2079
2080 A grammar defined by the user.
2081
2082 - `definition: String`
2083
2084 The grammar definition.
2085
2086 - `syntax: :lark | :regex`
2087
2088 The syntax of the grammar definition. One of `lark` or `regex`.
2089
2090 - `:lark`
2091
2092 - `:regex`
2093
2094 - `type: :grammar`
2095
2096 Grammar format. Always `grammar`.
2097
2098 - `:grammar`
2099
2100 - `class NamespaceTool`
2101
2102 Groups function/custom tools under a shared namespace.
2103
2104 - `description: String`
2105
2106 A description of the namespace shown to the model.
2107
2108 - `name: String`
2109
2110 The namespace name used in tool calls (for example, `crm`).
2111
2112 - `tools: Array[Function{ name, type, defer_loading, 3 more} | CustomTool]`
2113
2114 The function/custom tools available inside this namespace.
2115
2116 - `class Function`
2117
2118 - `name: String`
2119
2120 - `type: :function`
2121
2122 - `:function`
2123
2124 - `defer_loading: bool`
2125
2126 Whether this function should be deferred and discovered via tool search.
2127
2128 - `description: String`
2129
2130 - `parameters: untyped`
2131
2132 - `strict: bool`
2133
2134 - `class CustomTool`
2135
2136 A custom tool that processes input using a specified format. Learn more about [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
2137
2138 - `type: :namespace`
2139
2140 The type of the tool. Always `namespace`.
2141
2142 - `:namespace`
2143
2144 - `class ToolSearchTool`
2145
2146 Hosted or BYOT tool search configuration for deferred tools.
2147
2148 - `type: :tool_search`
2149
2150 The type of the tool. Always `tool_search`.
2151
2152 - `:tool_search`
2153
2154 - `description: String`
2155
2156 Description shown to the model for a client-executed tool search tool.
2157
2158 - `execution: :server | :client`
2159
2160 Whether tool search is executed by the server or by the client.
2161
2162 - `:server`
2163
2164 - `:client`
2165
2166 - `parameters: untyped`
2167
2168 Parameter schema for a client-executed tool search tool.
2169
2170 - `class WebSearchPreviewTool`
2171
2172 This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
2173
2174 - `type: :web_search_preview | :web_search_preview_2025_03_11`
2175
2176 The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.
2177
2178 - `:web_search_preview`
2179
2180 - `:web_search_preview_2025_03_11`
2181
2182 - `search_content_types: Array[:text | :image]`
2183
2184 - `:text`
2185
2186 - `:image`
2187
2188 - `search_context_size: :low | :medium | :high`
2189
2190 High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.
2191
2192 - `:low`
2193
2194 - `:medium`
2195
2196 - `:high`
2197
2198 - `user_location: UserLocation{ type, city, country, 2 more}`
2199
2200 The user's location.
2201
2202 - `type: :approximate`
2203
2204 The type of location approximation. Always `approximate`.
2205
2206 - `:approximate`
2207
2208 - `city: String`
2209
2210 Free text input for the city of the user, e.g. `San Francisco`.
2211
2212 - `country: String`
2213
2214 The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.
2215
2216 - `region: String`
2217
2218 Free text input for the region of the user, e.g. `California`.
2219
2220 - `timezone: String`
2221
2222 The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.
2223
2224 - `class ApplyPatchTool`
2225
2226 Allows the assistant to create, delete, or update files using unified diffs.
2227
2228 - `type: :apply_patch`
2229
2230 The type of the tool. Always `apply_patch`.
2231
2232 - `:apply_patch`
2233
2234 - `type: :tool_search_output`
2235
2236 The item type. Always `tool_search_output`.
2237
2238 - `:tool_search_output`
2239
2240 - `id: String`
2241
2242 The unique ID of this tool search output.
2243
2244 - `call_id: String`
2245
2246 The unique ID of the tool search call generated by the model.
2247
2248 - `execution: :server | :client`
2249
2250 Whether tool search was executed by the server or by the client.
2251
2252 - `:server`
2253
2254 - `:client`
2255
2256 - `status: :in_progress | :completed | :incomplete`
2257
2258 The status of the tool search output.
2259
2260 - `:in_progress`
2261
2262 - `:completed`
2263
2264 - `:incomplete`
2265
2266 - `class ResponseReasoningItem`
2267
2268 A description of the chain of thought used by a reasoning model while generating
2269 a response. Be sure to include these items in your `input` to the Responses API
2270 for subsequent turns of a conversation if you are manually
2271 [managing context](https://platform.openai.com/docs/guides/conversation-state).
2272
2273 - `id: String`
2274
2275 The unique identifier of the reasoning content.
2276
2277 - `summary: Array[Summary{ text, type}]`
2278
2279 Reasoning summary content.
2280
2281 - `text: String`
2282
2283 A summary of the reasoning output from the model so far.
2284
2285 - `type: :summary_text`
2286
2287 The type of the object. Always `summary_text`.
2288
2289 - `:summary_text`
2290
2291 - `type: :reasoning`
2292
2293 The type of the object. Always `reasoning`.
2294
2295 - `:reasoning`
2296
2297 - `content: Array[Content{ text, type}]`
2298
2299 Reasoning text content.
2300
2301 - `text: String`
2302
2303 The reasoning text from the model.
2304
2305 - `type: :reasoning_text`
2306
2307 The type of the reasoning text. Always `reasoning_text`.
2308
2309 - `:reasoning_text`
2310
2311 - `encrypted_content: String`
2312
2313 The encrypted content of the reasoning item - populated when a response is
2314 generated with `reasoning.encrypted_content` in the `include` parameter.
2315
2316 - `status: :in_progress | :completed | :incomplete`
2317
2318 The status of the item. One of `in_progress`, `completed`, or
2319 `incomplete`. Populated when items are returned via API.
2320
2321 - `:in_progress`
2322
2323 - `:completed`
2324
2325 - `:incomplete`
2326
2327 - `class ResponseCompactionItemParam`
2328
2329 A compaction item generated by the [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
2330
2331 - `encrypted_content: String`
2332
2333 The encrypted content of the compaction summary.
2334
2335 - `type: :compaction`
2336
2337 The type of the item. Always `compaction`.
2338
2339 - `:compaction`
2340
2341 - `id: String`
2342
2343 The ID of the compaction item.
2344
2345 - `class ImageGenerationCall`
2346
2347 An image generation request made by the model.
2348
2349 - `id: String`
2350
2351 The unique ID of the image generation call.
2352
2353 - `result: String`
2354
2355 The generated image encoded in base64.
2356
2357 - `status: :in_progress | :completed | :generating | :failed`
2358
2359 The status of the image generation call.
2360
2361 - `:in_progress`
2362
2363 - `:completed`
2364
2365 - `:generating`
2366
2367 - `:failed`
2368
2369 - `type: :image_generation_call`
2370
2371 The type of the image generation call. Always `image_generation_call`.
2372
2373 - `:image_generation_call`
2374
2375 - `class ResponseCodeInterpreterToolCall`
2376
2377 A tool call to run code.
2378
2379 - `id: String`
2380
2381 The unique ID of the code interpreter tool call.
2382
2383 - `code: String`
2384
2385 The code to run, or null if not available.
2386
2387 - `container_id: String`
2388
2389 The ID of the container used to run the code.
2390
2391 - `outputs: Array[Logs{ logs, type} | Image{ type, url}]`
2392
2393 The outputs generated by the code interpreter, such as logs or images.
2394 Can be null if no outputs are available.
2395
2396 - `class Logs`
2397
2398 The logs output from the code interpreter.
2399
2400 - `logs: String`
2401
2402 The logs output from the code interpreter.
2403
2404 - `type: :logs`
2405
2406 The type of the output. Always `logs`.
2407
2408 - `:logs`
2409
2410 - `class Image`
2411
2412 The image output from the code interpreter.
2413
2414 - `type: :image`
2415
2416 The type of the output. Always `image`.
2417
2418 - `:image`
2419
2420 - `url: String`
2421
2422 The URL of the image output from the code interpreter.
2423
2424 - `status: :in_progress | :completed | :incomplete | 2 more`
2425
2426 The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.
2427
2428 - `:in_progress`
2429
2430 - `:completed`
2431
2432 - `:incomplete`
2433
2434 - `:interpreting`
2435
2436 - `:failed`
2437
2438 - `type: :code_interpreter_call`
2439
2440 The type of the code interpreter tool call. Always `code_interpreter_call`.
2441
2442 - `:code_interpreter_call`
2443
2444 - `class LocalShellCall`
2445
2446 A tool call to run a command on the local shell.
2447
2448 - `id: String`
2449
2450 The unique ID of the local shell call.
2451
2452 - `action: Action{ command, env, type, 3 more}`
2453
2454 Execute a shell command on the server.
2455
2456 - `command: Array[String]`
2457
2458 The command to run.
2459
2460 - `env: Hash[Symbol, String]`
2461
2462 Environment variables to set for the command.
2463
2464 - `type: :exec`
2465
2466 The type of the local shell action. Always `exec`.
2467
2468 - `:exec`
2469
2470 - `timeout_ms: Integer`
2471
2472 Optional timeout in milliseconds for the command.
2473
2474 - `user: String`
2475
2476 Optional user to run the command as.
2477
2478 - `working_directory: String`
2479
2480 Optional working directory to run the command in.
2481
2482 - `call_id: String`
2483
2484 The unique ID of the local shell tool call generated by the model.
2485
2486 - `status: :in_progress | :completed | :incomplete`
2487
2488 The status of the local shell call.
2489
2490 - `:in_progress`
2491
2492 - `:completed`
2493
2494 - `:incomplete`
2495
2496 - `type: :local_shell_call`
2497
2498 The type of the local shell call. Always `local_shell_call`.
2499
2500 - `:local_shell_call`
2501
2502 - `class LocalShellCallOutput`
2503
2504 The output of a local shell tool call.
2505
2506 - `id: String`
2507
2508 The unique ID of the local shell tool call generated by the model.
2509
2510 - `output: String`
2511
2512 A JSON string of the output of the local shell tool call.
2513
2514 - `type: :local_shell_call_output`
2515
2516 The type of the local shell tool call output. Always `local_shell_call_output`.
2517
2518 - `:local_shell_call_output`
2519
2520 - `status: :in_progress | :completed | :incomplete`
2521
2522 The status of the item. One of `in_progress`, `completed`, or `incomplete`.
2523
2524 - `:in_progress`
2525
2526 - `:completed`
2527
2528 - `:incomplete`
2529
2530 - `class ShellCall`
2531
2532 A tool representing a request to execute one or more shell commands.
2533
2534 - `action: Action{ commands, max_output_length, timeout_ms}`
2535
2536 The shell commands and limits that describe how to run the tool call.
2537
2538 - `commands: Array[String]`
2539
2540 Ordered shell commands for the execution environment to run.
2541
2542 - `max_output_length: Integer`
2543
2544 Maximum number of UTF-8 characters to capture from combined stdout and stderr output.
2545
2546 - `timeout_ms: Integer`
2547
2548 Maximum wall-clock time in milliseconds to allow the shell commands to run.
2549
2550 - `call_id: String`
2551
2552 The unique ID of the shell tool call generated by the model.
2553
2554 - `type: :shell_call`
2555
2556 The type of the item. Always `shell_call`.
2557
2558 - `:shell_call`
2559
2560 - `id: String`
2561
2562 The unique ID of the shell tool call. Populated when this item is returned via API.
2563
2564 - `environment: LocalEnvironment | ContainerReference`
2565
2566 The environment to execute the shell commands in.
2567
2568 - `class LocalEnvironment`
2569
2570 - `class ContainerReference`
2571
2572 - `status: :in_progress | :completed | :incomplete`
2573
2574 The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.
2575
2576 - `:in_progress`
2577
2578 - `:completed`
2579
2580 - `:incomplete`
2581
2582 - `class ShellCallOutput`
2583
2584 The streamed output items emitted by a shell tool call.
2585
2586 - `call_id: String`
2587
2588 The unique ID of the shell tool call generated by the model.
2589
2590 - `output: Array[ResponseFunctionShellCallOutputContent]`
2591
2592 Captured chunks of stdout and stderr output, along with their associated outcomes.
2593
2594 - `outcome: Timeout{ type} | Exit{ exit_code, type}`
2595
2596 The exit or timeout outcome associated with this shell call.
2597
2598 - `class Timeout`
2599
2600 Indicates that the shell call exceeded its configured time limit.
2601
2602 - `type: :timeout`
2603
2604 The outcome type. Always `timeout`.
2605
2606 - `:timeout`
2607
2608 - `class Exit`
2609
2610 Indicates that the shell commands finished and returned an exit code.
2611
2612 - `exit_code: Integer`
2613
2614 The exit code returned by the shell process.
2615
2616 - `type: :exit`
2617
2618 The outcome type. Always `exit`.
2619
2620 - `:exit`
2621
2622 - `stderr: String`
2623
2624 Captured stderr output for the shell call.
2625
2626 - `stdout: String`
2627
2628 Captured stdout output for the shell call.
2629
2630 - `type: :shell_call_output`
2631
2632 The type of the item. Always `shell_call_output`.
2633
2634 - `:shell_call_output`
2635
2636 - `id: String`
2637
2638 The unique ID of the shell tool call output. Populated when this item is returned via API.
2639
2640 - `max_output_length: Integer`
2641
2642 The maximum number of UTF-8 characters captured for this shell call's combined output.
2643
2644 - `status: :in_progress | :completed | :incomplete`
2645
2646 The status of the shell call output.
2647
2648 - `:in_progress`
2649
2650 - `:completed`
2651
2652 - `:incomplete`
2653
2654 - `class ApplyPatchCall`
2655
2656 A tool call representing a request to create, delete, or update files using diff patches.
2657
2658 - `call_id: String`
2659
2660 The unique ID of the apply patch tool call generated by the model.
2661
2662 - `operation: CreateFile{ diff, path, type} | DeleteFile{ path, type} | UpdateFile{ diff, path, type}`
2663
2664 The specific create, delete, or update instruction for the apply_patch tool call.
2665
2666 - `class CreateFile`
2667
2668 Instruction for creating a new file via the apply_patch tool.
2669
2670 - `diff: String`
2671
2672 Unified diff content to apply when creating the file.
2673
2674 - `path: String`
2675
2676 Path of the file to create relative to the workspace root.
2677
2678 - `type: :create_file`
2679
2680 The operation type. Always `create_file`.
2681
2682 - `:create_file`
2683
2684 - `class DeleteFile`
2685
2686 Instruction for deleting an existing file via the apply_patch tool.
2687
2688 - `path: String`
2689
2690 Path of the file to delete relative to the workspace root.
2691
2692 - `type: :delete_file`
2693
2694 The operation type. Always `delete_file`.
2695
2696 - `:delete_file`
2697
2698 - `class UpdateFile`
2699
2700 Instruction for updating an existing file via the apply_patch tool.
2701
2702 - `diff: String`
2703
2704 Unified diff content to apply to the existing file.
2705
2706 - `path: String`
2707
2708 Path of the file to update relative to the workspace root.
2709
2710 - `type: :update_file`
2711
2712 The operation type. Always `update_file`.
2713
2714 - `:update_file`
2715
2716 - `status: :in_progress | :completed`
2717
2718 The status of the apply patch tool call. One of `in_progress` or `completed`.
2719
2720 - `:in_progress`
2721
2722 - `:completed`
2723
2724 - `type: :apply_patch_call`
2725
2726 The type of the item. Always `apply_patch_call`.
2727
2728 - `:apply_patch_call`
2729
2730 - `id: String`
2731
2732 The unique ID of the apply patch tool call. Populated when this item is returned via API.
2733
2734 - `class ApplyPatchCallOutput`
2735
2736 The streamed output emitted by an apply patch tool call.
2737
2738 - `call_id: String`
2739
2740 The unique ID of the apply patch tool call generated by the model.
2741
2742 - `status: :completed | :failed`
2743
2744 The status of the apply patch tool call output. One of `completed` or `failed`.
2745
2746 - `:completed`
2747
2748 - `:failed`
2749
2750 - `type: :apply_patch_call_output`
2751
2752 The type of the item. Always `apply_patch_call_output`.
2753
2754 - `:apply_patch_call_output`
2755
2756 - `id: String`
2757
2758 The unique ID of the apply patch tool call output. Populated when this item is returned via API.
2759
2760 - `output: String`
2761
2762 Optional human-readable log text from the apply patch tool (e.g., patch results or errors).
2763
2764 - `class McpListTools`
2765
2766 A list of tools available on an MCP server.
2767
2768 - `id: String`
2769
2770 The unique ID of the list.
2771
2772 - `server_label: String`
2773
2774 The label of the MCP server.
2775
2776 - `tools: Array[Tool{ input_schema, name, annotations, description}]`
2777
2778 The tools available on the server.
2779
2780 - `input_schema: untyped`
2781
2782 The JSON schema describing the tool's input.
2783
2784 - `name: String`
2785
2786 The name of the tool.
2787
2788 - `annotations: untyped`
2789
2790 Additional annotations about the tool.
2791
2792 - `description: String`
2793
2794 The description of the tool.
2795
2796 - `type: :mcp_list_tools`
2797
2798 The type of the item. Always `mcp_list_tools`.
2799
2800 - `:mcp_list_tools`
2801
2802 - `error: String`
2803
2804 Error message if the server could not list tools.
2805
2806 - `class McpApprovalRequest`
2807
2808 A request for human approval of a tool invocation.
2809
2810 - `id: String`
2811
2812 The unique ID of the approval request.
2813
2814 - `arguments: String`
2815
2816 A JSON string of arguments for the tool.
2817
2818 - `name: String`
2819
2820 The name of the tool to run.
2821
2822 - `server_label: String`
2823
2824 The label of the MCP server making the request.
2825
2826 - `type: :mcp_approval_request`
2827
2828 The type of the item. Always `mcp_approval_request`.
2829
2830 - `:mcp_approval_request`
2831
2832 - `class McpApprovalResponse`
2833
2834 A response to an MCP approval request.
2835
2836 - `approval_request_id: String`
2837
2838 The ID of the approval request being answered.
2839
2840 - `approve: bool`
2841
2842 Whether the request was approved.
2843
2844 - `type: :mcp_approval_response`
2845
2846 The type of the item. Always `mcp_approval_response`.
2847
2848 - `:mcp_approval_response`
2849
2850 - `id: String`
2851
2852 The unique ID of the approval response
2853
2854 - `reason: String`
2855
2856 Optional reason for the decision.
2857
2858 - `class McpCall`
2859
2860 An invocation of a tool on an MCP server.
2861
2862 - `id: String`
2863
2864 The unique ID of the tool call.
2865
2866 - `arguments: String`
2867
2868 A JSON string of the arguments passed to the tool.
2869
2870 - `name: String`
2871
2872 The name of the tool that was run.
2873
2874 - `server_label: String`
2875
2876 The label of the MCP server running the tool.
2877
2878 - `type: :mcp_call`
2879
2880 The type of the item. Always `mcp_call`.
2881
2882 - `:mcp_call`
2883
2884 - `approval_request_id: String`
2885
2886 Unique identifier for the MCP tool call approval request.
2887 Include this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.
2888
2889 - `error: String`
2890
2891 The error from the tool call, if any.
2892
2893 - `output: String`
2894
2895 The output from the tool call.
2896
2897 - `status: :in_progress | :completed | :incomplete | 2 more`
2898
2899 The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.
2900
2901 - `:in_progress`
2902
2903 - `:completed`
2904
2905 - `:incomplete`
2906
2907 - `:calling`
2908
2909 - `:failed`
2910
2911 - `class ResponseCustomToolCallOutput`
2912
2913 The output of a custom tool call from your code, being sent back to the model.
2914
2915 - `call_id: String`
2916
2917 The call ID, used to map this custom tool call output to a custom tool call.
2918
2919 - `output: String | Array[ResponseInputText | ResponseInputImage | ResponseInputFile]`
2920
2921 The output from the custom tool call generated by your code.
2922 Can be a string or an list of output content.
2923
2924 - `String = String`
2925
2926 A string of the output of the custom tool call.
2927
2928 - `OutputContentList = Array[ResponseInputText | ResponseInputImage | ResponseInputFile]`
2929
2930 Text, image, or file output of the custom tool call.
2931
2932 - `class ResponseInputText`
2933
2934 A text input to the model.
2935
2936 - `class ResponseInputImage`
2937
2938 An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
2939
2940 - `class ResponseInputFile`
2941
2942 A file input to the model.
2943
2944 - `type: :custom_tool_call_output`
2945
2946 The type of the custom tool call output. Always `custom_tool_call_output`.
2947
2948 - `:custom_tool_call_output`
2949
2950 - `id: String`
2951
2952 The unique ID of the custom tool call output in the OpenAI platform.
2953
2954 - `class ResponseCustomToolCall`
2955
2956 A call to a custom tool created by the model.
2957
2958 - `call_id: String`
2959
2960 An identifier used to map this custom tool call to a tool call output.
2961
2962 - `input: String`
2963
2964 The input for the custom tool call generated by the model.
2965
2966 - `name: String`
2967
2968 The name of the custom tool being called.
2969
2970 - `type: :custom_tool_call`
2971
2972 The type of the custom tool call. Always `custom_tool_call`.
2973
2974 - `:custom_tool_call`
2975
2976 - `id: String`
2977
2978 The unique ID of the custom tool call in the OpenAI platform.
2979
2980 - `namespace: String`
2981
2982 The namespace of the custom tool being called.
2983
2984 - `class CompactionTrigger`
2985
2986 Compacts the current context. Must be the final input item.
2987
2988 - `type: :compaction_trigger`
2989
2990 The type of the item. Always `compaction_trigger`.
2991
2992 - `:compaction_trigger`
2993
2994 - `class ItemReference`
2995
2996 An internal identifier for an item to reference.
2997
2998 - `id: String`
2999
3000 The ID of the item to reference.
3001
3002 - `type: :item_reference`
3003
3004 The type of item to reference. Always `item_reference`.
3005
3006 - `:item_reference`
3007
3008- `instructions: String`
3009
3010 A system (or developer) message inserted into the model's context.
3011 When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
3012
3013- `model: String`
3014
3015 Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models) to browse and compare available models.
3016
3017- `parallel_tool_calls: bool`
3018
3019 Whether to allow the model to run tool calls in parallel.
3020
3021- `previous_response_id: String`
3022
3023 The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://platform.openai.com/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.
3024
3025- `reasoning: Reasoning`
3026
3027 **gpt-5 and o-series models only** Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
3028
3029 - `effort: ReasoningEffort`
3030
3031 Constrains effort on reasoning for
3032 [reasoning models](https://platform.openai.com/docs/guides/reasoning).
3033 Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing
3034 reasoning effort can result in faster responses and fewer tokens used
3035 on reasoning in a response.
3036
3037 - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
3038 - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
3039 - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
3040 - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
3041
3042 - `:none`
3043
3044 - `:minimal`
3045
3046 - `:low`
3047
3048 - `:medium`
3049
3050 - `:high`
3051
3052 - `:xhigh`
3053
3054 - `generate_summary: :auto | :concise | :detailed`
3055
3056 **Deprecated:** use `summary` instead.
3057
3058 A summary of the reasoning performed by the model. This can be
3059 useful for debugging and understanding the model's reasoning process.
3060 One of `auto`, `concise`, or `detailed`.
3061
3062 - `:auto`
3063
3064 - `:concise`
3065
3066 - `:detailed`
3067
3068 - `summary: :auto | :concise | :detailed`
3069
3070 A summary of the reasoning performed by the model. This can be
3071 useful for debugging and understanding the model's reasoning process.
3072 One of `auto`, `concise`, or `detailed`.
3073
3074 `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.
3075
3076 - `:auto`
3077
3078 - `:concise`
3079
3080 - `:detailed`
3081
3082- `text: Text{ format_, verbosity}`
3083
3084 Configuration options for a text response from the model. Can be plain
3085 text or structured JSON data. Learn more:
3086
3087 - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
3088 - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
3089
3090 - `format_: ResponseFormatTextConfig`
3091
3092 An object specifying the format that the model must output.
3093
3094 Configuring `{ "type": "json_schema" }` enables Structured Outputs,
3095 which ensures the model will match your supplied JSON schema. Learn more in the
3096 [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
3097
3098 The default format is `{ "type": "text" }` with no additional options.
3099
3100 **Not recommended for gpt-4o and newer models:**
3101
3102 Setting to `{ "type": "json_object" }` enables the older JSON mode, which
3103 ensures the message the model generates is valid JSON. Using `json_schema`
3104 is preferred for models that support it.
3105
3106 - `class ResponseFormatText`
3107
3108 Default response format. Used to generate text responses.
3109
3110 - `type: :text`
3111
3112 The type of response format being defined. Always `text`.
3113
3114 - `:text`
3115
3116 - `class ResponseFormatTextJSONSchemaConfig`
3117
3118 JSON Schema response format. Used to generate structured JSON responses.
3119 Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
3120
3121 - `name: String`
3122
3123 The name of the response format. Must be a-z, A-Z, 0-9, or contain
3124 underscores and dashes, with a maximum length of 64.
3125
3126 - `schema: Hash[Symbol, untyped]`
3127
3128 The schema for the response format, described as a JSON Schema object.
3129 Learn how to build JSON schemas [here](https://json-schema.org/).
3130
3131 - `type: :json_schema`
3132
3133 The type of response format being defined. Always `json_schema`.
3134
3135 - `:json_schema`
3136
3137 - `description: String`
3138
3139 A description of what the response format is for, used by the model to
3140 determine how to respond in the format.
3141
3142 - `strict: bool`
3143
3144 Whether to enable strict schema adherence when generating the output.
3145 If set to true, the model will always follow the exact schema defined
3146 in the `schema` field. Only a subset of JSON Schema is supported when
3147 `strict` is `true`. To learn more, read the [Structured Outputs
3148 guide](https://platform.openai.com/docs/guides/structured-outputs).
3149
3150 - `class ResponseFormatJSONObject`
3151
3152 JSON object response format. An older method of generating JSON responses.
3153 Using `json_schema` is recommended for models that support it. Note that the
3154 model will not generate JSON without a system or user message instructing it
3155 to do so.
3156
3157 - `type: :json_object`
3158
3159 The type of response format being defined. Always `json_object`.
3160
3161 - `:json_object`
3162
3163 - `verbosity: :low | :medium | :high`
3164
3165 Constrains the verbosity of the model's response. Lower values will result in
3166 more concise responses, while higher values will result in more verbose responses.
3167 Currently supported values are `low`, `medium`, and `high`.
3168
3169 - `:low`
3170
3171 - `:medium`
3172
3173 - `:high`
3174
3175- `tool_choice: ToolChoiceOptions | ToolChoiceAllowed | ToolChoiceTypes | 5 more`
3176
3177 Controls which tool the model should use, if any.
3178
3179 - `ToolChoiceOptions = :none | :auto | :required`
3180
3181 Controls which (if any) tool is called by the model.
3182
3183 `none` means the model will not call any tool and instead generates a message.
3184
3185 `auto` means the model can pick between generating a message or calling one or
3186 more tools.
3187
3188 `required` means the model must call one or more tools.
3189
3190 - `:none`
3191
3192 - `:auto`
3193
3194 - `:required`
3195
3196 - `class ToolChoiceAllowed`
3197
3198 Constrains the tools available to the model to a pre-defined set.
3199
3200 - `mode: :auto | :required`
3201
3202 Constrains the tools available to the model to a pre-defined set.
3203
3204 `auto` allows the model to pick from among the allowed tools and generate a
3205 message.
3206
3207 `required` requires the model to call one or more of the allowed tools.
3208
3209 - `:auto`
3210
3211 - `:required`
3212
3213 - `tools: Array[Hash[Symbol, untyped]]`
3214
3215 A list of tool definitions that the model should be allowed to call.
3216
3217 For the Responses API, the list of tool definitions might look like:
3218
3219 ```json
3220 [
3221 { "type": "function", "name": "get_weather" },
3222 { "type": "mcp", "server_label": "deepwiki" },
3223 { "type": "image_generation" }
3224 ]
3225 ```
3226
3227 - `type: :allowed_tools`
3228
3229 Allowed tool configuration type. Always `allowed_tools`.
3230
3231 - `:allowed_tools`
3232
3233 - `class ToolChoiceTypes`
3234
3235 Indicates that the model should use a built-in tool to generate a response.
3236 [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
3237
3238 - `type: :file_search | :web_search_preview | :computer | 5 more`
3239
3240 The type of hosted tool the model should to use. Learn more about
3241 [built-in tools](https://platform.openai.com/docs/guides/tools).
3242
3243 Allowed values are:
3244
3245 - `file_search`
3246 - `web_search_preview`
3247 - `computer`
3248 - `computer_use_preview`
3249 - `computer_use`
3250 - `code_interpreter`
3251 - `image_generation`
3252
3253 - `:file_search`
3254
3255 - `:web_search_preview`
3256
3257 - `:computer`
3258
3259 - `:computer_use_preview`
3260
3261 - `:computer_use`
3262
3263 - `:web_search_preview_2025_03_11`
3264
3265 - `:image_generation`
3266
3267 - `:code_interpreter`
3268
3269 - `class ToolChoiceFunction`
3270
3271 Use this option to force the model to call a specific function.
3272
3273 - `name: String`
3274
3275 The name of the function to call.
3276
3277 - `type: :function`
3278
3279 For function calling, the type is always `function`.
3280
3281 - `:function`
3282
3283 - `class ToolChoiceMcp`
3284
3285 Use this option to force the model to call a specific tool on a remote MCP server.
3286
3287 - `server_label: String`
3288
3289 The label of the MCP server to use.
3290
3291 - `type: :mcp`
3292
3293 For MCP tools, the type is always `mcp`.
3294
3295 - `:mcp`
3296
3297 - `name: String`
3298
3299 The name of the tool to call on the server.
3300
3301 - `class ToolChoiceCustom`
3302
3303 Use this option to force the model to call a specific custom tool.
3304
3305 - `name: String`
3306
3307 The name of the custom tool to call.
3308
3309 - `type: :custom`
3310
3311 For custom tool calling, the type is always `custom`.
3312
3313 - `:custom`
3314
3315 - `class ToolChoiceApplyPatch`
3316
3317 Forces the model to call the apply_patch tool when executing a tool call.
3318
3319 - `type: :apply_patch`
3320
3321 The tool to call. Always `apply_patch`.
3322
3323 - `:apply_patch`
3324
3325 - `class ToolChoiceShell`
3326
3327 Forces the model to call the shell tool when a tool call is required.
3328
3329 - `type: :shell`
3330
3331 The tool to call. Always `shell`.
3332
3333 - `:shell`
3334
3335- `tools: Array[Tool]`
3336
3337 An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter.
3338
3339 - `class FunctionTool`
3340
3341 Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).
3342
3343 - `class FileSearchTool`
3344
3345 A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
3346
3347 - `class ComputerTool`
3348
3349 A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
3350
3351 - `class ComputerUsePreviewTool`
3352
3353 A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
3354
3355 - `class WebSearchTool`
3356
3357 Search the Internet for sources related to the prompt. Learn more about the
3358 [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
3359
3360 - `class Mcp`
3361
3362 Give the model access to additional tools via remote Model Context Protocol
3363 (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
3364
3365 - `class CodeInterpreter`
3366
3367 A tool that runs Python code to help generate a response to a prompt.
3368
3369 - `class ImageGeneration`
3370
3371 A tool that generates images using the GPT image models.
3372
3373 - `class LocalShell`
3374
3375 A tool that allows the model to execute shell commands in a local environment.
3376
3377 - `class FunctionShellTool`
3378
3379 A tool that allows the model to execute shell commands.
3380
3381 - `class CustomTool`
3382
3383 A custom tool that processes input using a specified format. Learn more about [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
3384
3385 - `class NamespaceTool`
3386
3387 Groups function/custom tools under a shared namespace.
3388
3389 - `class ToolSearchTool`
3390
3391 Hosted or BYOT tool search configuration for deferred tools.
3392
3393 - `class WebSearchPreviewTool`
3394
3395 This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
3396
3397 - `class ApplyPatchTool`
3398
3399 Allows the assistant to create, delete, or update files using unified diffs.
3400
3401- `truncation: :auto | :disabled`
3402
3403 The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
3404
3405 - `:auto`
3406
3407 - `:disabled`
3408
3409### Returns
3410
3411- `class InputTokenCountResponse`
3412
3413 - `input_tokens: Integer`
3414
3415 - `object: :"response.input_tokens"`
3416
3417 - `:"response.input_tokens"`
3418
3419### Example
3420
3421```ruby
3422require "openai"
3423
3424openai = OpenAI::Client.new(api_key: "My API Key")
3425
3426response = openai.responses.input_tokens.count
3427
3428puts(response)
3429```
3430
3431#### Response
3432
3433```json
3434{
3435 "input_tokens": 123,
3436 "object": "response.input_tokens"
3437}
3438```
3439
3440### Example
3441
3442```ruby
3443require "openai"
3444
3445openai = OpenAI::Client.new
3446
3447response = openai.responses.input_tokens.count(model: "gpt-5", input: "Tell me a joke.")
3448
3449puts(response)
3450```
3451
3452#### Response
3453
3454```json
3455{
3456 "object": "response.input_tokens",
3457 "input_tokens": 11
3458}
3459```
3460
3461## Domain Types
3462
3463### Input Token Count Response
3464
3465- `class InputTokenCountResponse`
3466
3467 - `input_tokens: Integer`
3468
3469 - `object: :"response.input_tokens"`
3470
3471 - `:"response.input_tokens"`