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