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