flexinference 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2521 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: flexinference-openapi.yaml
3
+ # timestamp: 2026-06-24T08:05:09+00:00
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Any, Literal, NotRequired
8
+
9
+ from typing_extensions import TypedDict
10
+
11
+
12
+ class ChatCompletionAllowedTools(TypedDict):
13
+ mode: Literal['auto', 'required']
14
+ tools: list[dict[str, Any]]
15
+
16
+
17
+ class ChatCompletionAllowedToolsChoice(TypedDict):
18
+ type: Literal['allowed_tools']
19
+ allowed_tools: ChatCompletionAllowedTools
20
+
21
+
22
+ class ChatCompletionFunctionCallOption(TypedDict):
23
+ name: str
24
+
25
+
26
+ class Custom(TypedDict):
27
+ name: str
28
+ input: str
29
+
30
+
31
+ class ChatCompletionMessageCustomToolCall(TypedDict):
32
+ id: str
33
+ type: Literal['custom']
34
+ custom: Custom
35
+
36
+
37
+ class Function(TypedDict):
38
+ name: str
39
+ arguments: str
40
+
41
+
42
+ class ChatCompletionMessageToolCall(TypedDict):
43
+ id: str
44
+ type: Literal['function']
45
+ function: Function
46
+
47
+
48
+ class Function1(TypedDict):
49
+ name: NotRequired[str]
50
+ arguments: NotRequired[str]
51
+
52
+
53
+ class ChatCompletionMessageToolCallChunk(TypedDict):
54
+ index: int
55
+ id: NotRequired[str]
56
+ type: NotRequired[Literal['function']]
57
+ function: NotRequired[Function1]
58
+
59
+
60
+ type ChatCompletionMessageToolCalls1 = ChatCompletionMessageToolCall | ChatCompletionMessageCustomToolCall
61
+
62
+
63
+ type ChatCompletionMessageToolCalls = list[ChatCompletionMessageToolCalls1]
64
+
65
+
66
+ class Function2(TypedDict):
67
+ name: str
68
+
69
+
70
+ class ChatCompletionNamedToolChoice(TypedDict):
71
+ type: Literal['function']
72
+ function: Function2
73
+
74
+
75
+ class Custom1(TypedDict):
76
+ name: str
77
+
78
+
79
+ class ChatCompletionNamedToolChoiceCustom(TypedDict):
80
+ type: Literal['custom']
81
+ custom: Custom1
82
+
83
+
84
+ class Audio(TypedDict):
85
+ id: str
86
+
87
+
88
+ class FunctionCall(TypedDict):
89
+ arguments: str
90
+ name: str
91
+
92
+
93
+ class ChatCompletionRequestFunctionMessage(TypedDict):
94
+ role: Literal['function']
95
+ content: str | None
96
+ name: str
97
+
98
+
99
+ class InputAudio(TypedDict):
100
+ data: str
101
+ format: Literal['wav', 'mp3']
102
+
103
+
104
+ class ChatCompletionRequestMessageContentPartAudio(TypedDict):
105
+ type: Literal['input_audio']
106
+ input_audio: InputAudio
107
+
108
+
109
+ class File(TypedDict):
110
+ filename: NotRequired[str]
111
+ file_data: NotRequired[str]
112
+ file_id: NotRequired[str]
113
+
114
+
115
+ class ChatCompletionRequestMessageContentPartFile(TypedDict):
116
+ type: Literal['file']
117
+ file: File
118
+
119
+
120
+ class ImageUrl(TypedDict):
121
+ url: str
122
+ detail: NotRequired[Literal['auto', 'low', 'high']]
123
+
124
+
125
+ class ChatCompletionRequestMessageContentPartImage(TypedDict):
126
+ type: Literal['image_url']
127
+ image_url: ImageUrl
128
+
129
+
130
+ class ChatCompletionRequestMessageContentPartRefusal(TypedDict):
131
+ type: Literal['refusal']
132
+ refusal: str
133
+
134
+
135
+ class ChatCompletionRequestMessageContentPartText(TypedDict):
136
+ type: Literal['text']
137
+ text: str
138
+
139
+
140
+ type ChatCompletionRequestSystemMessageContentPart = ChatCompletionRequestMessageContentPartText
141
+
142
+
143
+ type ChatCompletionRequestToolMessageContentPart = ChatCompletionRequestMessageContentPartText
144
+
145
+
146
+ type ChatCompletionRequestUserMessageContentPart = ChatCompletionRequestMessageContentPartText | ChatCompletionRequestMessageContentPartImage | ChatCompletionRequestMessageContentPartAudio | ChatCompletionRequestMessageContentPartFile
147
+
148
+
149
+ class UrlCitation(TypedDict):
150
+ end_index: int
151
+ start_index: int
152
+ url: str
153
+ title: str
154
+
155
+
156
+ class Annotation(TypedDict):
157
+ type: Literal['url_citation']
158
+ url_citation: UrlCitation
159
+
160
+
161
+ class Audio1(TypedDict):
162
+ id: str
163
+ expires_at: int
164
+ data: str
165
+ transcript: str
166
+
167
+
168
+ class ChatCompletionResponseMessage(TypedDict):
169
+ content: str | None
170
+ refusal: str | None
171
+ tool_calls: NotRequired[ChatCompletionMessageToolCalls]
172
+ annotations: NotRequired[list[Annotation]]
173
+ role: Literal['assistant']
174
+ function_call: NotRequired[FunctionCall]
175
+ audio: NotRequired[Audio1 | None]
176
+
177
+
178
+ class ChatCompletionStreamOptions1(TypedDict):
179
+ include_usage: NotRequired[bool]
180
+ include_obfuscation: NotRequired[bool]
181
+
182
+
183
+ type ChatCompletionStreamOptions = ChatCompletionStreamOptions1 | None
184
+
185
+
186
+ class FunctionCall2(TypedDict):
187
+ arguments: NotRequired[str]
188
+ name: NotRequired[str]
189
+
190
+
191
+ class ChatCompletionStreamResponseDelta(TypedDict):
192
+ content: NotRequired[str | None]
193
+ function_call: NotRequired[FunctionCall2]
194
+ tool_calls: NotRequired[list[ChatCompletionMessageToolCallChunk]]
195
+ role: NotRequired[Literal['developer', 'system', 'user', 'assistant', 'tool']]
196
+ refusal: NotRequired[str | None]
197
+
198
+
199
+ class TopLogprob(TypedDict):
200
+ token: str
201
+ logprob: float
202
+ bytes: list[int] | None
203
+
204
+
205
+ class ChatCompletionTokenLogprob(TypedDict):
206
+ token: str
207
+ logprob: float
208
+ bytes: list[int] | None
209
+ top_logprobs: list[TopLogprob]
210
+
211
+
212
+ type ChatCompletionToolChoiceOption = Literal[
213
+ 'none', 'auto', 'required'
214
+ ] | ChatCompletionAllowedToolsChoice | ChatCompletionNamedToolChoice | ChatCompletionNamedToolChoiceCustom
215
+
216
+
217
+ class ComparisonFilter(TypedDict, closed=True):
218
+ type: Literal['eq', 'ne', 'gt', 'gte', 'lt', 'lte', 'in', 'nin']
219
+ key: str
220
+ value: str | float | bool | list[str | float]
221
+
222
+
223
+ class CompletionTokensDetails(TypedDict):
224
+ accepted_prediction_tokens: NotRequired[int]
225
+ audio_tokens: NotRequired[int]
226
+ reasoning_tokens: NotRequired[int]
227
+ rejected_prediction_tokens: NotRequired[int]
228
+
229
+
230
+ class PromptTokensDetails(TypedDict):
231
+ audio_tokens: NotRequired[int]
232
+ cached_tokens: NotRequired[int]
233
+
234
+
235
+ class CompletionUsage(TypedDict):
236
+ completion_tokens: int
237
+ prompt_tokens: int
238
+ total_tokens: int
239
+ completion_tokens_details: NotRequired[CompletionTokensDetails]
240
+ prompt_tokens_details: NotRequired[PromptTokensDetails]
241
+
242
+
243
+ class ComputerScreenshotImage(TypedDict):
244
+ type: Literal['computer_screenshot']
245
+ image_url: NotRequired[str]
246
+ file_id: NotRequired[str]
247
+
248
+
249
+ class Logprobs(TypedDict):
250
+ content: list[ChatCompletionTokenLogprob] | None
251
+ refusal: list[ChatCompletionTokenLogprob] | None
252
+
253
+
254
+ class Choice(TypedDict):
255
+ finish_reason: Literal[
256
+ 'stop', 'length', 'tool_calls', 'content_filter', 'function_call'
257
+ ]
258
+ index: int
259
+ message: ChatCompletionResponseMessage
260
+ logprobs: Logprobs | None
261
+
262
+
263
+ class Logprobs1(TypedDict):
264
+ content: list[ChatCompletionTokenLogprob]
265
+ refusal: list[ChatCompletionTokenLogprob]
266
+
267
+
268
+ class Choice1(TypedDict):
269
+ delta: ChatCompletionStreamResponseDelta
270
+ logprobs: NotRequired[Logprobs1]
271
+ finish_reason: Literal[
272
+ 'stop', 'length', 'tool_calls', 'content_filter', 'function_call'
273
+ ]
274
+ index: int
275
+
276
+
277
+ type TopLogprobs = int
278
+
279
+
280
+ type TopLogprobs1 = None
281
+
282
+
283
+ class CustomToolCall(TypedDict):
284
+ type: Literal['custom_tool_call']
285
+ id: NotRequired[str]
286
+ call_id: str
287
+ namespace: NotRequired[str]
288
+ name: str
289
+ input: str
290
+
291
+
292
+ class Format(TypedDict, closed=True):
293
+ type: Literal['text']
294
+
295
+
296
+ class Grammar(TypedDict):
297
+ definition: str
298
+ syntax: Literal['lark', 'regex']
299
+
300
+
301
+ class Format1(TypedDict, closed=True):
302
+ type: Literal['grammar']
303
+ grammar: Grammar
304
+
305
+
306
+ class Custom2(TypedDict):
307
+ name: str
308
+ description: NotRequired[str]
309
+ format: NotRequired[Format | Format1]
310
+
311
+
312
+ class CustomToolChatCompletions(TypedDict):
313
+ type: Literal['custom']
314
+ custom: Custom2
315
+
316
+
317
+ class FilePath(TypedDict):
318
+ type: Literal['file_path']
319
+ file_id: str
320
+ index: int
321
+
322
+
323
+ class FunctionParameters(TypedDict):
324
+ pass
325
+
326
+
327
+ class FunctionToolCall(TypedDict):
328
+ id: NotRequired[str]
329
+ type: Literal['function_call']
330
+ call_id: str
331
+ namespace: NotRequired[str]
332
+ name: str
333
+ arguments: str
334
+ status: NotRequired[Literal['in_progress', 'completed', 'incomplete']]
335
+
336
+
337
+ class InputImageMask(TypedDict, closed=True):
338
+ image_url: NotRequired[str]
339
+ file_id: NotRequired[str]
340
+
341
+
342
+ class ImageGenToolCall(TypedDict):
343
+ type: Literal['image_generation_call']
344
+ id: str
345
+ status: Literal['in_progress', 'completed', 'generating', 'failed']
346
+ result: str | None
347
+
348
+
349
+ class LocalShellToolCallOutput(TypedDict):
350
+ type: Literal['local_shell_call_output']
351
+ id: str
352
+ output: str
353
+ status: NotRequired[Literal['in_progress', 'completed', 'incomplete'] | None]
354
+
355
+
356
+ class MCPApprovalRequest(TypedDict):
357
+ type: Literal['mcp_approval_request']
358
+ id: str
359
+ server_label: str
360
+ name: str
361
+ arguments: str
362
+
363
+
364
+ class MCPApprovalResponse(TypedDict):
365
+ type: Literal['mcp_approval_response']
366
+ id: NotRequired[str | None]
367
+ approval_request_id: str
368
+ approve: bool
369
+ reason: NotRequired[str | None]
370
+
371
+
372
+ class MCPApprovalResponseResource(TypedDict):
373
+ type: Literal['mcp_approval_response']
374
+ id: str
375
+ approval_request_id: str
376
+ approve: bool
377
+ reason: NotRequired[str | None]
378
+
379
+
380
+ class MCPListToolsTool(TypedDict):
381
+ name: str
382
+ description: NotRequired[str | None]
383
+ input_schema: dict[str, Any]
384
+ annotations: NotRequired[dict[str, Any] | None]
385
+
386
+
387
+ class MCPToolFilter(TypedDict, closed=True):
388
+ tool_names: NotRequired[list[str]]
389
+ read_only: NotRequired[bool]
390
+
391
+
392
+ type MessagePhase = Literal['commentary', 'final_answer']
393
+
394
+
395
+ type Metadata = dict[str, str] | None
396
+
397
+
398
+ type ModelIdsShared = str | Literal[
399
+ 'gpt-5.4',
400
+ 'gpt-5.4-mini',
401
+ 'gpt-5.4-nano',
402
+ 'gpt-5.4-mini-2026-03-17',
403
+ 'gpt-5.4-nano-2026-03-17',
404
+ 'gpt-5.3-chat-latest',
405
+ 'gpt-5.2',
406
+ 'gpt-5.2-2025-12-11',
407
+ 'gpt-5.2-chat-latest',
408
+ 'gpt-5.2-pro',
409
+ 'gpt-5.2-pro-2025-12-11',
410
+ 'gpt-5.1',
411
+ 'gpt-5.1-2025-11-13',
412
+ 'gpt-5.1-codex',
413
+ 'gpt-5.1-mini',
414
+ 'gpt-5.1-chat-latest',
415
+ 'gpt-5',
416
+ 'gpt-5-mini',
417
+ 'gpt-5-nano',
418
+ 'gpt-5-2025-08-07',
419
+ 'gpt-5-mini-2025-08-07',
420
+ 'gpt-5-nano-2025-08-07',
421
+ 'gpt-5-chat-latest',
422
+ 'gpt-4.1',
423
+ 'gpt-4.1-mini',
424
+ 'gpt-4.1-nano',
425
+ 'gpt-4.1-2025-04-14',
426
+ 'gpt-4.1-mini-2025-04-14',
427
+ 'gpt-4.1-nano-2025-04-14',
428
+ 'o4-mini',
429
+ 'o4-mini-2025-04-16',
430
+ 'o3',
431
+ 'o3-2025-04-16',
432
+ 'o3-mini',
433
+ 'o3-mini-2025-01-31',
434
+ 'o1',
435
+ 'o1-2024-12-17',
436
+ 'o1-preview',
437
+ 'o1-preview-2024-09-12',
438
+ 'o1-mini',
439
+ 'o1-mini-2024-09-12',
440
+ 'gpt-4o',
441
+ 'gpt-4o-2024-11-20',
442
+ 'gpt-4o-2024-08-06',
443
+ 'gpt-4o-2024-05-13',
444
+ 'gpt-4o-audio-preview',
445
+ 'gpt-4o-audio-preview-2024-10-01',
446
+ 'gpt-4o-audio-preview-2024-12-17',
447
+ 'gpt-4o-audio-preview-2025-06-03',
448
+ 'gpt-4o-mini-audio-preview',
449
+ 'gpt-4o-mini-audio-preview-2024-12-17',
450
+ 'gpt-4o-search-preview',
451
+ 'gpt-4o-mini-search-preview',
452
+ 'gpt-4o-search-preview-2025-03-11',
453
+ 'gpt-4o-mini-search-preview-2025-03-11',
454
+ 'chatgpt-4o-latest',
455
+ 'codex-mini-latest',
456
+ 'gpt-4o-mini',
457
+ 'gpt-4o-mini-2024-07-18',
458
+ 'gpt-4-turbo',
459
+ 'gpt-4-turbo-2024-04-09',
460
+ 'gpt-4-0125-preview',
461
+ 'gpt-4-turbo-preview',
462
+ 'gpt-4-1106-preview',
463
+ 'gpt-4-vision-preview',
464
+ 'gpt-4',
465
+ 'gpt-4-0314',
466
+ 'gpt-4-0613',
467
+ 'gpt-4-32k',
468
+ 'gpt-4-32k-0314',
469
+ 'gpt-4-32k-0613',
470
+ 'gpt-3.5-turbo',
471
+ 'gpt-3.5-turbo-16k',
472
+ 'gpt-3.5-turbo-0301',
473
+ 'gpt-3.5-turbo-0613',
474
+ 'gpt-3.5-turbo-1106',
475
+ 'gpt-3.5-turbo-0125',
476
+ 'gpt-3.5-turbo-16k-0613',
477
+ ]
478
+
479
+
480
+ type ParallelToolCalls = bool
481
+
482
+
483
+ class PredictionContent(TypedDict):
484
+ type: Literal['content']
485
+ content: str | list[ChatCompletionRequestMessageContentPartText]
486
+
487
+
488
+ type ReasoningEffort = Literal[
489
+ 'none', 'minimal', 'low', 'medium', 'high', 'xhigh'
490
+ ] | None
491
+
492
+
493
+ class IncompleteDetails(TypedDict):
494
+ reason: NotRequired[Literal['max_output_tokens', 'content_filter']]
495
+
496
+
497
+ class ResponseAudioDeltaEvent(TypedDict):
498
+ type: Literal['response.audio.delta']
499
+ sequence_number: int
500
+ delta: str
501
+
502
+
503
+ class ResponseAudioDoneEvent(TypedDict):
504
+ type: Literal['response.audio.done']
505
+ sequence_number: int
506
+
507
+
508
+ class ResponseAudioTranscriptDeltaEvent(TypedDict):
509
+ type: Literal['response.audio.transcript.delta']
510
+ delta: str
511
+ sequence_number: int
512
+
513
+
514
+ class ResponseAudioTranscriptDoneEvent(TypedDict):
515
+ type: Literal['response.audio.transcript.done']
516
+ sequence_number: int
517
+
518
+
519
+ class ResponseCodeInterpreterCallCodeDeltaEvent(TypedDict):
520
+ type: Literal['response.code_interpreter_call_code.delta']
521
+ output_index: int
522
+ item_id: str
523
+ delta: str
524
+ sequence_number: int
525
+
526
+
527
+ class ResponseCodeInterpreterCallCodeDoneEvent(TypedDict):
528
+ type: Literal['response.code_interpreter_call_code.done']
529
+ output_index: int
530
+ item_id: str
531
+ code: str
532
+ sequence_number: int
533
+
534
+
535
+ class ResponseCodeInterpreterCallCompletedEvent(TypedDict):
536
+ type: Literal['response.code_interpreter_call.completed']
537
+ output_index: int
538
+ item_id: str
539
+ sequence_number: int
540
+
541
+
542
+ class ResponseCodeInterpreterCallInProgressEvent(TypedDict):
543
+ type: Literal['response.code_interpreter_call.in_progress']
544
+ output_index: int
545
+ item_id: str
546
+ sequence_number: int
547
+
548
+
549
+ class ResponseCodeInterpreterCallInterpretingEvent(TypedDict):
550
+ type: Literal['response.code_interpreter_call.interpreting']
551
+ output_index: int
552
+ item_id: str
553
+ sequence_number: int
554
+
555
+
556
+ class ResponseCustomToolCallInputDeltaEvent(TypedDict):
557
+ type: Literal['response.custom_tool_call_input.delta']
558
+ sequence_number: int
559
+ output_index: int
560
+ item_id: str
561
+ delta: str
562
+
563
+
564
+ class ResponseCustomToolCallInputDoneEvent(TypedDict):
565
+ type: Literal['response.custom_tool_call_input.done']
566
+ sequence_number: int
567
+ output_index: int
568
+ item_id: str
569
+ input: str
570
+
571
+
572
+ type ResponseErrorCode = Literal[
573
+ 'server_error',
574
+ 'rate_limit_exceeded',
575
+ 'invalid_prompt',
576
+ 'vector_store_timeout',
577
+ 'invalid_image',
578
+ 'invalid_image_format',
579
+ 'invalid_base64_image',
580
+ 'invalid_image_url',
581
+ 'image_too_large',
582
+ 'image_too_small',
583
+ 'image_parse_error',
584
+ 'image_content_policy_violation',
585
+ 'invalid_image_mode',
586
+ 'image_file_too_large',
587
+ 'unsupported_image_media_type',
588
+ 'empty_image_file',
589
+ 'failed_to_download_image',
590
+ 'image_file_not_found',
591
+ ]
592
+
593
+
594
+ class ResponseErrorEvent(TypedDict):
595
+ type: Literal['error']
596
+ code: str | None
597
+ message: str
598
+ param: str | None
599
+ sequence_number: int
600
+
601
+
602
+ class ResponseFileSearchCallCompletedEvent(TypedDict):
603
+ type: Literal['response.file_search_call.completed']
604
+ output_index: int
605
+ item_id: str
606
+ sequence_number: int
607
+
608
+
609
+ class ResponseFileSearchCallInProgressEvent(TypedDict):
610
+ type: Literal['response.file_search_call.in_progress']
611
+ output_index: int
612
+ item_id: str
613
+ sequence_number: int
614
+
615
+
616
+ class ResponseFileSearchCallSearchingEvent(TypedDict):
617
+ type: Literal['response.file_search_call.searching']
618
+ output_index: int
619
+ item_id: str
620
+ sequence_number: int
621
+
622
+
623
+ class ResponseFormatJsonObject(TypedDict):
624
+ type: Literal['json_object']
625
+
626
+
627
+ class ResponseFormatJsonSchemaSchema(TypedDict):
628
+ pass
629
+
630
+
631
+ class ResponseFormatText(TypedDict):
632
+ type: Literal['text']
633
+
634
+
635
+ class ResponseFunctionCallArgumentsDeltaEvent(TypedDict):
636
+ type: Literal['response.function_call_arguments.delta']
637
+ item_id: str
638
+ output_index: int
639
+ sequence_number: int
640
+ delta: str
641
+
642
+
643
+ class ResponseFunctionCallArgumentsDoneEvent(TypedDict):
644
+ type: Literal['response.function_call_arguments.done']
645
+ item_id: str
646
+ name: str
647
+ output_index: int
648
+ sequence_number: int
649
+ arguments: str
650
+
651
+
652
+ class ResponseImageGenCallCompletedEvent(TypedDict):
653
+ type: Literal['response.image_generation_call.completed']
654
+ output_index: int
655
+ sequence_number: int
656
+ item_id: str
657
+
658
+
659
+ class ResponseImageGenCallGeneratingEvent(TypedDict):
660
+ type: Literal['response.image_generation_call.generating']
661
+ output_index: int
662
+ item_id: str
663
+ sequence_number: int
664
+
665
+
666
+ class ResponseImageGenCallInProgressEvent(TypedDict):
667
+ type: Literal['response.image_generation_call.in_progress']
668
+ output_index: int
669
+ item_id: str
670
+ sequence_number: int
671
+
672
+
673
+ class ResponseImageGenCallPartialImageEvent(TypedDict):
674
+ type: Literal['response.image_generation_call.partial_image']
675
+ output_index: int
676
+ item_id: str
677
+ sequence_number: int
678
+ partial_image_index: int
679
+ partial_image_b64: str
680
+
681
+
682
+ class TopLogprob1(TypedDict):
683
+ token: NotRequired[str]
684
+ logprob: NotRequired[float]
685
+
686
+
687
+ class ResponseLogProb(TypedDict):
688
+ token: str
689
+ logprob: float
690
+ top_logprobs: NotRequired[list[TopLogprob1]]
691
+
692
+
693
+ class ResponseMCPCallArgumentsDeltaEvent(TypedDict):
694
+ type: Literal['response.mcp_call_arguments.delta']
695
+ output_index: int
696
+ item_id: str
697
+ delta: str
698
+ sequence_number: int
699
+
700
+
701
+ class ResponseMCPCallArgumentsDoneEvent(TypedDict):
702
+ type: Literal['response.mcp_call_arguments.done']
703
+ output_index: int
704
+ item_id: str
705
+ arguments: str
706
+ sequence_number: int
707
+
708
+
709
+ class ResponseMCPCallCompletedEvent(TypedDict):
710
+ type: Literal['response.mcp_call.completed']
711
+ item_id: str
712
+ output_index: int
713
+ sequence_number: int
714
+
715
+
716
+ class ResponseMCPCallFailedEvent(TypedDict):
717
+ type: Literal['response.mcp_call.failed']
718
+ item_id: str
719
+ output_index: int
720
+ sequence_number: int
721
+
722
+
723
+ class ResponseMCPCallInProgressEvent(TypedDict):
724
+ type: Literal['response.mcp_call.in_progress']
725
+ sequence_number: int
726
+ output_index: int
727
+ item_id: str
728
+
729
+
730
+ class ResponseMCPListToolsCompletedEvent(TypedDict):
731
+ type: Literal['response.mcp_list_tools.completed']
732
+ item_id: str
733
+ output_index: int
734
+ sequence_number: int
735
+
736
+
737
+ class ResponseMCPListToolsFailedEvent(TypedDict):
738
+ type: Literal['response.mcp_list_tools.failed']
739
+ item_id: str
740
+ output_index: int
741
+ sequence_number: int
742
+
743
+
744
+ class ResponseMCPListToolsInProgressEvent(TypedDict):
745
+ type: Literal['response.mcp_list_tools.in_progress']
746
+ item_id: str
747
+ output_index: int
748
+ sequence_number: int
749
+
750
+
751
+ type ResponseModalities = list[Literal['text', 'audio']] | None
752
+
753
+
754
+ class ResponseOutputTextAnnotationAddedEvent(TypedDict):
755
+ type: Literal['response.output_text.annotation.added']
756
+ item_id: str
757
+ output_index: int
758
+ content_index: int
759
+ annotation_index: int
760
+ sequence_number: int
761
+ annotation: dict[str, Any]
762
+
763
+
764
+ class Part(TypedDict):
765
+ type: Literal['summary_text']
766
+ text: str
767
+
768
+
769
+ class ResponseReasoningSummaryPartAddedEvent(TypedDict):
770
+ type: Literal['response.reasoning_summary_part.added']
771
+ item_id: str
772
+ output_index: int
773
+ summary_index: int
774
+ sequence_number: int
775
+ part: Part
776
+
777
+
778
+ class ResponseReasoningSummaryPartDoneEvent(TypedDict):
779
+ type: Literal['response.reasoning_summary_part.done']
780
+ item_id: str
781
+ output_index: int
782
+ summary_index: int
783
+ sequence_number: int
784
+ part: Part
785
+
786
+
787
+ class ResponseReasoningSummaryTextDeltaEvent(TypedDict):
788
+ type: Literal['response.reasoning_summary_text.delta']
789
+ item_id: str
790
+ output_index: int
791
+ summary_index: int
792
+ delta: str
793
+ sequence_number: int
794
+
795
+
796
+ class ResponseReasoningSummaryTextDoneEvent(TypedDict):
797
+ type: Literal['response.reasoning_summary_text.done']
798
+ item_id: str
799
+ output_index: int
800
+ summary_index: int
801
+ text: str
802
+ sequence_number: int
803
+
804
+
805
+ class ResponseReasoningTextDeltaEvent(TypedDict):
806
+ type: Literal['response.reasoning_text.delta']
807
+ item_id: str
808
+ output_index: int
809
+ content_index: int
810
+ delta: str
811
+ sequence_number: int
812
+
813
+
814
+ class ResponseReasoningTextDoneEvent(TypedDict):
815
+ type: Literal['response.reasoning_text.done']
816
+ item_id: str
817
+ output_index: int
818
+ content_index: int
819
+ text: str
820
+ sequence_number: int
821
+
822
+
823
+ class ResponseRefusalDeltaEvent(TypedDict):
824
+ type: Literal['response.refusal.delta']
825
+ item_id: str
826
+ output_index: int
827
+ content_index: int
828
+ delta: str
829
+ sequence_number: int
830
+
831
+
832
+ class ResponseRefusalDoneEvent(TypedDict):
833
+ type: Literal['response.refusal.done']
834
+ item_id: str
835
+ output_index: int
836
+ content_index: int
837
+ refusal: str
838
+ sequence_number: int
839
+
840
+
841
+ class ResponseStreamOptions1(TypedDict):
842
+ include_obfuscation: NotRequired[bool]
843
+
844
+
845
+ type ResponseStreamOptions = ResponseStreamOptions1 | None
846
+
847
+
848
+ class ResponseTextDeltaEvent(TypedDict):
849
+ type: Literal['response.output_text.delta']
850
+ item_id: str
851
+ output_index: int
852
+ content_index: int
853
+ delta: str
854
+ sequence_number: int
855
+ logprobs: list[ResponseLogProb]
856
+
857
+
858
+ class ResponseTextDoneEvent(TypedDict):
859
+ type: Literal['response.output_text.done']
860
+ item_id: str
861
+ output_index: int
862
+ content_index: int
863
+ text: str
864
+ sequence_number: int
865
+ logprobs: list[ResponseLogProb]
866
+
867
+
868
+ class InputTokensDetails(TypedDict):
869
+ cached_tokens: int
870
+
871
+
872
+ class OutputTokensDetails(TypedDict):
873
+ reasoning_tokens: int
874
+
875
+
876
+ class ResponseUsage(TypedDict):
877
+ input_tokens: int
878
+ input_tokens_details: InputTokensDetails
879
+ output_tokens: int
880
+ output_tokens_details: OutputTokensDetails
881
+ total_tokens: int
882
+
883
+
884
+ class ResponseWebSearchCallCompletedEvent(TypedDict):
885
+ type: Literal['response.web_search_call.completed']
886
+ output_index: int
887
+ item_id: str
888
+ sequence_number: int
889
+
890
+
891
+ class ResponseWebSearchCallInProgressEvent(TypedDict):
892
+ type: Literal['response.web_search_call.in_progress']
893
+ output_index: int
894
+ item_id: str
895
+ sequence_number: int
896
+
897
+
898
+ class ResponseWebSearchCallSearchingEvent(TypedDict):
899
+ type: Literal['response.web_search_call.searching']
900
+ output_index: int
901
+ item_id: str
902
+ sequence_number: int
903
+
904
+
905
+ type ServiceTier = Literal['auto', 'default', 'flex', 'scale', 'priority'] | None
906
+
907
+
908
+ type StopConfiguration = str | list[str] | None
909
+
910
+
911
+ class TextResponseFormatJsonSchema(TypedDict):
912
+ type: Literal['json_schema']
913
+ description: NotRequired[str]
914
+ name: str
915
+ schema: ResponseFormatJsonSchemaSchema
916
+ strict: NotRequired[bool | None]
917
+
918
+
919
+ class ToolChoiceAllowed(TypedDict):
920
+ type: Literal['allowed_tools']
921
+ mode: Literal['auto', 'required']
922
+ tools: list[dict[str, Any]]
923
+
924
+
925
+ class ToolChoiceCustom(TypedDict):
926
+ type: Literal['custom']
927
+ name: str
928
+
929
+
930
+ class ToolChoiceFunction(TypedDict):
931
+ type: Literal['function']
932
+ name: str
933
+
934
+
935
+ class ToolChoiceMCP(TypedDict):
936
+ type: Literal['mcp']
937
+ server_label: str
938
+ name: NotRequired[str | None]
939
+
940
+
941
+ type ToolChoiceOptions = Literal['none', 'auto', 'required']
942
+
943
+
944
+ class ToolChoiceTypes(TypedDict):
945
+ type: Literal[
946
+ 'file_search',
947
+ 'web_search_preview',
948
+ 'computer',
949
+ 'computer_use_preview',
950
+ 'computer_use',
951
+ 'web_search_preview_2025_03_11',
952
+ 'image_generation',
953
+ 'code_interpreter',
954
+ ]
955
+
956
+
957
+ type VectorStoreFileAttributes = dict[str, str | float | bool] | None
958
+
959
+
960
+ type Verbosity = Literal['low', 'medium', 'high'] | None
961
+
962
+
963
+ class VoiceIdsOrCustomVoice1(TypedDict, closed=True):
964
+ id: str
965
+
966
+
967
+ type VoiceIdsShared = str | Literal[
968
+ 'alloy',
969
+ 'ash',
970
+ 'ballad',
971
+ 'coral',
972
+ 'echo',
973
+ 'sage',
974
+ 'shimmer',
975
+ 'verse',
976
+ 'marin',
977
+ 'cedar',
978
+ ]
979
+
980
+
981
+ class WebSearchActionFind(TypedDict):
982
+ type: Literal['find_in_page']
983
+ url: str
984
+ pattern: str
985
+
986
+
987
+ class WebSearchActionOpenPage(TypedDict):
988
+ type: Literal['open_page']
989
+ url: NotRequired[str | None]
990
+
991
+
992
+ class Source(TypedDict):
993
+ type: Literal['url']
994
+ url: str
995
+
996
+
997
+ class WebSearchActionSearch(TypedDict):
998
+ type: Literal['search']
999
+ query: str
1000
+ queries: NotRequired[list[str]]
1001
+ sources: NotRequired[list[Source]]
1002
+
1003
+
1004
+ class WebSearchApproximateLocation1(TypedDict):
1005
+ type: NotRequired[Literal['approximate']]
1006
+ country: NotRequired[str | None]
1007
+ region: NotRequired[str | None]
1008
+ city: NotRequired[str | None]
1009
+ timezone: NotRequired[str | None]
1010
+
1011
+
1012
+ type WebSearchApproximateLocation = WebSearchApproximateLocation1 | None
1013
+
1014
+
1015
+ type WebSearchContextSize = Literal['low', 'medium', 'high']
1016
+
1017
+
1018
+ class WebSearchLocation(TypedDict):
1019
+ country: NotRequired[str]
1020
+ region: NotRequired[str]
1021
+ city: NotRequired[str]
1022
+ timezone: NotRequired[str]
1023
+
1024
+
1025
+ class Filters(TypedDict):
1026
+ allowed_domains: NotRequired[list[str] | None]
1027
+
1028
+
1029
+ class WebSearchTool(TypedDict):
1030
+ type: Literal['web_search', 'web_search_2025_08_26']
1031
+ filters: NotRequired[Filters | None]
1032
+ user_location: NotRequired[WebSearchApproximateLocation]
1033
+ search_context_size: NotRequired[Literal['low', 'medium', 'high']]
1034
+
1035
+
1036
+ class WebSearchToolCall(TypedDict):
1037
+ id: str
1038
+ type: Literal['web_search_call']
1039
+ status: Literal['in_progress', 'searching', 'completed', 'failed']
1040
+ action: WebSearchActionSearch | WebSearchActionOpenPage | WebSearchActionFind
1041
+
1042
+
1043
+ class Data(TypedDict):
1044
+ id: str
1045
+
1046
+
1047
+ class WebhookBatchCancelled(TypedDict):
1048
+ created_at: int
1049
+ id: str
1050
+ data: Data
1051
+ object: NotRequired[Literal['event']]
1052
+ type: Literal['batch.cancelled']
1053
+
1054
+
1055
+ class WebhookBatchCompleted(TypedDict):
1056
+ created_at: int
1057
+ id: str
1058
+ data: Data
1059
+ object: NotRequired[Literal['event']]
1060
+ type: Literal['batch.completed']
1061
+
1062
+
1063
+ class WebhookBatchExpired(TypedDict):
1064
+ created_at: int
1065
+ id: str
1066
+ data: Data
1067
+ object: NotRequired[Literal['event']]
1068
+ type: Literal['batch.expired']
1069
+
1070
+
1071
+ class WebhookBatchFailed(TypedDict):
1072
+ created_at: int
1073
+ id: str
1074
+ data: Data
1075
+ object: NotRequired[Literal['event']]
1076
+ type: Literal['batch.failed']
1077
+
1078
+
1079
+ class WebhookEvalRunCanceled(TypedDict):
1080
+ created_at: int
1081
+ id: str
1082
+ data: Data
1083
+ object: NotRequired[Literal['event']]
1084
+ type: Literal['eval.run.canceled']
1085
+
1086
+
1087
+ class WebhookEvalRunFailed(TypedDict):
1088
+ created_at: int
1089
+ id: str
1090
+ data: Data
1091
+ object: NotRequired[Literal['event']]
1092
+ type: Literal['eval.run.failed']
1093
+
1094
+
1095
+ class WebhookEvalRunSucceeded(TypedDict):
1096
+ created_at: int
1097
+ id: str
1098
+ data: Data
1099
+ object: NotRequired[Literal['event']]
1100
+ type: Literal['eval.run.succeeded']
1101
+
1102
+
1103
+ class WebhookFineTuningJobCancelled(TypedDict):
1104
+ created_at: int
1105
+ id: str
1106
+ data: Data
1107
+ object: NotRequired[Literal['event']]
1108
+ type: Literal['fine_tuning.job.cancelled']
1109
+
1110
+
1111
+ class WebhookFineTuningJobFailed(TypedDict):
1112
+ created_at: int
1113
+ id: str
1114
+ data: Data
1115
+ object: NotRequired[Literal['event']]
1116
+ type: Literal['fine_tuning.job.failed']
1117
+
1118
+
1119
+ class WebhookFineTuningJobSucceeded(TypedDict):
1120
+ created_at: int
1121
+ id: str
1122
+ data: Data
1123
+ object: NotRequired[Literal['event']]
1124
+ type: Literal['fine_tuning.job.succeeded']
1125
+
1126
+
1127
+ class SipHeader(TypedDict):
1128
+ name: str
1129
+ value: str
1130
+
1131
+
1132
+ class Data10(TypedDict):
1133
+ call_id: str
1134
+ sip_headers: list[SipHeader]
1135
+
1136
+
1137
+ class WebhookRealtimeCallIncoming(TypedDict):
1138
+ created_at: int
1139
+ id: str
1140
+ data: Data10
1141
+ object: NotRequired[Literal['event']]
1142
+ type: Literal['realtime.call.incoming']
1143
+
1144
+
1145
+ class Data11(TypedDict):
1146
+ id: str
1147
+
1148
+
1149
+ class WebhookResponseCancelled(TypedDict):
1150
+ created_at: int
1151
+ id: str
1152
+ data: Data11
1153
+ object: NotRequired[Literal['event']]
1154
+ type: Literal['response.cancelled']
1155
+
1156
+
1157
+ class WebhookResponseCompleted(TypedDict):
1158
+ created_at: int
1159
+ id: str
1160
+ data: Data11
1161
+ object: NotRequired[Literal['event']]
1162
+ type: Literal['response.completed']
1163
+
1164
+
1165
+ class WebhookResponseFailed(TypedDict):
1166
+ created_at: int
1167
+ id: str
1168
+ data: Data11
1169
+ object: NotRequired[Literal['event']]
1170
+ type: Literal['response.failed']
1171
+
1172
+
1173
+ class WebhookResponseIncomplete(TypedDict):
1174
+ created_at: int
1175
+ id: str
1176
+ data: Data11
1177
+ object: NotRequired[Literal['event']]
1178
+ type: Literal['response.incomplete']
1179
+
1180
+
1181
+ class SkillReferenceParam(TypedDict):
1182
+ type: Literal['skill_reference']
1183
+ skill_id: str
1184
+ version: NotRequired[str]
1185
+
1186
+
1187
+ class InlineSkillSourceParam(TypedDict):
1188
+ type: Literal['base64']
1189
+ media_type: Literal['application/zip']
1190
+ data: str
1191
+
1192
+
1193
+ class InlineSkillParam(TypedDict):
1194
+ type: Literal['inline']
1195
+ name: str
1196
+ description: str
1197
+ source: InlineSkillSourceParam
1198
+
1199
+
1200
+ class ContainerNetworkPolicyDisabledParam(TypedDict):
1201
+ type: Literal['disabled']
1202
+
1203
+
1204
+ class ContainerNetworkPolicyDomainSecretParam(TypedDict):
1205
+ domain: str
1206
+ name: str
1207
+ value: str
1208
+
1209
+
1210
+ class ContainerNetworkPolicyAllowlistParam(TypedDict):
1211
+ type: Literal['allowlist']
1212
+ allowed_domains: list[str]
1213
+ domain_secrets: NotRequired[list[ContainerNetworkPolicyDomainSecretParam]]
1214
+
1215
+
1216
+ type IncludeEnum = Literal[
1217
+ 'file_search_call.results',
1218
+ 'web_search_call.results',
1219
+ 'web_search_call.action.sources',
1220
+ 'message.input_image.image_url',
1221
+ 'computer_call_output.output.image_url',
1222
+ 'code_interpreter_call.outputs',
1223
+ 'reasoning.encrypted_content',
1224
+ 'message.output_text.logprobs',
1225
+ ]
1226
+
1227
+
1228
+ class InputTextContent(TypedDict):
1229
+ type: Literal['input_text']
1230
+ text: str
1231
+
1232
+
1233
+ class FileCitationBody(TypedDict):
1234
+ type: Literal['file_citation']
1235
+ file_id: str
1236
+ index: int
1237
+ filename: str
1238
+
1239
+
1240
+ class UrlCitationBody(TypedDict):
1241
+ type: Literal['url_citation']
1242
+ url: str
1243
+ start_index: int
1244
+ end_index: int
1245
+ title: str
1246
+
1247
+
1248
+ class ContainerFileCitationBody(TypedDict):
1249
+ type: Literal['container_file_citation']
1250
+ container_id: str
1251
+ file_id: str
1252
+ start_index: int
1253
+ end_index: int
1254
+ filename: str
1255
+
1256
+
1257
+ type Annotation1 = FileCitationBody | UrlCitationBody | ContainerFileCitationBody | FilePath
1258
+
1259
+
1260
+ class TopLogProb(TypedDict):
1261
+ token: str
1262
+ logprob: float
1263
+ bytes: list[int]
1264
+
1265
+
1266
+ class LogProb(TypedDict):
1267
+ token: str
1268
+ logprob: float
1269
+ bytes: list[int]
1270
+ top_logprobs: list[TopLogProb]
1271
+
1272
+
1273
+ class OutputTextContent(TypedDict):
1274
+ type: Literal['output_text']
1275
+ text: str
1276
+ annotations: list[Annotation1]
1277
+ logprobs: list[LogProb]
1278
+
1279
+
1280
+ class SummaryTextContent(TypedDict):
1281
+ type: Literal['summary_text']
1282
+ text: str
1283
+
1284
+
1285
+ class ReasoningTextContent(TypedDict):
1286
+ type: Literal['reasoning_text']
1287
+ text: str
1288
+
1289
+
1290
+ class RefusalContent(TypedDict):
1291
+ type: Literal['refusal']
1292
+ refusal: str
1293
+
1294
+
1295
+ type ImageDetail = Literal['low', 'high', 'auto', 'original']
1296
+
1297
+
1298
+ class InputImageContent(TypedDict):
1299
+ type: Literal['input_image']
1300
+ image_url: NotRequired[str | None]
1301
+ file_id: NotRequired[str | None]
1302
+ detail: ImageDetail
1303
+
1304
+
1305
+ type FileInputDetail = Literal['low', 'high']
1306
+
1307
+
1308
+ class InputFileContent(TypedDict):
1309
+ type: Literal['input_file']
1310
+ file_id: NotRequired[str | None]
1311
+ filename: NotRequired[str]
1312
+ file_data: NotRequired[str]
1313
+ file_url: NotRequired[str]
1314
+ detail: NotRequired[FileInputDetail]
1315
+
1316
+
1317
+ type FunctionCallStatus = Literal['in_progress', 'completed', 'incomplete']
1318
+
1319
+
1320
+ type FunctionCallOutputStatusEnum = Literal['in_progress', 'completed', 'incomplete']
1321
+
1322
+
1323
+ type ClickButtonType = Literal['left', 'right', 'wheel', 'back', 'forward']
1324
+
1325
+
1326
+ class ClickParam(TypedDict):
1327
+ type: Literal['click']
1328
+ button: ClickButtonType
1329
+ x: int
1330
+ y: int
1331
+ keys: NotRequired[list[str] | None]
1332
+
1333
+
1334
+ class DoubleClickAction(TypedDict):
1335
+ type: Literal['double_click']
1336
+ x: int
1337
+ y: int
1338
+ keys: list[str] | None
1339
+
1340
+
1341
+ class CoordParam(TypedDict):
1342
+ x: int
1343
+ y: int
1344
+
1345
+
1346
+ class DragParam(TypedDict):
1347
+ type: Literal['drag']
1348
+ path: list[CoordParam]
1349
+ keys: NotRequired[list[str] | None]
1350
+
1351
+
1352
+ class KeyPressAction(TypedDict):
1353
+ type: Literal['keypress']
1354
+ keys: list[str]
1355
+
1356
+
1357
+ class MoveParam(TypedDict):
1358
+ type: Literal['move']
1359
+ x: int
1360
+ y: int
1361
+ keys: NotRequired[list[str] | None]
1362
+
1363
+
1364
+ class ScreenshotParam(TypedDict):
1365
+ type: Literal['screenshot']
1366
+
1367
+
1368
+ class ScrollParam(TypedDict):
1369
+ type: Literal['scroll']
1370
+ x: int
1371
+ y: int
1372
+ scroll_x: int
1373
+ scroll_y: int
1374
+ keys: NotRequired[list[str] | None]
1375
+
1376
+
1377
+ class TypeParam(TypedDict):
1378
+ type: Literal['type']
1379
+ text: str
1380
+
1381
+
1382
+ class WaitParam(TypedDict):
1383
+ type: Literal['wait']
1384
+
1385
+
1386
+ class ComputerCallSafetyCheckParam(TypedDict):
1387
+ id: str
1388
+ code: NotRequired[str | None]
1389
+ message: NotRequired[str | None]
1390
+
1391
+
1392
+ type ComputerCallOutputStatus = Literal['completed', 'incomplete', 'failed']
1393
+
1394
+
1395
+ type ToolSearchExecutionType = Literal['server', 'client']
1396
+
1397
+
1398
+ class ToolSearchCall(TypedDict):
1399
+ type: Literal['tool_search_call']
1400
+ id: str
1401
+ call_id: str | None
1402
+ execution: ToolSearchExecutionType
1403
+ arguments: Any
1404
+ status: FunctionCallStatus
1405
+ created_by: NotRequired[str]
1406
+
1407
+
1408
+ class FunctionTool(TypedDict):
1409
+ type: Literal['function']
1410
+ name: str
1411
+ description: NotRequired[str | None]
1412
+ parameters: dict[str, Any] | None
1413
+ strict: bool | None
1414
+ defer_loading: NotRequired[bool]
1415
+
1416
+
1417
+ type RankerVersionType = Literal['auto', 'default-2024-11-15']
1418
+
1419
+
1420
+ class HybridSearchOptions(TypedDict):
1421
+ embedding_weight: float
1422
+ text_weight: float
1423
+
1424
+
1425
+ class RankingOptions(TypedDict):
1426
+ ranker: NotRequired[RankerVersionType]
1427
+ score_threshold: NotRequired[float]
1428
+ hybrid_search: NotRequired[HybridSearchOptions]
1429
+
1430
+
1431
+ class ComputerTool(TypedDict):
1432
+ type: Literal['computer']
1433
+
1434
+
1435
+ type ComputerEnvironment = Literal['windows', 'mac', 'linux', 'ubuntu', 'browser']
1436
+
1437
+
1438
+ class ComputerUsePreviewTool(TypedDict):
1439
+ type: Literal['computer_use_preview']
1440
+ environment: ComputerEnvironment
1441
+ display_width: int
1442
+ display_height: int
1443
+
1444
+
1445
+ type ContainerMemoryLimit = Literal['1g', '4g', '16g', '64g']
1446
+
1447
+
1448
+ class AutoCodeInterpreterToolParam(TypedDict):
1449
+ type: Literal['auto']
1450
+ file_ids: NotRequired[list[str]]
1451
+ memory_limit: NotRequired[ContainerMemoryLimit | None]
1452
+ network_policy: NotRequired[
1453
+ ContainerNetworkPolicyDisabledParam | ContainerNetworkPolicyAllowlistParam
1454
+ ]
1455
+
1456
+
1457
+ type InputFidelity = Literal['high', 'low']
1458
+
1459
+
1460
+ type ImageGenActionEnum = Literal['generate', 'edit', 'auto']
1461
+
1462
+
1463
+ class LocalShellToolParam(TypedDict):
1464
+ type: Literal['local_shell']
1465
+
1466
+
1467
+ type Skills = SkillReferenceParam | InlineSkillParam
1468
+
1469
+
1470
+ class ContainerAutoParam(TypedDict):
1471
+ type: Literal['container_auto']
1472
+ file_ids: NotRequired[list[str]]
1473
+ memory_limit: NotRequired[ContainerMemoryLimit | None]
1474
+ network_policy: NotRequired[
1475
+ ContainerNetworkPolicyDisabledParam | ContainerNetworkPolicyAllowlistParam
1476
+ ]
1477
+ skills: NotRequired[list[Skills]]
1478
+
1479
+
1480
+ class LocalSkillParam(TypedDict):
1481
+ name: str
1482
+ description: str
1483
+ path: str
1484
+
1485
+
1486
+ class LocalEnvironmentParam(TypedDict):
1487
+ type: Literal['local']
1488
+ skills: NotRequired[list[LocalSkillParam]]
1489
+
1490
+
1491
+ class ContainerReferenceParam(TypedDict):
1492
+ type: Literal['container_reference']
1493
+ container_id: str
1494
+
1495
+
1496
+ class FunctionShellToolParam(TypedDict):
1497
+ type: Literal['shell']
1498
+ environment: NotRequired[
1499
+ ContainerAutoParam | LocalEnvironmentParam | ContainerReferenceParam | None
1500
+ ]
1501
+
1502
+
1503
+ class CustomTextFormatParam(TypedDict):
1504
+ type: Literal['text']
1505
+
1506
+
1507
+ type GrammarSyntax1 = Literal['lark', 'regex']
1508
+
1509
+
1510
+ class CustomGrammarFormatParam(TypedDict):
1511
+ type: Literal['grammar']
1512
+ syntax: GrammarSyntax1
1513
+ definition: str
1514
+
1515
+
1516
+ class CustomToolParam(TypedDict):
1517
+ type: Literal['custom']
1518
+ name: str
1519
+ description: NotRequired[str]
1520
+ format: NotRequired[CustomTextFormatParam | CustomGrammarFormatParam]
1521
+ defer_loading: NotRequired[bool]
1522
+
1523
+
1524
+ class EmptyModelParam(TypedDict):
1525
+ pass
1526
+
1527
+
1528
+ class FunctionToolParam(TypedDict):
1529
+ name: str
1530
+ description: NotRequired[str | None]
1531
+ parameters: NotRequired[EmptyModelParam | None]
1532
+ strict: NotRequired[bool | None]
1533
+ type: Literal['function']
1534
+ defer_loading: NotRequired[bool]
1535
+
1536
+
1537
+ type Tools = FunctionToolParam | CustomToolParam
1538
+
1539
+
1540
+ class NamespaceToolParam(TypedDict):
1541
+ type: Literal['namespace']
1542
+ name: str
1543
+ description: str
1544
+ tools: list[Tools]
1545
+
1546
+
1547
+ class ToolSearchToolParam(TypedDict):
1548
+ type: Literal['tool_search']
1549
+ execution: NotRequired[ToolSearchExecutionType]
1550
+ description: NotRequired[str | None]
1551
+ parameters: NotRequired[EmptyModelParam | None]
1552
+
1553
+
1554
+ class ApproximateLocation(TypedDict):
1555
+ type: Literal['approximate']
1556
+ country: NotRequired[str | None]
1557
+ region: NotRequired[str | None]
1558
+ city: NotRequired[str | None]
1559
+ timezone: NotRequired[str | None]
1560
+
1561
+
1562
+ type SearchContextSize = Literal['low', 'medium', 'high']
1563
+
1564
+
1565
+ type SearchContentType = Literal['text', 'image']
1566
+
1567
+
1568
+ class WebSearchPreviewTool(TypedDict):
1569
+ type: Literal['web_search_preview', 'web_search_preview_2025_03_11']
1570
+ user_location: NotRequired[ApproximateLocation | None]
1571
+ search_context_size: NotRequired[SearchContextSize]
1572
+ search_content_types: NotRequired[list[SearchContentType]]
1573
+
1574
+
1575
+ class ApplyPatchToolParam(TypedDict):
1576
+ type: Literal['apply_patch']
1577
+
1578
+
1579
+ class CompactionBody(TypedDict):
1580
+ type: Literal['compaction']
1581
+ id: str
1582
+ encrypted_content: str
1583
+ created_by: NotRequired[str]
1584
+
1585
+
1586
+ class CodeInterpreterOutputLogs(TypedDict):
1587
+ type: Literal['logs']
1588
+ logs: str
1589
+
1590
+
1591
+ class CodeInterpreterOutputImage(TypedDict):
1592
+ type: Literal['image']
1593
+ url: str
1594
+
1595
+
1596
+ class LocalShellExecAction(TypedDict):
1597
+ type: Literal['exec']
1598
+ command: list[str]
1599
+ timeout_ms: NotRequired[int | None]
1600
+ working_directory: NotRequired[str | None]
1601
+ env: dict[str, str]
1602
+ user: NotRequired[str | None]
1603
+
1604
+
1605
+ class FunctionShellAction(TypedDict):
1606
+ commands: list[str]
1607
+ timeout_ms: int | None
1608
+ max_output_length: int | None
1609
+
1610
+
1611
+ type FunctionShellCallStatus = Literal['in_progress', 'completed', 'incomplete']
1612
+
1613
+
1614
+ class LocalEnvironmentResource(TypedDict):
1615
+ type: Literal['local']
1616
+
1617
+
1618
+ class ContainerReferenceResource(TypedDict):
1619
+ type: Literal['container_reference']
1620
+ container_id: str
1621
+
1622
+
1623
+ class FunctionShellCall(TypedDict):
1624
+ type: Literal['shell_call']
1625
+ id: str
1626
+ call_id: str
1627
+ action: FunctionShellAction
1628
+ status: FunctionShellCallStatus
1629
+ environment: LocalEnvironmentResource | ContainerReferenceResource | None
1630
+ created_by: NotRequired[str]
1631
+
1632
+
1633
+ type FunctionShellCallOutputStatusEnum = Literal[
1634
+ 'in_progress', 'completed', 'incomplete'
1635
+ ]
1636
+
1637
+
1638
+ class FunctionShellCallOutputTimeoutOutcome(TypedDict):
1639
+ type: Literal['timeout']
1640
+
1641
+
1642
+ class FunctionShellCallOutputExitOutcome(TypedDict):
1643
+ type: Literal['exit']
1644
+ exit_code: int
1645
+
1646
+
1647
+ class FunctionShellCallOutputContent(TypedDict):
1648
+ stdout: str
1649
+ stderr: str
1650
+ outcome: FunctionShellCallOutputTimeoutOutcome | FunctionShellCallOutputExitOutcome
1651
+ created_by: NotRequired[str]
1652
+
1653
+
1654
+ class FunctionShellCallOutput(TypedDict):
1655
+ type: Literal['shell_call_output']
1656
+ id: str
1657
+ call_id: str
1658
+ status: FunctionShellCallOutputStatusEnum
1659
+ output: list[FunctionShellCallOutputContent]
1660
+ max_output_length: int | None
1661
+ created_by: NotRequired[str]
1662
+
1663
+
1664
+ type ApplyPatchCallStatus = Literal['in_progress', 'completed']
1665
+
1666
+
1667
+ class ApplyPatchCreateFileOperation(TypedDict):
1668
+ type: Literal['create_file']
1669
+ path: str
1670
+ diff: str
1671
+
1672
+
1673
+ class ApplyPatchDeleteFileOperation(TypedDict):
1674
+ type: Literal['delete_file']
1675
+ path: str
1676
+
1677
+
1678
+ class ApplyPatchUpdateFileOperation(TypedDict):
1679
+ type: Literal['update_file']
1680
+ path: str
1681
+ diff: str
1682
+
1683
+
1684
+ class ApplyPatchToolCall(TypedDict):
1685
+ type: Literal['apply_patch_call']
1686
+ id: str
1687
+ call_id: str
1688
+ status: ApplyPatchCallStatus
1689
+ operation: (
1690
+ ApplyPatchCreateFileOperation
1691
+ | ApplyPatchDeleteFileOperation
1692
+ | ApplyPatchUpdateFileOperation
1693
+ )
1694
+ created_by: NotRequired[str]
1695
+
1696
+
1697
+ type ApplyPatchCallOutputStatus = Literal['completed', 'failed']
1698
+
1699
+
1700
+ class ApplyPatchToolCallOutput(TypedDict):
1701
+ type: Literal['apply_patch_call_output']
1702
+ id: str
1703
+ call_id: str
1704
+ status: ApplyPatchCallOutputStatus
1705
+ output: NotRequired[str | None]
1706
+ created_by: NotRequired[str]
1707
+
1708
+
1709
+ type MCPToolCallStatus = Literal[
1710
+ 'in_progress', 'completed', 'incomplete', 'calling', 'failed'
1711
+ ]
1712
+
1713
+
1714
+ type DetailEnum = Literal['low', 'high', 'auto', 'original']
1715
+
1716
+
1717
+ type FunctionCallItemStatus = Literal['in_progress', 'completed', 'incomplete']
1718
+
1719
+
1720
+ class ComputerCallOutputItemParam(TypedDict):
1721
+ id: NotRequired[str | None]
1722
+ call_id: str
1723
+ type: Literal['computer_call_output']
1724
+ output: ComputerScreenshotImage
1725
+ acknowledged_safety_checks: NotRequired[list[ComputerCallSafetyCheckParam] | None]
1726
+ status: NotRequired[FunctionCallItemStatus | None]
1727
+
1728
+
1729
+ class InputTextContentParam(TypedDict):
1730
+ type: Literal['input_text']
1731
+ text: str
1732
+
1733
+
1734
+ class InputImageContentParamAutoParam(TypedDict):
1735
+ type: Literal['input_image']
1736
+ image_url: NotRequired[str | None]
1737
+ file_id: NotRequired[str | None]
1738
+ detail: NotRequired[DetailEnum | None]
1739
+
1740
+
1741
+ type FileDetailEnum = Literal['low', 'high']
1742
+
1743
+
1744
+ class InputFileContentParam(TypedDict):
1745
+ type: Literal['input_file']
1746
+ file_id: NotRequired[str | None]
1747
+ filename: NotRequired[str | None]
1748
+ file_data: NotRequired[str | None]
1749
+ file_url: NotRequired[str | None]
1750
+ detail: NotRequired[FileDetailEnum]
1751
+
1752
+
1753
+ type Output = InputTextContentParam | InputImageContentParamAutoParam | InputFileContentParam
1754
+
1755
+
1756
+ class FunctionCallOutputItemParam(TypedDict):
1757
+ id: NotRequired[str | None]
1758
+ call_id: str
1759
+ type: Literal['function_call_output']
1760
+ output: str | list[Output]
1761
+ status: NotRequired[FunctionCallItemStatus | None]
1762
+
1763
+
1764
+ class ToolSearchCallItemParam(TypedDict):
1765
+ id: NotRequired[str | None]
1766
+ call_id: NotRequired[str | None]
1767
+ type: Literal['tool_search_call']
1768
+ execution: NotRequired[ToolSearchExecutionType]
1769
+ arguments: EmptyModelParam
1770
+ status: NotRequired[FunctionCallItemStatus | None]
1771
+
1772
+
1773
+ class CompactionSummaryItemParam(TypedDict):
1774
+ id: NotRequired[str | None]
1775
+ type: Literal['compaction']
1776
+ encrypted_content: str
1777
+
1778
+
1779
+ class FunctionShellActionParam(TypedDict):
1780
+ commands: list[str]
1781
+ timeout_ms: NotRequired[int | None]
1782
+ max_output_length: NotRequired[int | None]
1783
+
1784
+
1785
+ type FunctionShellCallItemStatus = Literal['in_progress', 'completed', 'incomplete']
1786
+
1787
+
1788
+ class FunctionShellCallItemParam(TypedDict):
1789
+ id: NotRequired[str | None]
1790
+ call_id: str
1791
+ type: Literal['shell_call']
1792
+ action: FunctionShellActionParam
1793
+ status: NotRequired[FunctionShellCallItemStatus | None]
1794
+ environment: NotRequired[LocalEnvironmentParam | ContainerReferenceParam | None]
1795
+
1796
+
1797
+ class FunctionShellCallOutputTimeoutOutcomeParam(TypedDict):
1798
+ type: Literal['timeout']
1799
+
1800
+
1801
+ class FunctionShellCallOutputExitOutcomeParam(TypedDict):
1802
+ type: Literal['exit']
1803
+ exit_code: int
1804
+
1805
+
1806
+ type FunctionShellCallOutputOutcomeParam = FunctionShellCallOutputTimeoutOutcomeParam | FunctionShellCallOutputExitOutcomeParam
1807
+
1808
+
1809
+ class FunctionShellCallOutputContentParam(TypedDict):
1810
+ stdout: str
1811
+ stderr: str
1812
+ outcome: FunctionShellCallOutputOutcomeParam
1813
+
1814
+
1815
+ class FunctionShellCallOutputItemParam(TypedDict):
1816
+ id: NotRequired[str | None]
1817
+ call_id: str
1818
+ type: Literal['shell_call_output']
1819
+ output: list[FunctionShellCallOutputContentParam]
1820
+ status: NotRequired[FunctionShellCallItemStatus | None]
1821
+ max_output_length: NotRequired[int | None]
1822
+
1823
+
1824
+ type ApplyPatchCallStatusParam = Literal['in_progress', 'completed']
1825
+
1826
+
1827
+ class ApplyPatchCreateFileOperationParam(TypedDict):
1828
+ type: Literal['create_file']
1829
+ path: str
1830
+ diff: str
1831
+
1832
+
1833
+ class ApplyPatchDeleteFileOperationParam(TypedDict):
1834
+ type: Literal['delete_file']
1835
+ path: str
1836
+
1837
+
1838
+ class ApplyPatchUpdateFileOperationParam(TypedDict):
1839
+ type: Literal['update_file']
1840
+ path: str
1841
+ diff: str
1842
+
1843
+
1844
+ type ApplyPatchOperationParam = ApplyPatchCreateFileOperationParam | ApplyPatchDeleteFileOperationParam | ApplyPatchUpdateFileOperationParam
1845
+
1846
+
1847
+ class ApplyPatchToolCallItemParam(TypedDict):
1848
+ type: Literal['apply_patch_call']
1849
+ id: NotRequired[str | None]
1850
+ call_id: str
1851
+ status: ApplyPatchCallStatusParam
1852
+ operation: ApplyPatchOperationParam
1853
+
1854
+
1855
+ type ApplyPatchCallOutputStatusParam = Literal['completed', 'failed']
1856
+
1857
+
1858
+ class ApplyPatchToolCallOutputItemParam(TypedDict):
1859
+ type: Literal['apply_patch_call_output']
1860
+ id: NotRequired[str | None]
1861
+ call_id: str
1862
+ status: ApplyPatchCallOutputStatusParam
1863
+ output: NotRequired[str | None]
1864
+
1865
+
1866
+ class ItemReferenceParam(TypedDict):
1867
+ type: NotRequired[Literal['item_reference'] | None]
1868
+ id: str
1869
+
1870
+
1871
+ class SpecificApplyPatchParam(TypedDict):
1872
+ type: Literal['apply_patch']
1873
+
1874
+
1875
+ class SpecificFunctionShellParam(TypedDict):
1876
+ type: Literal['shell']
1877
+
1878
+
1879
+ class ConversationParam2(TypedDict):
1880
+ id: str
1881
+
1882
+
1883
+ class ContextManagementParam(TypedDict):
1884
+ type: str
1885
+ compact_threshold: NotRequired[int | None]
1886
+
1887
+
1888
+ class Conversation2(TypedDict):
1889
+ id: str
1890
+
1891
+
1892
+ class CompoundFilter(TypedDict, closed=True):
1893
+ type: Literal['and', 'or']
1894
+ filters: list[ComparisonFilter | CompoundFilter]
1895
+
1896
+
1897
+ class Error(TypedDict):
1898
+ message: str
1899
+ type: str
1900
+ code: NotRequired[str]
1901
+ param: NotRequired[str]
1902
+
1903
+
1904
+ class FlexError(TypedDict):
1905
+ error: Error
1906
+
1907
+
1908
+ class ChatCompletionFunctions(TypedDict):
1909
+ description: NotRequired[str]
1910
+ name: str
1911
+ parameters: NotRequired[FunctionParameters]
1912
+
1913
+
1914
+ type ChatCompletionRequestAssistantMessageContentPart = ChatCompletionRequestMessageContentPartText | ChatCompletionRequestMessageContentPartRefusal
1915
+
1916
+
1917
+ class ChatCompletionRequestDeveloperMessage(TypedDict):
1918
+ content: str | list[ChatCompletionRequestMessageContentPartText]
1919
+ role: Literal['developer']
1920
+ name: NotRequired[str]
1921
+
1922
+
1923
+ class ChatCompletionRequestSystemMessage(TypedDict):
1924
+ content: str | list[ChatCompletionRequestSystemMessageContentPart]
1925
+ role: Literal['system']
1926
+ name: NotRequired[str]
1927
+
1928
+
1929
+ class ChatCompletionRequestToolMessage(TypedDict):
1930
+ role: Literal['tool']
1931
+ content: str | list[ChatCompletionRequestToolMessageContentPart]
1932
+ tool_call_id: str
1933
+
1934
+
1935
+ class ChatCompletionRequestUserMessage(TypedDict):
1936
+ content: str | list[ChatCompletionRequestUserMessageContentPart]
1937
+ role: Literal['user']
1938
+ name: NotRequired[str]
1939
+
1940
+
1941
+ class CodeInterpreterTool(TypedDict):
1942
+ type: Literal['code_interpreter']
1943
+ container: str | AutoCodeInterpreterToolParam
1944
+
1945
+
1946
+ type Outputs = CodeInterpreterOutputLogs | CodeInterpreterOutputImage
1947
+
1948
+
1949
+ class CodeInterpreterToolCall(TypedDict):
1950
+ type: Literal['code_interpreter_call']
1951
+ id: str
1952
+ status: Literal['in_progress', 'completed', 'incomplete', 'interpreting', 'failed']
1953
+ container_id: str
1954
+ code: str | None
1955
+ outputs: list[Outputs] | None
1956
+
1957
+
1958
+ type ComputerAction = ClickParam | DoubleClickAction | DragParam | KeyPressAction | MoveParam | ScreenshotParam | ScrollParam | TypeParam | WaitParam
1959
+
1960
+
1961
+ type ComputerActionList = list[ComputerAction]
1962
+
1963
+
1964
+ class ComputerToolCall(TypedDict):
1965
+ type: Literal['computer_call']
1966
+ id: str
1967
+ call_id: str
1968
+ action: NotRequired[ComputerAction]
1969
+ actions: NotRequired[ComputerActionList]
1970
+ pending_safety_checks: list[ComputerCallSafetyCheckParam]
1971
+ status: Literal['in_progress', 'completed', 'incomplete']
1972
+
1973
+
1974
+ class ComputerToolCallOutput(TypedDict):
1975
+ type: Literal['computer_call_output']
1976
+ id: NotRequired[str]
1977
+ call_id: str
1978
+ acknowledged_safety_checks: NotRequired[list[ComputerCallSafetyCheckParam]]
1979
+ output: ComputerScreenshotImage
1980
+ status: NotRequired[Literal['in_progress', 'completed', 'incomplete']]
1981
+
1982
+
1983
+ class ComputerToolCallOutputResource(ComputerToolCallOutput):
1984
+ id: str
1985
+ status: Literal[
1986
+ 'completed', 'incomplete', 'failed', 'in_progress', 'completed', 'incomplete'
1987
+ ]
1988
+ created_by: NotRequired[str]
1989
+
1990
+
1991
+ type ConversationParam = str | ConversationParam2
1992
+
1993
+
1994
+ class UserLocation(TypedDict):
1995
+ type: Literal['approximate']
1996
+ approximate: WebSearchLocation
1997
+
1998
+
1999
+ class WebSearchOptions(TypedDict):
2000
+ user_location: NotRequired[UserLocation]
2001
+ search_context_size: NotRequired[WebSearchContextSize]
2002
+
2003
+
2004
+ class CreateChatCompletionResponse(TypedDict):
2005
+ id: str
2006
+ choices: list[Choice]
2007
+ created: int
2008
+ model: str
2009
+ service_tier: NotRequired[ServiceTier]
2010
+ system_fingerprint: NotRequired[str]
2011
+ object: Literal['chat.completion']
2012
+ usage: NotRequired[CompletionUsage]
2013
+
2014
+
2015
+ class CreateChatCompletionStreamResponse(TypedDict):
2016
+ id: str
2017
+ choices: list[Choice1]
2018
+ created: int
2019
+ model: str
2020
+ service_tier: NotRequired[ServiceTier]
2021
+ system_fingerprint: NotRequired[str]
2022
+ object: Literal['chat.completion.chunk']
2023
+ usage: NotRequired[CompletionUsage]
2024
+
2025
+
2026
+ class Result(TypedDict):
2027
+ file_id: NotRequired[str]
2028
+ text: NotRequired[str]
2029
+ filename: NotRequired[str]
2030
+ attributes: NotRequired[VectorStoreFileAttributes]
2031
+ score: NotRequired[float]
2032
+
2033
+
2034
+ class FileSearchToolCall(TypedDict):
2035
+ id: str
2036
+ type: Literal['file_search_call']
2037
+ status: Literal['in_progress', 'searching', 'completed', 'incomplete', 'failed']
2038
+ queries: list[str]
2039
+ results: NotRequired[list[Result] | None]
2040
+
2041
+
2042
+ type FunctionAndCustomToolCallOutput = InputTextContent | InputImageContent | InputFileContent
2043
+
2044
+
2045
+ class FunctionObject(TypedDict):
2046
+ description: NotRequired[str]
2047
+ name: str
2048
+ parameters: NotRequired[FunctionParameters]
2049
+ strict: NotRequired[bool | None]
2050
+
2051
+
2052
+ class FunctionToolCallOutput(TypedDict):
2053
+ id: NotRequired[str]
2054
+ type: Literal['function_call_output']
2055
+ call_id: str
2056
+ output: str | list[FunctionAndCustomToolCallOutput]
2057
+ status: NotRequired[Literal['in_progress', 'completed', 'incomplete']]
2058
+
2059
+
2060
+ class FunctionToolCallOutputResource(FunctionToolCallOutput):
2061
+ id: str
2062
+ status: Literal[
2063
+ 'in_progress',
2064
+ 'completed',
2065
+ 'incomplete',
2066
+ 'in_progress',
2067
+ 'completed',
2068
+ 'incomplete',
2069
+ ]
2070
+ created_by: NotRequired[str]
2071
+
2072
+
2073
+ class ImageGenTool(TypedDict):
2074
+ type: Literal['image_generation']
2075
+ model: NotRequired[
2076
+ str | Literal['gpt-image-1', 'gpt-image-1-mini', 'gpt-image-1.5']
2077
+ ]
2078
+ quality: NotRequired[Literal['low', 'medium', 'high', 'auto']]
2079
+ size: NotRequired[str | Literal['1024x1024', '1024x1536', '1536x1024', 'auto']]
2080
+ output_format: NotRequired[Literal['png', 'webp', 'jpeg']]
2081
+ output_compression: NotRequired[int]
2082
+ moderation: NotRequired[Literal['auto', 'low']]
2083
+ background: NotRequired[Literal['transparent', 'opaque', 'auto']]
2084
+ input_fidelity: NotRequired[InputFidelity | None]
2085
+ input_image_mask: NotRequired[InputImageMask]
2086
+ partial_images: NotRequired[int]
2087
+ action: NotRequired[ImageGenActionEnum]
2088
+
2089
+
2090
+ type InputContent = InputTextContent | InputImageContent | InputFileContent
2091
+
2092
+
2093
+ type InputMessageContentList = list[InputContent]
2094
+
2095
+
2096
+ class LocalShellToolCall(TypedDict):
2097
+ type: Literal['local_shell_call']
2098
+ id: str
2099
+ call_id: str
2100
+ action: LocalShellExecAction
2101
+ status: Literal['in_progress', 'completed', 'incomplete']
2102
+
2103
+
2104
+ class MCPListTools(TypedDict):
2105
+ type: Literal['mcp_list_tools']
2106
+ id: str
2107
+ server_label: str
2108
+ tools: list[MCPListToolsTool]
2109
+ error: NotRequired[str | None]
2110
+
2111
+
2112
+ class RequireApproval(TypedDict, closed=True):
2113
+ always: NotRequired[MCPToolFilter]
2114
+ never: NotRequired[MCPToolFilter]
2115
+
2116
+
2117
+ class MCPTool(TypedDict):
2118
+ type: Literal['mcp']
2119
+ server_label: str
2120
+ server_url: NotRequired[str]
2121
+ connector_id: NotRequired[
2122
+ Literal[
2123
+ 'connector_dropbox',
2124
+ 'connector_gmail',
2125
+ 'connector_googlecalendar',
2126
+ 'connector_googledrive',
2127
+ 'connector_microsoftteams',
2128
+ 'connector_outlookcalendar',
2129
+ 'connector_outlookemail',
2130
+ 'connector_sharepoint',
2131
+ ]
2132
+ ]
2133
+ authorization: NotRequired[str]
2134
+ server_description: NotRequired[str]
2135
+ headers: NotRequired[dict[str, str] | None]
2136
+ allowed_tools: NotRequired[list[str] | MCPToolFilter | None]
2137
+ require_approval: NotRequired[RequireApproval | Literal['always', 'never'] | None]
2138
+ defer_loading: NotRequired[bool]
2139
+
2140
+
2141
+ class MCPToolCall(TypedDict):
2142
+ type: Literal['mcp_call']
2143
+ id: str
2144
+ server_label: str
2145
+ name: str
2146
+ arguments: str
2147
+ output: NotRequired[str | None]
2148
+ error: NotRequired[str | None]
2149
+ status: NotRequired[MCPToolCallStatus]
2150
+ approval_request_id: NotRequired[str | None]
2151
+
2152
+
2153
+ type ModelIdsResponses = ModelIdsShared | Literal[
2154
+ 'o1-pro',
2155
+ 'o1-pro-2025-03-19',
2156
+ 'o3-pro',
2157
+ 'o3-pro-2025-06-10',
2158
+ 'o3-deep-research',
2159
+ 'o3-deep-research-2025-06-26',
2160
+ 'o4-mini-deep-research',
2161
+ 'o4-mini-deep-research-2025-06-26',
2162
+ 'computer-use-preview',
2163
+ 'computer-use-preview-2025-03-11',
2164
+ 'gpt-5-codex',
2165
+ 'gpt-5-pro',
2166
+ 'gpt-5-pro-2025-10-06',
2167
+ 'gpt-5.1-codex-max',
2168
+ ]
2169
+
2170
+
2171
+ class ModelResponseProperties(TypedDict):
2172
+ metadata: NotRequired[Metadata]
2173
+ top_logprobs: NotRequired[int | None]
2174
+ temperature: NotRequired[float | None]
2175
+ top_p: NotRequired[float | None]
2176
+ user: NotRequired[str]
2177
+ safety_identifier: NotRequired[str]
2178
+ prompt_cache_key: NotRequired[str]
2179
+ service_tier: NotRequired[ServiceTier]
2180
+ prompt_cache_retention: NotRequired[Literal['in_memory', '24h'] | None]
2181
+
2182
+
2183
+ type OutputContent = OutputTextContent | RefusalContent | ReasoningTextContent
2184
+
2185
+
2186
+ type OutputMessageContent = OutputTextContent | RefusalContent
2187
+
2188
+
2189
+ class Reasoning(TypedDict):
2190
+ effort: NotRequired[ReasoningEffort]
2191
+ summary: NotRequired[Literal['auto', 'concise', 'detailed'] | None]
2192
+ generate_summary: NotRequired[Literal['auto', 'concise', 'detailed'] | None]
2193
+
2194
+
2195
+ class ReasoningItem(TypedDict):
2196
+ type: Literal['reasoning']
2197
+ id: str
2198
+ encrypted_content: NotRequired[str | None]
2199
+ summary: list[SummaryTextContent]
2200
+ content: NotRequired[list[ReasoningTextContent]]
2201
+ status: NotRequired[Literal['in_progress', 'completed', 'incomplete']]
2202
+
2203
+
2204
+ class ResponseContentPartAddedEvent(TypedDict):
2205
+ type: Literal['response.content_part.added']
2206
+ item_id: str
2207
+ output_index: int
2208
+ content_index: int
2209
+ part: OutputContent
2210
+ sequence_number: int
2211
+
2212
+
2213
+ class ResponseContentPartDoneEvent(TypedDict):
2214
+ type: Literal['response.content_part.done']
2215
+ item_id: str
2216
+ output_index: int
2217
+ content_index: int
2218
+ sequence_number: int
2219
+ part: OutputContent
2220
+
2221
+
2222
+ class ResponseError1(TypedDict):
2223
+ code: ResponseErrorCode
2224
+ message: str
2225
+
2226
+
2227
+ type ResponseError = ResponseError1 | None
2228
+
2229
+
2230
+ class JsonSchema(TypedDict):
2231
+ description: NotRequired[str]
2232
+ name: str
2233
+ schema: NotRequired[ResponseFormatJsonSchemaSchema]
2234
+ strict: NotRequired[bool | None]
2235
+
2236
+
2237
+ class ResponseFormatJsonSchema(TypedDict):
2238
+ type: Literal['json_schema']
2239
+ json_schema: JsonSchema
2240
+
2241
+
2242
+ type ResponsePromptVariables = dict[
2243
+ str, str | InputTextContent | InputImageContent | InputFileContent
2244
+ ] | None
2245
+
2246
+
2247
+ type TextResponseFormatConfiguration = ResponseFormatText | TextResponseFormatJsonSchema | ResponseFormatJsonObject
2248
+
2249
+
2250
+ type ToolChoiceParam = ToolChoiceOptions | ToolChoiceAllowed | ToolChoiceTypes | ToolChoiceFunction | ToolChoiceMCP | ToolChoiceCustom | SpecificApplyPatchParam | SpecificFunctionShellParam
2251
+
2252
+
2253
+ type VoiceIdsOrCustomVoice = VoiceIdsShared | VoiceIdsOrCustomVoice1
2254
+
2255
+
2256
+ type Filters1 = ComparisonFilter | CompoundFilter
2257
+
2258
+
2259
+ class FileSearchTool(TypedDict):
2260
+ type: Literal['file_search']
2261
+ vector_store_ids: list[str]
2262
+ max_num_results: NotRequired[int]
2263
+ ranking_options: NotRequired[RankingOptions]
2264
+ filters: NotRequired[Filters1 | None]
2265
+
2266
+
2267
+ class ChatCompletionRequestAssistantMessage(TypedDict):
2268
+ content: NotRequired[
2269
+ str | list[ChatCompletionRequestAssistantMessageContentPart] | None
2270
+ ]
2271
+ refusal: NotRequired[str | None]
2272
+ role: Literal['assistant']
2273
+ name: NotRequired[str]
2274
+ audio: NotRequired[Audio | None]
2275
+ tool_calls: NotRequired[ChatCompletionMessageToolCalls]
2276
+ function_call: NotRequired[FunctionCall | None]
2277
+
2278
+
2279
+ type ChatCompletionRequestMessage = ChatCompletionRequestDeveloperMessage | ChatCompletionRequestSystemMessage | ChatCompletionRequestUserMessage | ChatCompletionRequestAssistantMessage | ChatCompletionRequestToolMessage | ChatCompletionRequestFunctionMessage
2280
+
2281
+
2282
+ class ChatCompletionTool(TypedDict):
2283
+ type: Literal['function']
2284
+ function: FunctionObject
2285
+
2286
+
2287
+ class Audio2(TypedDict):
2288
+ voice: VoiceIdsOrCustomVoice
2289
+ format: Literal['wav', 'aac', 'mp3', 'flac', 'opus', 'pcm16']
2290
+
2291
+
2292
+ class CreateModelResponseProperties(ModelResponseProperties):
2293
+ top_logprobs: NotRequired[TopLogprobs | TopLogprobs1]
2294
+ start_within: NotRequired[str]
2295
+
2296
+
2297
+ class CustomToolCallOutput(TypedDict):
2298
+ type: Literal['custom_tool_call_output']
2299
+ id: NotRequired[str]
2300
+ call_id: str
2301
+ output: str | list[FunctionAndCustomToolCallOutput]
2302
+
2303
+
2304
+ class CustomToolCallOutputResource(CustomToolCallOutput):
2305
+ id: str
2306
+ status: FunctionCallOutputStatusEnum
2307
+ created_by: NotRequired[str]
2308
+
2309
+
2310
+ class EasyInputMessage(TypedDict):
2311
+ role: Literal['user', 'assistant', 'system', 'developer']
2312
+ content: str | InputMessageContentList
2313
+ phase: NotRequired[MessagePhase | None]
2314
+ type: NotRequired[Literal['message']]
2315
+
2316
+
2317
+ class InputMessage(TypedDict):
2318
+ type: NotRequired[Literal['message']]
2319
+ role: Literal['user', 'system', 'developer']
2320
+ status: NotRequired[Literal['in_progress', 'completed', 'incomplete']]
2321
+ content: InputMessageContentList
2322
+
2323
+
2324
+ class OutputMessage(TypedDict):
2325
+ id: str
2326
+ type: Literal['message']
2327
+ role: Literal['assistant']
2328
+ content: list[OutputMessageContent]
2329
+ phase: NotRequired[MessagePhase | None]
2330
+ status: Literal['in_progress', 'completed', 'incomplete']
2331
+
2332
+
2333
+ class Prompt1(TypedDict):
2334
+ id: str
2335
+ version: NotRequired[str | None]
2336
+ variables: NotRequired[ResponsePromptVariables]
2337
+
2338
+
2339
+ type Prompt = Prompt1 | None
2340
+
2341
+
2342
+ class ResponseTextParam(TypedDict):
2343
+ format: NotRequired[TextResponseFormatConfiguration]
2344
+ verbosity: NotRequired[Verbosity]
2345
+
2346
+
2347
+ type Tool = FunctionTool | FileSearchTool | ComputerTool | ComputerUsePreviewTool | WebSearchTool | MCPTool | CodeInterpreterTool | ImageGenTool | LocalShellToolParam | FunctionShellToolParam | CustomToolParam | NamespaceToolParam | ToolSearchToolParam | WebSearchPreviewTool | ApplyPatchToolParam
2348
+
2349
+
2350
+ type ToolsArray = list[Tool]
2351
+
2352
+
2353
+ class ToolSearchOutput(TypedDict):
2354
+ type: Literal['tool_search_output']
2355
+ id: str
2356
+ call_id: str | None
2357
+ execution: ToolSearchExecutionType
2358
+ tools: list[Tool]
2359
+ status: FunctionCallOutputStatusEnum
2360
+ created_by: NotRequired[str]
2361
+
2362
+
2363
+ class ToolSearchOutputItemParam(TypedDict):
2364
+ id: NotRequired[str | None]
2365
+ call_id: NotRequired[str | None]
2366
+ type: Literal['tool_search_output']
2367
+ execution: NotRequired[ToolSearchExecutionType]
2368
+ tools: list[Tool]
2369
+ status: NotRequired[FunctionCallItemStatus | None]
2370
+
2371
+
2372
+ class CreateChatCompletionRequest(CreateModelResponseProperties):
2373
+ messages: list[ChatCompletionRequestMessage]
2374
+ model: ModelIdsShared
2375
+ modalities: NotRequired[ResponseModalities]
2376
+ verbosity: NotRequired[Verbosity]
2377
+ reasoning_effort: NotRequired[ReasoningEffort]
2378
+ max_completion_tokens: NotRequired[int]
2379
+ frequency_penalty: NotRequired[float]
2380
+ presence_penalty: NotRequired[float]
2381
+ web_search_options: NotRequired[WebSearchOptions]
2382
+ top_logprobs: NotRequired[int]
2383
+ response_format: NotRequired[
2384
+ ResponseFormatText | ResponseFormatJsonSchema | ResponseFormatJsonObject
2385
+ ]
2386
+ audio: NotRequired[Audio2]
2387
+ store: NotRequired[bool]
2388
+ stream: NotRequired[bool]
2389
+ stop: NotRequired[StopConfiguration]
2390
+ logit_bias: NotRequired[dict[str, int]]
2391
+ logprobs: NotRequired[bool]
2392
+ max_tokens: NotRequired[int]
2393
+ n: NotRequired[int]
2394
+ prediction: NotRequired[PredictionContent]
2395
+ seed: NotRequired[int]
2396
+ stream_options: NotRequired[ChatCompletionStreamOptions]
2397
+ tools: NotRequired[list[ChatCompletionTool | CustomToolChatCompletions]]
2398
+ tool_choice: NotRequired[ChatCompletionToolChoiceOption]
2399
+ parallel_tool_calls: NotRequired[ParallelToolCalls]
2400
+ function_call: NotRequired[
2401
+ Literal['none', 'auto'] | ChatCompletionFunctionCallOption
2402
+ ]
2403
+ functions: NotRequired[list[ChatCompletionFunctions]]
2404
+
2405
+
2406
+ type InputItem = EasyInputMessage | InputMessage | OutputMessage | FileSearchToolCall | ComputerToolCall | ComputerCallOutputItemParam | WebSearchToolCall | FunctionToolCall | FunctionCallOutputItemParam | ToolSearchCallItemParam | ToolSearchOutputItemParam | ReasoningItem | CompactionSummaryItemParam | ImageGenToolCall | CodeInterpreterToolCall | LocalShellToolCall | LocalShellToolCallOutput | FunctionShellCallItemParam | FunctionShellCallOutputItemParam | ApplyPatchToolCallItemParam | ApplyPatchToolCallOutputItemParam | MCPListTools | MCPApprovalRequest | MCPApprovalResponse | MCPToolCall | CustomToolCallOutput | CustomToolCall | ItemReferenceParam
2407
+
2408
+
2409
+ type InputParam = str | list[InputItem]
2410
+
2411
+
2412
+ type Item = InputMessage | OutputMessage | FileSearchToolCall | ComputerToolCall | ComputerCallOutputItemParam | WebSearchToolCall | FunctionToolCall | FunctionCallOutputItemParam | ToolSearchCallItemParam | ToolSearchOutputItemParam | ReasoningItem | CompactionSummaryItemParam | ImageGenToolCall | CodeInterpreterToolCall | LocalShellToolCall | LocalShellToolCallOutput | FunctionShellCallItemParam | FunctionShellCallOutputItemParam | ApplyPatchToolCallItemParam | ApplyPatchToolCallOutputItemParam | MCPListTools | MCPApprovalRequest | MCPApprovalResponse | MCPToolCall | CustomToolCallOutput | CustomToolCall
2413
+
2414
+
2415
+ type OutputItem = OutputMessage | FileSearchToolCall | FunctionToolCall | FunctionToolCallOutputResource | WebSearchToolCall | ComputerToolCall | ComputerToolCallOutputResource | ReasoningItem | ToolSearchCall | ToolSearchOutput | CompactionBody | ImageGenToolCall | CodeInterpreterToolCall | LocalShellToolCall | LocalShellToolCallOutput | FunctionShellCall | FunctionShellCallOutput | ApplyPatchToolCall | ApplyPatchToolCallOutput | MCPToolCall | MCPListTools | MCPApprovalRequest | MCPApprovalResponseResource | CustomToolCall | CustomToolCallOutputResource
2416
+
2417
+
2418
+ class ResponseOutputItemAddedEvent(TypedDict):
2419
+ type: Literal['response.output_item.added']
2420
+ output_index: int
2421
+ sequence_number: int
2422
+ item: OutputItem
2423
+
2424
+
2425
+ class ResponseOutputItemDoneEvent(TypedDict):
2426
+ type: Literal['response.output_item.done']
2427
+ output_index: int
2428
+ sequence_number: int
2429
+ item: OutputItem
2430
+
2431
+
2432
+ class ResponseProperties(TypedDict):
2433
+ previous_response_id: NotRequired[str | None]
2434
+ model: NotRequired[ModelIdsResponses]
2435
+ reasoning: NotRequired[Reasoning | None]
2436
+ background: NotRequired[bool | None]
2437
+ max_tool_calls: NotRequired[int | None]
2438
+ text: NotRequired[ResponseTextParam]
2439
+ tools: NotRequired[ToolsArray]
2440
+ tool_choice: NotRequired[ToolChoiceParam]
2441
+ prompt: NotRequired[Prompt]
2442
+ truncation: NotRequired[Literal['auto', 'disabled'] | None]
2443
+
2444
+
2445
+ class CreateResponse(CreateModelResponseProperties, ResponseProperties):
2446
+ input: NotRequired[InputParam]
2447
+ include: NotRequired[list[IncludeEnum] | None]
2448
+ parallel_tool_calls: NotRequired[bool | None]
2449
+ store: NotRequired[bool | None]
2450
+ instructions: NotRequired[str | None]
2451
+ stream: NotRequired[bool | None]
2452
+ stream_options: NotRequired[ResponseStreamOptions]
2453
+ conversation: NotRequired[ConversationParam | None]
2454
+ context_management: NotRequired[list[ContextManagementParam] | None]
2455
+ max_output_tokens: NotRequired[int | None]
2456
+
2457
+
2458
+ class Response(ModelResponseProperties, ResponseProperties):
2459
+ id: str
2460
+ object: Literal['response']
2461
+ status: NotRequired[
2462
+ Literal[
2463
+ 'completed', 'failed', 'in_progress', 'cancelled', 'queued', 'incomplete'
2464
+ ]
2465
+ ]
2466
+ created_at: int
2467
+ completed_at: NotRequired[int | None]
2468
+ error: ResponseError
2469
+ incomplete_details: IncompleteDetails | None
2470
+ output: list[OutputItem]
2471
+ instructions: str | list[InputItem] | None
2472
+ output_text: NotRequired[str | None]
2473
+ usage: NotRequired[ResponseUsage]
2474
+ parallel_tool_calls: bool
2475
+ conversation: NotRequired[Conversation2 | None]
2476
+ max_output_tokens: NotRequired[int | None]
2477
+ model: ModelIdsResponses
2478
+ tools: ToolsArray
2479
+ metadata: Metadata
2480
+ tool_choice: ToolChoiceParam
2481
+ temperature: float | None
2482
+ top_p: float | None
2483
+
2484
+
2485
+ class ResponseCompletedEvent(TypedDict):
2486
+ type: Literal['response.completed']
2487
+ response: Response
2488
+ sequence_number: int
2489
+
2490
+
2491
+ class ResponseCreatedEvent(TypedDict):
2492
+ type: Literal['response.created']
2493
+ response: Response
2494
+ sequence_number: int
2495
+
2496
+
2497
+ class ResponseFailedEvent(TypedDict):
2498
+ type: Literal['response.failed']
2499
+ sequence_number: int
2500
+ response: Response
2501
+
2502
+
2503
+ class ResponseInProgressEvent(TypedDict):
2504
+ type: Literal['response.in_progress']
2505
+ response: Response
2506
+ sequence_number: int
2507
+
2508
+
2509
+ class ResponseIncompleteEvent(TypedDict):
2510
+ type: Literal['response.incomplete']
2511
+ response: Response
2512
+ sequence_number: int
2513
+
2514
+
2515
+ class ResponseQueuedEvent(TypedDict):
2516
+ type: Literal['response.queued']
2517
+ response: Response
2518
+ sequence_number: int
2519
+
2520
+
2521
+ type ResponseStreamEvent = ResponseAudioDeltaEvent | ResponseAudioDoneEvent | ResponseAudioTranscriptDeltaEvent | ResponseAudioTranscriptDoneEvent | ResponseCodeInterpreterCallCodeDeltaEvent | ResponseCodeInterpreterCallCodeDoneEvent | ResponseCodeInterpreterCallCompletedEvent | ResponseCodeInterpreterCallInProgressEvent | ResponseCodeInterpreterCallInterpretingEvent | ResponseCompletedEvent | ResponseContentPartAddedEvent | ResponseContentPartDoneEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFileSearchCallCompletedEvent | ResponseFileSearchCallInProgressEvent | ResponseFileSearchCallSearchingEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseInProgressEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningSummaryPartAddedEvent | ResponseReasoningSummaryPartDoneEvent | ResponseReasoningSummaryTextDeltaEvent | ResponseReasoningSummaryTextDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent | ResponseWebSearchCallCompletedEvent | ResponseWebSearchCallInProgressEvent | ResponseWebSearchCallSearchingEvent | ResponseImageGenCallCompletedEvent | ResponseImageGenCallGeneratingEvent | ResponseImageGenCallInProgressEvent | ResponseImageGenCallPartialImageEvent | ResponseMCPCallArgumentsDeltaEvent | ResponseMCPCallArgumentsDoneEvent | ResponseMCPCallCompletedEvent | ResponseMCPCallFailedEvent | ResponseMCPCallInProgressEvent | ResponseMCPListToolsCompletedEvent | ResponseMCPListToolsFailedEvent | ResponseMCPListToolsInProgressEvent | ResponseOutputTextAnnotationAddedEvent | ResponseQueuedEvent | ResponseCustomToolCallInputDeltaEvent | ResponseCustomToolCallInputDoneEvent