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