Skip to main content

openai_types/responses/
_gen.rs

1// AUTO-GENERATED by py2rust — do not edit.
2// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
3// Domain: responses
4#![allow(unused_imports)]
5
6use serde::{Deserialize, Serialize};
7use super::*;
8
9/// Allows the assistant to create, delete, or update files using unified diffs.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
12pub struct ApplyPatchTool {
13    /// The type of the tool. Always `apply_patch`.
14    #[serde(rename = "type")]
15    pub type_: String,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
20pub struct CompactedResponse {
21    /// The unique identifier for the compacted response.
22    pub id: String,
23    /// Unix timestamp (in seconds) when the compacted conversation was created.
24    pub created_at: i64,
25    /// The object type. Always `response.compaction`.
26    pub object: String,
27    /// The compacted list of output items.
28    pub output: Vec<ResponseOutputItem>,
29    /// Token accounting for the compaction pass, including cached, reasoning, and total
30    pub usage: ResponseUsage,
31}
32
33#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
34#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
35#[non_exhaustive]
36pub enum ClickButton {
37    #[serde(rename = "left")]
38    Left,
39    #[serde(rename = "right")]
40    Right,
41    #[serde(rename = "wheel")]
42    Wheel,
43    #[serde(rename = "back")]
44    Back,
45    #[serde(rename = "forward")]
46    Forward,
47}
48
49/// A click action.
50#[derive(Debug, Clone, Serialize, Deserialize)]
51#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
52pub struct Click {
53    /// Indicates which mouse button was pressed during the click.
54    pub button: ClickButton,
55    /// Specifies the event type. For a click action, this property is always `click`.
56    #[serde(rename = "type")]
57    pub type_: String,
58    /// The x-coordinate where the click occurred.
59    pub x: i64,
60    /// The y-coordinate where the click occurred.
61    pub y: i64,
62}
63
64/// A double click action.
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
67pub struct DoubleClick {
68    /// Specifies the event type.
69    #[serde(rename = "type")]
70    pub type_: String,
71    /// The x-coordinate where the double click occurred.
72    pub x: i64,
73    /// The y-coordinate where the double click occurred.
74    pub y: i64,
75}
76
77/// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
78#[derive(Debug, Clone, Serialize, Deserialize)]
79#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
80pub struct DragPath {
81    /// The x-coordinate.
82    pub x: i64,
83    /// The y-coordinate.
84    pub y: i64,
85}
86
87/// A drag action.
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
90pub struct Drag {
91    /// An array of coordinates representing the path of the drag action.
92    pub path: Vec<DragPath>,
93    /// Specifies the event type.
94    #[serde(rename = "type")]
95    pub type_: String,
96}
97
98/// A collection of keypresses the model would like to perform.
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
101pub struct Keypress {
102    /// The combination of keys the model is requesting to be pressed.
103    pub keys: Vec<String>,
104    /// Specifies the event type.
105    #[serde(rename = "type")]
106    pub type_: String,
107}
108
109/// A mouse move action.
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
112pub struct Move {
113    /// Specifies the event type.
114    #[serde(rename = "type")]
115    pub type_: String,
116    /// The x-coordinate to move to.
117    pub x: i64,
118    /// The y-coordinate to move to.
119    pub y: i64,
120}
121
122/// A screenshot action.
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
125pub struct Screenshot {
126    /// Specifies the event type.
127    #[serde(rename = "type")]
128    pub type_: String,
129}
130
131/// A scroll action.
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
134pub struct Scroll {
135    /// The horizontal scroll distance.
136    pub scroll_x: i64,
137    /// The vertical scroll distance.
138    pub scroll_y: i64,
139    /// Specifies the event type.
140    #[serde(rename = "type")]
141    pub type_: String,
142    /// The x-coordinate where the scroll occurred.
143    pub x: i64,
144    /// The y-coordinate where the scroll occurred.
145    pub y: i64,
146}
147
148/// An action to type in text.
149#[derive(Debug, Clone, Serialize, Deserialize)]
150#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
151pub struct Type {
152    /// The text to type.
153    pub text: String,
154    /// Specifies the event type.
155    #[serde(rename = "type")]
156    pub type_: String,
157}
158
159/// A wait action.
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
162pub struct Wait {
163    /// Specifies the event type.
164    #[serde(rename = "type")]
165    pub type_: String,
166}
167
168pub type ComputerAction = serde_json::Value;
169
170pub type ComputerActionList = Vec<ComputerAction>;
171
172/// A tool that controls a virtual computer.
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
175pub struct ComputerTool {
176    /// The type of the computer tool. Always `computer`.
177    #[serde(rename = "type")]
178    pub type_: String,
179}
180
181#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
182#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
183#[non_exhaustive]
184pub enum ComputerUsePreviewToolEnvironment {
185    #[serde(rename = "windows")]
186    Windows,
187    #[serde(rename = "mac")]
188    Mac,
189    #[serde(rename = "linux")]
190    Linux,
191    #[serde(rename = "ubuntu")]
192    Ubuntu,
193    #[serde(rename = "browser")]
194    Browser,
195}
196
197/// A tool that controls a virtual computer.
198#[derive(Debug, Clone, Serialize, Deserialize)]
199#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
200pub struct ComputerUsePreviewTool {
201    /// The height of the computer display.
202    pub display_height: i64,
203    /// The width of the computer display.
204    pub display_width: i64,
205    /// The type of computer environment to control.
206    pub environment: ComputerUsePreviewToolEnvironment,
207    /// The type of the computer use tool. Always `computer_use_preview`.
208    #[serde(rename = "type")]
209    pub type_: String,
210}
211
212pub type NetworkPolicy = serde_json::Value;
213
214pub type Skill = serde_json::Value;
215
216#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
217#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
218#[non_exhaustive]
219pub enum ContainerAutoMemoryLimit {
220    #[serde(rename = "1g")]
221    V1g,
222    #[serde(rename = "4g")]
223    V4g,
224    #[serde(rename = "16g")]
225    V16g,
226    #[serde(rename = "64g")]
227    V64g,
228}
229
230#[derive(Debug, Clone, Serialize, Deserialize)]
231#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
232pub struct ContainerAuto {
233    /// Automatically creates a container for this request
234    #[serde(rename = "type")]
235    pub type_: String,
236    /// An optional list of uploaded files to make available to your code.
237    #[serde(skip_serializing_if = "Option::is_none", default)]
238    pub file_ids: Option<Vec<String>>,
239    /// The memory limit for the container.
240    #[serde(skip_serializing_if = "Option::is_none", default)]
241    pub memory_limit: Option<ContainerAutoMemoryLimit>,
242    /// Network access policy for the container.
243    #[serde(skip_serializing_if = "Option::is_none", default)]
244    pub network_policy: Option<NetworkPolicy>,
245    /// An optional list of skills referenced by id or inline data.
246    #[serde(skip_serializing_if = "Option::is_none", default)]
247    pub skills: Option<Vec<Skill>>,
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
251#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
252pub struct ContainerNetworkPolicyAllowlist {
253    /// A list of allowed domains when type is `allowlist`.
254    pub allowed_domains: Vec<String>,
255    /// Allow outbound network access only to specified domains. Always `allowlist`.
256    #[serde(rename = "type")]
257    pub type_: String,
258    /// Optional domain-scoped secrets for allowlisted domains.
259    #[serde(skip_serializing_if = "Option::is_none", default)]
260    pub domain_secrets: Option<Vec<ContainerNetworkPolicyDomainSecret>>,
261}
262
263#[derive(Debug, Clone, Serialize, Deserialize)]
264#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
265pub struct ContainerNetworkPolicyDisabled {
266    /// Disable outbound network access. Always `disabled`.
267    #[serde(rename = "type")]
268    pub type_: String,
269}
270
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
273pub struct ContainerNetworkPolicyDomainSecret {
274    /// The domain associated with the secret.
275    pub domain: String,
276    /// The name of the secret to inject for the domain.
277    pub name: String,
278    /// The secret value to inject for the domain.
279    pub value: String,
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
283#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
284pub struct ContainerReference {
285    /// The ID of the referenced container.
286    pub container_id: String,
287    /// References a container created with the /v1/containers endpoint
288    #[serde(rename = "type")]
289    pub type_: String,
290}
291
292/// A custom tool that processes input using a specified format.
293#[derive(Debug, Clone, Serialize, Deserialize)]
294#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
295pub struct CustomTool {
296    /// The name of the custom tool, used to identify it in tool calls.
297    pub name: String,
298    /// The type of the custom tool. Always `custom`.
299    #[serde(rename = "type")]
300    pub type_: String,
301    /// Whether this tool should be deferred and discovered via tool search.
302    #[serde(skip_serializing_if = "Option::is_none", default)]
303    pub defer_loading: Option<bool>,
304    /// Optional description of the custom tool, used to provide more context.
305    #[serde(skip_serializing_if = "Option::is_none", default)]
306    pub description: Option<String>,
307    /// The input format for the custom tool. Default is unconstrained text.
308    #[serde(skip_serializing_if = "Option::is_none", default)]
309    pub format: Option<serde_json::Value>,
310}
311
312#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
313#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
314#[non_exhaustive]
315pub enum EasyInputMessageRole {
316    #[serde(rename = "user")]
317    User,
318    #[serde(rename = "assistant")]
319    Assistant,
320    #[serde(rename = "system")]
321    System,
322    #[serde(rename = "developer")]
323    Developer,
324}
325
326#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
327#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
328#[non_exhaustive]
329pub enum EasyInputMessagePhase {
330    #[serde(rename = "commentary")]
331    Commentary,
332    #[serde(rename = "final_answer")]
333    FinalAnswer,
334}
335
336pub type Filters = serde_json::Value;
337
338/// Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
339#[derive(Debug, Clone, Serialize, Deserialize)]
340#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
341pub struct RankingOptionsHybridSearch {
342    /// The weight of the embedding in the reciprocal ranking fusion.
343    pub embedding_weight: f64,
344    /// The weight of the text in the reciprocal ranking fusion.
345    pub text_weight: f64,
346}
347
348#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
349#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
350#[non_exhaustive]
351pub enum RankingOptionsRanker {
352    #[serde(rename = "auto")]
353    Auto,
354    #[serde(rename = "default-2024-11-15")]
355    Default20241115,
356}
357
358/// Ranking options for search.
359#[derive(Debug, Clone, Serialize, Deserialize)]
360#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
361pub struct RankingOptions {
362    /// Weights that control how reciprocal rank fusion balances semantic embedding
363    #[serde(skip_serializing_if = "Option::is_none", default)]
364    pub hybrid_search: Option<RankingOptionsHybridSearch>,
365    /// The ranker to use for the file search.
366    #[serde(skip_serializing_if = "Option::is_none", default)]
367    pub ranker: Option<RankingOptionsRanker>,
368    /// The score threshold for the file search, a number between 0 and 1.
369    #[serde(skip_serializing_if = "Option::is_none", default)]
370    pub score_threshold: Option<f64>,
371}
372
373/// A tool that searches for relevant content from uploaded files.
374#[derive(Debug, Clone, Serialize, Deserialize)]
375#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
376pub struct FileSearchTool {
377    /// The type of the file search tool. Always `file_search`.
378    #[serde(rename = "type")]
379    pub type_: String,
380    /// The IDs of the vector stores to search.
381    pub vector_store_ids: Vec<String>,
382    /// A filter to apply.
383    #[serde(skip_serializing_if = "Option::is_none", default)]
384    pub filters: Option<Filters>,
385    /// The maximum number of results to return.
386    #[serde(skip_serializing_if = "Option::is_none", default)]
387    pub max_num_results: Option<i64>,
388    /// Ranking options for search.
389    #[serde(skip_serializing_if = "Option::is_none", default)]
390    pub ranking_options: Option<RankingOptions>,
391}
392
393pub type Environment = serde_json::Value;
394
395/// A tool that allows the model to execute shell commands.
396#[derive(Debug, Clone, Serialize, Deserialize)]
397#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
398pub struct FunctionShellTool {
399    /// The type of the shell tool. Always `shell`.
400    #[serde(rename = "type")]
401    pub type_: String,
402    #[serde(skip_serializing_if = "Option::is_none", default)]
403    pub environment: Option<Environment>,
404}
405
406#[derive(Debug, Clone, Serialize, Deserialize)]
407#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
408pub struct InlineSkill {
409    /// The description of the skill.
410    pub description: String,
411    /// The name of the skill.
412    pub name: String,
413    /// Inline skill payload
414    pub source: InlineSkillSource,
415    /// Defines an inline skill for this request.
416    #[serde(rename = "type")]
417    pub type_: String,
418}
419
420/// Inline skill payload
421#[derive(Debug, Clone, Serialize, Deserialize)]
422#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
423pub struct InlineSkillSource {
424    /// Base64-encoded skill zip bundle.
425    pub data: String,
426    /// The media type of the inline skill payload. Must be `application/zip`.
427    pub media_type: String,
428    /// The type of the inline skill source. Must be `base64`.
429    #[serde(rename = "type")]
430    pub type_: String,
431}
432
433#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
434#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
435#[non_exhaustive]
436pub enum InputItemListParamsOrder {
437    #[serde(rename = "asc")]
438    Asc,
439    #[serde(rename = "desc")]
440    Desc,
441}
442
443#[derive(Debug, Clone, Serialize, Deserialize)]
444#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
445pub struct InputItemListParams {
446    /// An item ID to list items after, used in pagination.
447    #[serde(skip_serializing_if = "Option::is_none", default)]
448    pub after: Option<String>,
449    /// Additional fields to include in the response.
450    #[serde(skip_serializing_if = "Option::is_none", default)]
451    pub include: Option<Vec<ResponseIncludable>>,
452    /// A limit on the number of objects to be returned.
453    #[serde(skip_serializing_if = "Option::is_none", default)]
454    pub limit: Option<i64>,
455    /// The order to return the input items in. Default is `desc`.
456    #[serde(skip_serializing_if = "Option::is_none", default)]
457    pub order: Option<InputItemListParamsOrder>,
458}
459
460#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
461#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
462#[non_exhaustive]
463pub enum InputTokenCountParamsTruncation {
464    #[serde(rename = "auto")]
465    Auto,
466    #[serde(rename = "disabled")]
467    Disabled,
468}
469
470#[derive(Debug, Clone, Serialize, Deserialize)]
471#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
472pub struct InputTokenCountParams {
473    /// The conversation that this response belongs to.
474    #[serde(skip_serializing_if = "Option::is_none", default)]
475    pub conversation: Option<Conversation>,
476    /// Text, image, or file inputs to the model, used to generate a response
477    #[serde(skip_serializing_if = "Option::is_none", default)]
478    pub input: Option<String>,
479    /// A system (or developer) message inserted into the model's context. When used
480    #[serde(skip_serializing_if = "Option::is_none", default)]
481    pub instructions: Option<String>,
482    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
483    #[serde(skip_serializing_if = "Option::is_none", default)]
484    pub model: Option<String>,
485    /// Whether to allow the model to run tool calls in parallel.
486    #[serde(skip_serializing_if = "Option::is_none", default)]
487    pub parallel_tool_calls: Option<bool>,
488    /// The unique ID of the previous response to the model.
489    #[serde(skip_serializing_if = "Option::is_none", default)]
490    pub previous_response_id: Option<String>,
491    /// **gpt-5 and o-series models only** Configuration options for
492    #[serde(skip_serializing_if = "Option::is_none", default)]
493    pub reasoning: Option<serde_json::Value>,
494    /// Configuration options for a text response from the model.
495    #[serde(skip_serializing_if = "Option::is_none", default)]
496    pub text: Option<Text>,
497    /// Controls which tool the model should use, if any.
498    #[serde(skip_serializing_if = "Option::is_none", default)]
499    pub tool_choice: Option<ToolChoice>,
500    /// An array of tools the model may call while generating a response.
501    #[serde(skip_serializing_if = "Option::is_none", default)]
502    pub tools: Option<Vec<serde_json::Value>>,
503    /// The truncation strategy to use for the model response.
504    #[serde(skip_serializing_if = "Option::is_none", default)]
505    pub truncation: Option<InputTokenCountParamsTruncation>,
506}
507
508pub type Conversation = serde_json::Value;
509
510#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
511#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
512#[non_exhaustive]
513pub enum TextVerbosity {
514    #[serde(rename = "low")]
515    Low,
516    #[serde(rename = "medium")]
517    Medium,
518    #[serde(rename = "high")]
519    High,
520}
521
522/// Configuration options for a text response from the model.
523#[derive(Debug, Clone, Serialize, Deserialize)]
524#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
525pub struct Text {
526    /// An object specifying the format that the model must output.
527    #[serde(skip_serializing_if = "Option::is_none", default)]
528    pub format: Option<serde_json::Value>,
529    /// Constrains the verbosity of the model's response.
530    #[serde(skip_serializing_if = "Option::is_none", default)]
531    pub verbosity: Option<TextVerbosity>,
532}
533
534pub type ToolChoice = serde_json::Value;
535
536#[derive(Debug, Clone, Serialize, Deserialize)]
537#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
538pub struct InputTokenCountResponse {
539    pub input_tokens: i64,
540    pub object: String,
541}
542
543#[derive(Debug, Clone, Serialize, Deserialize)]
544#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
545pub struct LocalEnvironment {
546    /// Use a local computer environment.
547    #[serde(rename = "type")]
548    pub type_: String,
549    /// An optional list of skills.
550    #[serde(skip_serializing_if = "Option::is_none", default)]
551    pub skills: Option<Vec<LocalSkill>>,
552}
553
554#[derive(Debug, Clone, Serialize, Deserialize)]
555#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
556pub struct LocalSkill {
557    /// The description of the skill.
558    pub description: String,
559    /// The name of the skill.
560    pub name: String,
561    /// The path to the directory containing the skill.
562    pub path: String,
563}
564
565#[derive(Debug, Clone, Serialize, Deserialize)]
566#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
567pub struct ToolFunction {
568    pub name: String,
569    #[serde(rename = "type")]
570    pub type_: String,
571    /// Whether this function should be deferred and discovered via tool search.
572    #[serde(skip_serializing_if = "Option::is_none", default)]
573    pub defer_loading: Option<bool>,
574    #[serde(skip_serializing_if = "Option::is_none", default)]
575    pub description: Option<String>,
576    #[serde(skip_serializing_if = "Option::is_none", default)]
577    pub parameters: Option<serde_json::Value>,
578    #[serde(skip_serializing_if = "Option::is_none", default)]
579    pub strict: Option<bool>,
580}
581
582pub type Tool = serde_json::Value;
583
584/// Groups function/custom tools under a shared namespace.
585#[derive(Debug, Clone, Serialize, Deserialize)]
586#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
587pub struct NamespaceTool {
588    /// A description of the namespace shown to the model.
589    pub description: String,
590    /// The namespace name used in tool calls (for example, `crm`).
591    pub name: String,
592    /// The function/custom tools available inside this namespace.
593    pub tools: Vec<Tool>,
594    /// The type of the tool. Always `namespace`.
595    #[serde(rename = "type")]
596    pub type_: String,
597}
598
599pub type ParsedContent = serde_json::Value;
600
601pub type ParsedResponseOutputItem = serde_json::Value;
602
603#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
604#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
605#[non_exhaustive]
606pub enum IncompleteDetailsReason {
607    #[serde(rename = "max_output_tokens")]
608    MaxOutputTokens,
609    #[serde(rename = "content_filter")]
610    ContentFilter,
611}
612
613#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
614#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
615#[non_exhaustive]
616pub enum ResponsePromptCacheRetention {
617    #[serde(rename = "in-memory")]
618    InMemory,
619    #[serde(rename = "24h")]
620    V24h,
621}
622
623#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
624#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
625#[non_exhaustive]
626pub enum ResponseServiceTier {
627    #[serde(rename = "auto")]
628    Auto,
629    #[serde(rename = "default")]
630    Default,
631    #[serde(rename = "flex")]
632    Flex,
633    #[serde(rename = "scale")]
634    Scale,
635    #[serde(rename = "priority")]
636    Priority,
637}
638
639#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
640#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
641#[non_exhaustive]
642pub enum ResponseTruncation {
643    #[serde(rename = "auto")]
644    Auto,
645    #[serde(rename = "disabled")]
646    Disabled,
647}
648
649/// Instruction describing how to create a file via the apply_patch tool.
650#[derive(Debug, Clone, Serialize, Deserialize)]
651#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
652pub struct OperationCreateFile {
653    /// Diff to apply.
654    pub diff: String,
655    /// Path of the file to create.
656    pub path: String,
657    /// Create a new file with the provided diff.
658    #[serde(rename = "type")]
659    pub type_: String,
660}
661
662/// Instruction describing how to delete a file via the apply_patch tool.
663#[derive(Debug, Clone, Serialize, Deserialize)]
664#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
665pub struct OperationDeleteFile {
666    /// Path of the file to delete.
667    pub path: String,
668    /// Delete the specified file.
669    #[serde(rename = "type")]
670    pub type_: String,
671}
672
673/// Instruction describing how to update a file via the apply_patch tool.
674#[derive(Debug, Clone, Serialize, Deserialize)]
675#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
676pub struct OperationUpdateFile {
677    /// Diff to apply.
678    pub diff: String,
679    /// Path of the file to update.
680    pub path: String,
681    /// Update an existing file with the provided diff.
682    #[serde(rename = "type")]
683    pub type_: String,
684}
685
686pub type Operation = serde_json::Value;
687
688#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
689#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
690#[non_exhaustive]
691pub enum ResponseApplyPatchToolCallStatus {
692    #[serde(rename = "in_progress")]
693    InProgress,
694    #[serde(rename = "completed")]
695    Completed,
696}
697
698/// A tool call that applies file diffs by creating, deleting, or updating files.
699#[derive(Debug, Clone, Serialize, Deserialize)]
700#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
701pub struct ResponseApplyPatchToolCall {
702    /// The unique ID of the apply patch tool call.
703    pub id: String,
704    /// The unique ID of the apply patch tool call generated by the model.
705    pub call_id: String,
706    /// One of the create_file, delete_file, or update_file operations applied via
707    pub operation: Operation,
708    /// The status of the apply patch tool call. One of `in_progress` or `completed`.
709    pub status: ResponseApplyPatchToolCallStatus,
710    /// The type of the item. Always `apply_patch_call`.
711    #[serde(rename = "type")]
712    pub type_: String,
713    /// The ID of the entity that created this tool call.
714    #[serde(skip_serializing_if = "Option::is_none", default)]
715    pub created_by: Option<String>,
716}
717
718#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
719#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
720#[non_exhaustive]
721pub enum ResponseApplyPatchToolCallOutputStatus {
722    #[serde(rename = "completed")]
723    Completed,
724    #[serde(rename = "failed")]
725    Failed,
726}
727
728/// The output emitted by an apply patch tool call.
729#[derive(Debug, Clone, Serialize, Deserialize)]
730#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
731pub struct ResponseApplyPatchToolCallOutput {
732    /// The unique ID of the apply patch tool call output.
733    pub id: String,
734    /// The unique ID of the apply patch tool call generated by the model.
735    pub call_id: String,
736    /// The status of the apply patch tool call output. One of `completed` or `failed`.
737    pub status: ResponseApplyPatchToolCallOutputStatus,
738    /// The type of the item. Always `apply_patch_call_output`.
739    #[serde(rename = "type")]
740    pub type_: String,
741    /// The ID of the entity that created this tool call output.
742    #[serde(skip_serializing_if = "Option::is_none", default)]
743    pub created_by: Option<String>,
744    /// Optional textual output returned by the apply patch tool.
745    #[serde(skip_serializing_if = "Option::is_none", default)]
746    pub output: Option<String>,
747}
748
749/// Emitted when there is a partial audio response.
750#[derive(Debug, Clone, Serialize, Deserialize)]
751#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
752pub struct ResponseAudioDeltaEvent {
753    /// A chunk of Base64 encoded response audio bytes.
754    pub delta: String,
755    /// A sequence number for this chunk of the stream response.
756    pub sequence_number: i64,
757    /// The type of the event. Always `response.audio.delta`.
758    #[serde(rename = "type")]
759    pub type_: String,
760}
761
762/// Emitted when the audio response is complete.
763#[derive(Debug, Clone, Serialize, Deserialize)]
764#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
765pub struct ResponseAudioDoneEvent {
766    /// The sequence number of the delta.
767    pub sequence_number: i64,
768    /// The type of the event. Always `response.audio.done`.
769    #[serde(rename = "type")]
770    pub type_: String,
771}
772
773/// Emitted when there is a partial transcript of audio.
774#[derive(Debug, Clone, Serialize, Deserialize)]
775#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
776pub struct ResponseAudioTranscriptDeltaEvent {
777    /// The partial transcript of the audio response.
778    pub delta: String,
779    /// The sequence number of this event.
780    pub sequence_number: i64,
781    /// The type of the event. Always `response.audio.transcript.delta`.
782    #[serde(rename = "type")]
783    pub type_: String,
784}
785
786/// Emitted when the full audio transcript is completed.
787#[derive(Debug, Clone, Serialize, Deserialize)]
788#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
789pub struct ResponseAudioTranscriptDoneEvent {
790    /// The sequence number of this event.
791    pub sequence_number: i64,
792    /// The type of the event. Always `response.audio.transcript.done`.
793    #[serde(rename = "type")]
794    pub type_: String,
795}
796
797/// Emitted when a partial code snippet is streamed by the code interpreter.
798#[derive(Debug, Clone, Serialize, Deserialize)]
799#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
800pub struct ResponseCodeInterpreterCallCodeDeltaEvent {
801    /// The partial code snippet being streamed by the code interpreter.
802    pub delta: String,
803    /// The unique identifier of the code interpreter tool call item.
804    pub item_id: String,
805    /// The index of the output item in the response for which the code is being
806    pub output_index: i64,
807    /// The sequence number of this event, used to order streaming events.
808    pub sequence_number: i64,
809    /// The type of the event. Always `response.code_interpreter_call_code.delta`.
810    #[serde(rename = "type")]
811    pub type_: String,
812}
813
814/// Emitted when the code snippet is finalized by the code interpreter.
815#[derive(Debug, Clone, Serialize, Deserialize)]
816#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
817pub struct ResponseCodeInterpreterCallCodeDoneEvent {
818    /// The final code snippet output by the code interpreter.
819    pub code: String,
820    /// The unique identifier of the code interpreter tool call item.
821    pub item_id: String,
822    /// The index of the output item in the response for which the code is finalized.
823    pub output_index: i64,
824    /// The sequence number of this event, used to order streaming events.
825    pub sequence_number: i64,
826    /// The type of the event. Always `response.code_interpreter_call_code.done`.
827    #[serde(rename = "type")]
828    pub type_: String,
829}
830
831/// Emitted when the code interpreter call is completed.
832#[derive(Debug, Clone, Serialize, Deserialize)]
833#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
834pub struct ResponseCodeInterpreterCallCompletedEvent {
835    /// The unique identifier of the code interpreter tool call item.
836    pub item_id: String,
837    /// The index of the output item in the response for which the code interpreter call
838    pub output_index: i64,
839    /// The sequence number of this event, used to order streaming events.
840    pub sequence_number: i64,
841    /// The type of the event. Always `response.code_interpreter_call.completed`.
842    #[serde(rename = "type")]
843    pub type_: String,
844}
845
846/// Emitted when a code interpreter call is in progress.
847#[derive(Debug, Clone, Serialize, Deserialize)]
848#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
849pub struct ResponseCodeInterpreterCallInProgressEvent {
850    /// The unique identifier of the code interpreter tool call item.
851    pub item_id: String,
852    /// The index of the output item in the response for which the code interpreter call
853    pub output_index: i64,
854    /// The sequence number of this event, used to order streaming events.
855    pub sequence_number: i64,
856    /// The type of the event. Always `response.code_interpreter_call.in_progress`.
857    #[serde(rename = "type")]
858    pub type_: String,
859}
860
861/// Emitted when the code interpreter is actively interpreting the code snippet.
862#[derive(Debug, Clone, Serialize, Deserialize)]
863#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
864pub struct ResponseCodeInterpreterCallInterpretingEvent {
865    /// The unique identifier of the code interpreter tool call item.
866    pub item_id: String,
867    /// The index of the output item in the response for which the code interpreter is
868    pub output_index: i64,
869    /// The sequence number of this event, used to order streaming events.
870    pub sequence_number: i64,
871    /// The type of the event. Always `response.code_interpreter_call.interpreting`.
872    #[serde(rename = "type")]
873    pub type_: String,
874}
875
876/// The logs output from the code interpreter.
877#[derive(Debug, Clone, Serialize, Deserialize)]
878#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
879pub struct OutputLogs {
880    /// The logs output from the code interpreter.
881    pub logs: String,
882    /// The type of the output. Always `logs`.
883    #[serde(rename = "type")]
884    pub type_: String,
885}
886
887/// The image output from the code interpreter.
888#[derive(Debug, Clone, Serialize, Deserialize)]
889#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
890pub struct OutputImage {
891    /// The type of the output. Always `image`.
892    #[serde(rename = "type")]
893    pub type_: String,
894    /// The URL of the image output from the code interpreter.
895    pub url: String,
896}
897
898pub type Output = serde_json::Value;
899
900#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
901#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
902#[non_exhaustive]
903pub enum ResponseCodeInterpreterToolCallStatus {
904    #[serde(rename = "in_progress")]
905    InProgress,
906    #[serde(rename = "completed")]
907    Completed,
908    #[serde(rename = "incomplete")]
909    Incomplete,
910    #[serde(rename = "interpreting")]
911    Interpreting,
912    #[serde(rename = "failed")]
913    Failed,
914}
915
916/// A tool call to run code.
917#[derive(Debug, Clone, Serialize, Deserialize)]
918#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
919pub struct ResponseCodeInterpreterToolCall {
920    /// The unique ID of the code interpreter tool call.
921    pub id: String,
922    /// The code to run, or null if not available.
923    #[serde(skip_serializing_if = "Option::is_none", default)]
924    pub code: Option<String>,
925    /// The ID of the container used to run the code.
926    pub container_id: String,
927    /// The outputs generated by the code interpreter, such as logs or images. Can be
928    #[serde(skip_serializing_if = "Option::is_none", default)]
929    pub outputs: Option<Vec<FunctionShellOutput>>,
930    /// The status of the code interpreter tool call.
931    pub status: ResponseCodeInterpreterToolCallStatus,
932    /// The type of the code interpreter tool call. Always `code_interpreter_call`.
933    #[serde(rename = "type")]
934    pub type_: String,
935}
936
937#[derive(Debug, Clone, Serialize, Deserialize)]
938#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
939pub struct ResponseCompactParams {
940    /// Model ID used to generate the response, like `gpt-5` or `o3`.
941    pub model: Option<String>,
942    /// Text, image, or file inputs to the model, used to generate a response
943    #[serde(skip_serializing_if = "Option::is_none", default)]
944    pub input: Option<String>,
945    /// A system (or developer) message inserted into the model's context. When used
946    #[serde(skip_serializing_if = "Option::is_none", default)]
947    pub instructions: Option<String>,
948    /// The unique ID of the previous response to the model.
949    #[serde(skip_serializing_if = "Option::is_none", default)]
950    pub previous_response_id: Option<String>,
951    /// A key to use when reading from or writing to the prompt cache.
952    #[serde(skip_serializing_if = "Option::is_none", default)]
953    pub prompt_cache_key: Option<String>,
954}
955
956/// A compaction item generated by the [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
957#[derive(Debug, Clone, Serialize, Deserialize)]
958#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
959pub struct ResponseCompactionItem {
960    /// The unique ID of the compaction item.
961    pub id: String,
962    /// The encrypted content that was produced by compaction.
963    pub encrypted_content: String,
964    /// The type of the item. Always `compaction`.
965    #[serde(rename = "type")]
966    pub type_: String,
967    /// The identifier of the actor that created the item.
968    #[serde(skip_serializing_if = "Option::is_none", default)]
969    pub created_by: Option<String>,
970}
971
972/// A pending safety check for the computer call.
973#[derive(Debug, Clone, Serialize, Deserialize)]
974#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
975pub struct PendingSafetyCheck {
976    /// The ID of the pending safety check.
977    pub id: String,
978    /// The type of the pending safety check.
979    #[serde(skip_serializing_if = "Option::is_none", default)]
980    pub code: Option<String>,
981    /// Details about the pending safety check.
982    #[serde(skip_serializing_if = "Option::is_none", default)]
983    pub message: Option<String>,
984}
985
986#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
987#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
988#[non_exhaustive]
989pub enum ActionClickButton {
990    #[serde(rename = "left")]
991    Left,
992    #[serde(rename = "right")]
993    Right,
994    #[serde(rename = "wheel")]
995    Wheel,
996    #[serde(rename = "back")]
997    Back,
998    #[serde(rename = "forward")]
999    Forward,
1000}
1001
1002/// A click action.
1003#[derive(Debug, Clone, Serialize, Deserialize)]
1004#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1005pub struct ActionClick {
1006    /// Indicates which mouse button was pressed during the click.
1007    pub button: ActionClickButton,
1008    /// Specifies the event type. For a click action, this property is always `click`.
1009    #[serde(rename = "type")]
1010    pub type_: String,
1011    /// The x-coordinate where the click occurred.
1012    pub x: i64,
1013    /// The y-coordinate where the click occurred.
1014    pub y: i64,
1015}
1016
1017/// A double click action.
1018#[derive(Debug, Clone, Serialize, Deserialize)]
1019#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1020pub struct ActionDoubleClick {
1021    /// Specifies the event type.
1022    #[serde(rename = "type")]
1023    pub type_: String,
1024    /// The x-coordinate where the double click occurred.
1025    pub x: i64,
1026    /// The y-coordinate where the double click occurred.
1027    pub y: i64,
1028}
1029
1030/// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
1031#[derive(Debug, Clone, Serialize, Deserialize)]
1032#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1033pub struct ActionDragPath {
1034    /// The x-coordinate.
1035    pub x: i64,
1036    /// The y-coordinate.
1037    pub y: i64,
1038}
1039
1040/// A drag action.
1041#[derive(Debug, Clone, Serialize, Deserialize)]
1042#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1043pub struct ActionDrag {
1044    /// An array of coordinates representing the path of the drag action.
1045    pub path: Vec<ActionDragPath>,
1046    /// Specifies the event type.
1047    #[serde(rename = "type")]
1048    pub type_: String,
1049}
1050
1051/// A collection of keypresses the model would like to perform.
1052#[derive(Debug, Clone, Serialize, Deserialize)]
1053#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1054pub struct ActionKeypress {
1055    /// The combination of keys the model is requesting to be pressed.
1056    pub keys: Vec<String>,
1057    /// Specifies the event type.
1058    #[serde(rename = "type")]
1059    pub type_: String,
1060}
1061
1062/// A mouse move action.
1063#[derive(Debug, Clone, Serialize, Deserialize)]
1064#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1065pub struct ActionMove {
1066    /// Specifies the event type.
1067    #[serde(rename = "type")]
1068    pub type_: String,
1069    /// The x-coordinate to move to.
1070    pub x: i64,
1071    /// The y-coordinate to move to.
1072    pub y: i64,
1073}
1074
1075/// A screenshot action.
1076#[derive(Debug, Clone, Serialize, Deserialize)]
1077#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1078pub struct ActionScreenshot {
1079    /// Specifies the event type.
1080    #[serde(rename = "type")]
1081    pub type_: String,
1082}
1083
1084/// A scroll action.
1085#[derive(Debug, Clone, Serialize, Deserialize)]
1086#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1087pub struct ActionScroll {
1088    /// The horizontal scroll distance.
1089    pub scroll_x: i64,
1090    /// The vertical scroll distance.
1091    pub scroll_y: i64,
1092    /// Specifies the event type.
1093    #[serde(rename = "type")]
1094    pub type_: String,
1095    /// The x-coordinate where the scroll occurred.
1096    pub x: i64,
1097    /// The y-coordinate where the scroll occurred.
1098    pub y: i64,
1099}
1100
1101/// An action to type in text.
1102#[derive(Debug, Clone, Serialize, Deserialize)]
1103#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1104pub struct ActionType {
1105    /// The text to type.
1106    pub text: String,
1107    /// Specifies the event type.
1108    #[serde(rename = "type")]
1109    pub type_: String,
1110}
1111
1112/// A wait action.
1113#[derive(Debug, Clone, Serialize, Deserialize)]
1114#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1115pub struct ActionWait {
1116    /// Specifies the event type.
1117    #[serde(rename = "type")]
1118    pub type_: String,
1119}
1120
1121pub type Action = serde_json::Value;
1122
1123#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1124#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1125#[non_exhaustive]
1126pub enum ResponseComputerToolCallStatus {
1127    #[serde(rename = "in_progress")]
1128    InProgress,
1129    #[serde(rename = "completed")]
1130    Completed,
1131    #[serde(rename = "incomplete")]
1132    Incomplete,
1133}
1134
1135/// A tool call to a computer use tool.
1136#[derive(Debug, Clone, Serialize, Deserialize)]
1137#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1138pub struct ResponseComputerToolCall {
1139    /// The unique ID of the computer call.
1140    pub id: String,
1141    /// An identifier used when responding to the tool call with output.
1142    pub call_id: String,
1143    /// The pending safety checks for the computer call.
1144    pub pending_safety_checks: Vec<PendingSafetyCheck>,
1145    /// The status of the item.
1146    pub status: ResponseComputerToolCallStatus,
1147    /// The type of the computer call. Always `computer_call`.
1148    #[serde(rename = "type")]
1149    pub type_: String,
1150    /// A click action.
1151    #[serde(skip_serializing_if = "Option::is_none", default)]
1152    pub action: Option<FunctionShellAction>,
1153    /// Flattened batched actions for `computer_use`.
1154    #[serde(skip_serializing_if = "Option::is_none", default)]
1155    pub actions: Option<ComputerActionList>,
1156}
1157
1158/// A pending safety check for the computer call.
1159#[derive(Debug, Clone, Serialize, Deserialize)]
1160#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1161pub struct AcknowledgedSafetyCheck {
1162    /// The ID of the pending safety check.
1163    pub id: String,
1164    /// The type of the pending safety check.
1165    #[serde(skip_serializing_if = "Option::is_none", default)]
1166    pub code: Option<String>,
1167    /// Details about the pending safety check.
1168    #[serde(skip_serializing_if = "Option::is_none", default)]
1169    pub message: Option<String>,
1170}
1171
1172#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1173#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1174#[non_exhaustive]
1175pub enum ResponseComputerToolCallOutputItemStatus {
1176    #[serde(rename = "in_progress")]
1177    InProgress,
1178    #[serde(rename = "completed")]
1179    Completed,
1180    #[serde(rename = "incomplete")]
1181    Incomplete,
1182}
1183
1184#[derive(Debug, Clone, Serialize, Deserialize)]
1185#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1186pub struct ResponseComputerToolCallOutputItem {
1187    /// The unique ID of the computer call tool output.
1188    pub id: String,
1189    /// The ID of the computer tool call that produced the output.
1190    pub call_id: String,
1191    /// A computer screenshot image used with the computer use tool.
1192    pub output: ResponseComputerToolCallOutputScreenshot,
1193    /// The type of the computer tool call output. Always `computer_call_output`.
1194    #[serde(rename = "type")]
1195    pub type_: String,
1196    /// The safety checks reported by the API that have been acknowledged by the
1197    #[serde(skip_serializing_if = "Option::is_none", default)]
1198    pub acknowledged_safety_checks: Option<Vec<AcknowledgedSafetyCheck>>,
1199    /// The status of the message input.
1200    #[serde(skip_serializing_if = "Option::is_none", default)]
1201    pub status: Option<ResponseComputerToolCallOutputItemStatus>,
1202}
1203
1204/// A computer screenshot image used with the computer use tool.
1205#[derive(Debug, Clone, Serialize, Deserialize)]
1206#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1207pub struct ResponseComputerToolCallOutputScreenshot {
1208    /// Specifies the event type.
1209    #[serde(rename = "type")]
1210    pub type_: String,
1211    /// The identifier of an uploaded file that contains the screenshot.
1212    #[serde(skip_serializing_if = "Option::is_none", default)]
1213    pub file_id: Option<String>,
1214    /// The URL of the screenshot image.
1215    #[serde(skip_serializing_if = "Option::is_none", default)]
1216    pub image_url: Option<String>,
1217}
1218
1219/// Represents a container created with /v1/containers.
1220#[derive(Debug, Clone, Serialize, Deserialize)]
1221#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1222pub struct ResponseContainerReference {
1223    pub container_id: String,
1224    /// The environment type. Always `container_reference`.
1225    #[serde(rename = "type")]
1226    pub type_: String,
1227}
1228
1229/// Reasoning text from the model.
1230#[derive(Debug, Clone, Serialize, Deserialize)]
1231#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1232pub struct PartReasoningText {
1233    /// The reasoning text from the model.
1234    pub text: String,
1235    /// The type of the reasoning text. Always `reasoning_text`.
1236    #[serde(rename = "type")]
1237    pub type_: String,
1238}
1239
1240pub type Part = serde_json::Value;
1241
1242/// Emitted when a new content part is added.
1243#[derive(Debug, Clone, Serialize, Deserialize)]
1244#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1245pub struct ResponseContentPartAddedEvent {
1246    /// The index of the content part that was added.
1247    pub content_index: i64,
1248    /// The ID of the output item that the content part was added to.
1249    pub item_id: String,
1250    /// The index of the output item that the content part was added to.
1251    pub output_index: i64,
1252    /// The content part that was added.
1253    pub part: ReasoningSummaryPart,
1254    /// The sequence number of this event.
1255    pub sequence_number: i64,
1256    /// The type of the event. Always `response.content_part.added`.
1257    #[serde(rename = "type")]
1258    pub type_: String,
1259}
1260
1261/// Emitted when a content part is done.
1262#[derive(Debug, Clone, Serialize, Deserialize)]
1263#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1264pub struct ResponseContentPartDoneEvent {
1265    /// The index of the content part that is done.
1266    pub content_index: i64,
1267    /// The ID of the output item that the content part was added to.
1268    pub item_id: String,
1269    /// The index of the output item that the content part was added to.
1270    pub output_index: i64,
1271    /// The content part that is done.
1272    pub part: ReasoningSummaryPart,
1273    /// The sequence number of this event.
1274    pub sequence_number: i64,
1275    /// The type of the event. Always `response.content_part.done`.
1276    #[serde(rename = "type")]
1277    pub type_: String,
1278}
1279
1280#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1281#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1282#[non_exhaustive]
1283pub enum ResponseCreateParamsBasePromptCacheRetention {
1284    #[serde(rename = "in-memory")]
1285    InMemory,
1286    #[serde(rename = "24h")]
1287    V24h,
1288}
1289
1290#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1291#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1292#[non_exhaustive]
1293pub enum ResponseCreateParamsBaseServiceTier {
1294    #[serde(rename = "auto")]
1295    Auto,
1296    #[serde(rename = "default")]
1297    Default,
1298    #[serde(rename = "flex")]
1299    Flex,
1300    #[serde(rename = "scale")]
1301    Scale,
1302    #[serde(rename = "priority")]
1303    Priority,
1304}
1305
1306#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1307#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1308#[non_exhaustive]
1309pub enum ResponseCreateParamsBaseTruncation {
1310    #[serde(rename = "auto")]
1311    Auto,
1312    #[serde(rename = "disabled")]
1313    Disabled,
1314}
1315
1316#[derive(Debug, Clone, Serialize, Deserialize)]
1317#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1318pub struct ResponseCreateParamsBase {
1319    /// Whether to run the model response in the background.
1320    #[serde(skip_serializing_if = "Option::is_none", default)]
1321    pub background: Option<bool>,
1322    /// Context management configuration for this request.
1323    #[serde(skip_serializing_if = "Option::is_none", default)]
1324    pub context_management: Option<Vec<ContextManagement>>,
1325    /// The conversation that this response belongs to.
1326    #[serde(skip_serializing_if = "Option::is_none", default)]
1327    pub conversation: Option<Conversation>,
1328    /// Specify additional output data to include in the model response.
1329    #[serde(skip_serializing_if = "Option::is_none", default)]
1330    pub include: Option<Vec<ResponseIncludable>>,
1331    /// Text, image, or file inputs to the model, used to generate a response.
1332    #[serde(skip_serializing_if = "Option::is_none", default)]
1333    pub input: Option<String>,
1334    /// A system (or developer) message inserted into the model's context.
1335    #[serde(skip_serializing_if = "Option::is_none", default)]
1336    pub instructions: Option<String>,
1337    /// An upper bound for the number of tokens that can be generated for a response,
1338    #[serde(skip_serializing_if = "Option::is_none", default)]
1339    pub max_output_tokens: Option<i64>,
1340    /// The maximum number of total calls to built-in tools that can be processed in a
1341    #[serde(skip_serializing_if = "Option::is_none", default)]
1342    pub max_tool_calls: Option<i64>,
1343    /// Set of 16 key-value pairs that can be attached to an object.
1344    #[serde(skip_serializing_if = "Option::is_none", default)]
1345    pub metadata: Option<serde_json::Value>,
1346    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
1347    #[serde(skip_serializing_if = "Option::is_none", default)]
1348    pub model: Option<serde_json::Value>,
1349    /// Whether to allow the model to run tool calls in parallel.
1350    #[serde(skip_serializing_if = "Option::is_none", default)]
1351    pub parallel_tool_calls: Option<bool>,
1352    /// The unique ID of the previous response to the model.
1353    #[serde(skip_serializing_if = "Option::is_none", default)]
1354    pub previous_response_id: Option<String>,
1355    /// Reference to a prompt template and its variables.
1356    #[serde(skip_serializing_if = "Option::is_none", default)]
1357    pub prompt: Option<serde_json::Value>,
1358    /// Used by OpenAI to cache responses for similar requests to optimize your cache
1359    #[serde(skip_serializing_if = "Option::is_none", default)]
1360    pub prompt_cache_key: Option<String>,
1361    /// The retention policy for the prompt cache.
1362    #[serde(skip_serializing_if = "Option::is_none", default)]
1363    pub prompt_cache_retention: Option<ResponseCreateParamsBasePromptCacheRetention>,
1364    /// **gpt-5 and o-series models only**
1365    #[serde(skip_serializing_if = "Option::is_none", default)]
1366    pub reasoning: Option<serde_json::Value>,
1367    /// A stable identifier used to help detect users of your application that may be
1368    #[serde(skip_serializing_if = "Option::is_none", default)]
1369    pub safety_identifier: Option<String>,
1370    /// Specifies the processing type used for serving the request.
1371    #[serde(skip_serializing_if = "Option::is_none", default)]
1372    pub service_tier: Option<ResponseCreateParamsBaseServiceTier>,
1373    /// Whether to store the generated model response for later retrieval via API.
1374    #[serde(skip_serializing_if = "Option::is_none", default)]
1375    pub store: Option<bool>,
1376    /// Options for streaming responses. Only set this when you set `stream: true`.
1377    #[serde(skip_serializing_if = "Option::is_none", default)]
1378    pub stream_options: Option<StreamOptions>,
1379    /// What sampling temperature to use, between 0 and 2.
1380    #[serde(skip_serializing_if = "Option::is_none", default)]
1381    pub temperature: Option<f64>,
1382    /// Configuration options for a text response from the model.
1383    #[serde(skip_serializing_if = "Option::is_none", default)]
1384    pub text: Option<serde_json::Value>,
1385    /// How the model should select which tool (or tools) to use when generating a
1386    #[serde(skip_serializing_if = "Option::is_none", default)]
1387    pub tool_choice: Option<ToolChoice>,
1388    /// An array of tools the model may call while generating a response.
1389    #[serde(skip_serializing_if = "Option::is_none", default)]
1390    pub tools: Option<Vec<serde_json::Value>>,
1391    /// An integer between 0 and 20 specifying the number of most likely tokens to
1392    #[serde(skip_serializing_if = "Option::is_none", default)]
1393    pub top_logprobs: Option<i64>,
1394    /// An alternative to sampling with temperature, called nucleus sampling, where the
1395    #[serde(skip_serializing_if = "Option::is_none", default)]
1396    pub top_p: Option<f64>,
1397    /// The truncation strategy to use for the model response.
1398    #[serde(skip_serializing_if = "Option::is_none", default)]
1399    pub truncation: Option<ResponseCreateParamsBaseTruncation>,
1400    /// This field is being replaced by `safety_identifier` and `prompt_cache_key`.
1401    #[serde(skip_serializing_if = "Option::is_none", default)]
1402    pub user: Option<String>,
1403}
1404
1405#[derive(Debug, Clone, Serialize, Deserialize)]
1406#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1407pub struct ContextManagement {
1408    /// The context management entry type. Currently only 'compaction' is supported.
1409    #[serde(rename = "type")]
1410    pub type_: String,
1411    /// Token threshold at which compaction should be triggered for this entry.
1412    #[serde(skip_serializing_if = "Option::is_none", default)]
1413    pub compact_threshold: Option<i64>,
1414}
1415
1416/// Options for streaming responses. Only set this when you set `stream: true`.
1417#[derive(Debug, Clone, Serialize, Deserialize)]
1418#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1419pub struct StreamOptions {
1420    /// When true, stream obfuscation will be enabled.
1421    #[serde(skip_serializing_if = "Option::is_none", default)]
1422    pub include_obfuscation: Option<bool>,
1423}
1424
1425pub type ResponseCreateParams = serde_json::Value;
1426
1427/// An event that is emitted when a response is created.
1428#[derive(Debug, Clone, Serialize, Deserialize)]
1429#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1430pub struct ResponseCreatedEvent {
1431    /// The response that was created.
1432    pub response: Response,
1433    /// The sequence number for this event.
1434    pub sequence_number: i64,
1435    /// The type of the event. Always `response.created`.
1436    #[serde(rename = "type")]
1437    pub type_: String,
1438}
1439
1440/// A call to a custom tool created by the model.
1441#[derive(Debug, Clone, Serialize, Deserialize)]
1442#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1443pub struct ResponseCustomToolCall {
1444    /// An identifier used to map this custom tool call to a tool call output.
1445    pub call_id: String,
1446    /// The input for the custom tool call generated by the model.
1447    pub input: String,
1448    /// The name of the custom tool being called.
1449    pub name: String,
1450    /// The type of the custom tool call. Always `custom_tool_call`.
1451    #[serde(rename = "type")]
1452    pub type_: String,
1453    /// The unique ID of the custom tool call in the OpenAI platform.
1454    #[serde(skip_serializing_if = "Option::is_none", default)]
1455    pub id: Option<String>,
1456    /// The namespace of the custom tool being called.
1457    #[serde(skip_serializing_if = "Option::is_none", default)]
1458    pub namespace: Option<String>,
1459}
1460
1461/// Event representing a delta (partial update) to the input of a custom tool call.
1462#[derive(Debug, Clone, Serialize, Deserialize)]
1463#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1464pub struct ResponseCustomToolCallInputDeltaEvent {
1465    /// The incremental input data (delta) for the custom tool call.
1466    pub delta: String,
1467    /// Unique identifier for the API item associated with this event.
1468    pub item_id: String,
1469    /// The index of the output this delta applies to.
1470    pub output_index: i64,
1471    /// The sequence number of this event.
1472    pub sequence_number: i64,
1473    /// The event type identifier.
1474    #[serde(rename = "type")]
1475    pub type_: String,
1476}
1477
1478/// Event indicating that input for a custom tool call is complete.
1479#[derive(Debug, Clone, Serialize, Deserialize)]
1480#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1481pub struct ResponseCustomToolCallInputDoneEvent {
1482    /// The complete input data for the custom tool call.
1483    pub input: String,
1484    /// Unique identifier for the API item associated with this event.
1485    pub item_id: String,
1486    /// The index of the output this event applies to.
1487    pub output_index: i64,
1488    /// The sequence number of this event.
1489    pub sequence_number: i64,
1490    /// The event type identifier.
1491    #[serde(rename = "type")]
1492    pub type_: String,
1493}
1494
1495pub type OutputOutputContentList = serde_json::Value;
1496
1497/// The output of a custom tool call from your code, being sent back to the model.
1498#[derive(Debug, Clone, Serialize, Deserialize)]
1499#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1500pub struct ResponseCustomToolCallOutput {
1501    /// The call ID, used to map this custom tool call output to a custom tool call.
1502    pub call_id: String,
1503    /// The output from the custom tool call generated by your code. Can be a string or
1504    pub output: String,
1505    /// The type of the custom tool call output. Always `custom_tool_call_output`.
1506    #[serde(rename = "type")]
1507    pub type_: String,
1508    /// The unique ID of the custom tool call output in the OpenAI platform.
1509    #[serde(skip_serializing_if = "Option::is_none", default)]
1510    pub id: Option<String>,
1511}
1512
1513#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1514#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1515#[non_exhaustive]
1516pub enum ResponseErrorCode {
1517    #[serde(rename = "server_error")]
1518    ServerError,
1519    #[serde(rename = "rate_limit_exceeded")]
1520    RateLimitExceeded,
1521    #[serde(rename = "invalid_prompt")]
1522    InvalidPrompt,
1523    #[serde(rename = "vector_store_timeout")]
1524    VectorStoreTimeout,
1525    #[serde(rename = "invalid_image")]
1526    InvalidImage,
1527    #[serde(rename = "invalid_image_format")]
1528    InvalidImageFormat,
1529    #[serde(rename = "invalid_base64_image")]
1530    InvalidBase64Image,
1531    #[serde(rename = "invalid_image_url")]
1532    InvalidImageUrl,
1533    #[serde(rename = "image_too_large")]
1534    ImageTooLarge,
1535    #[serde(rename = "image_too_small")]
1536    ImageTooSmall,
1537    #[serde(rename = "image_parse_error")]
1538    ImageParseError,
1539    #[serde(rename = "image_content_policy_violation")]
1540    ImageContentPolicyViolation,
1541    #[serde(rename = "invalid_image_mode")]
1542    InvalidImageMode,
1543    #[serde(rename = "image_file_too_large")]
1544    ImageFileTooLarge,
1545    #[serde(rename = "unsupported_image_media_type")]
1546    UnsupportedImageMediaType,
1547    #[serde(rename = "empty_image_file")]
1548    EmptyImageFile,
1549    #[serde(rename = "failed_to_download_image")]
1550    FailedToDownloadImage,
1551    #[serde(rename = "image_file_not_found")]
1552    ImageFileNotFound,
1553}
1554
1555/// Emitted when a file search call is completed (results found).
1556#[derive(Debug, Clone, Serialize, Deserialize)]
1557#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1558pub struct ResponseFileSearchCallCompletedEvent {
1559    /// The ID of the output item that the file search call is initiated.
1560    pub item_id: String,
1561    /// The index of the output item that the file search call is initiated.
1562    pub output_index: i64,
1563    /// The sequence number of this event.
1564    pub sequence_number: i64,
1565    /// The type of the event. Always `response.file_search_call.completed`.
1566    #[serde(rename = "type")]
1567    pub type_: String,
1568}
1569
1570/// Emitted when a file search call is initiated.
1571#[derive(Debug, Clone, Serialize, Deserialize)]
1572#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1573pub struct ResponseFileSearchCallInProgressEvent {
1574    /// The ID of the output item that the file search call is initiated.
1575    pub item_id: String,
1576    /// The index of the output item that the file search call is initiated.
1577    pub output_index: i64,
1578    /// The sequence number of this event.
1579    pub sequence_number: i64,
1580    /// The type of the event. Always `response.file_search_call.in_progress`.
1581    #[serde(rename = "type")]
1582    pub type_: String,
1583}
1584
1585/// Emitted when a file search is currently searching.
1586#[derive(Debug, Clone, Serialize, Deserialize)]
1587#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1588pub struct ResponseFileSearchCallSearchingEvent {
1589    /// The ID of the output item that the file search call is initiated.
1590    pub item_id: String,
1591    /// The index of the output item that the file search call is searching.
1592    pub output_index: i64,
1593    /// The sequence number of this event.
1594    pub sequence_number: i64,
1595    /// The type of the event. Always `response.file_search_call.searching`.
1596    #[serde(rename = "type")]
1597    pub type_: String,
1598}
1599
1600#[derive(Debug, Clone, Serialize, Deserialize)]
1601#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1602pub struct FileSearchResult {
1603    /// Set of 16 key-value pairs that can be attached to an object.
1604    #[serde(skip_serializing_if = "Option::is_none", default)]
1605    pub attributes: Option<std::collections::HashMap<String, serde_json::Value>>,
1606    /// The unique ID of the file.
1607    #[serde(skip_serializing_if = "Option::is_none", default)]
1608    pub file_id: Option<String>,
1609    /// The name of the file.
1610    #[serde(skip_serializing_if = "Option::is_none", default)]
1611    pub filename: Option<String>,
1612    /// The relevance score of the file - a value between 0 and 1.
1613    #[serde(skip_serializing_if = "Option::is_none", default)]
1614    pub score: Option<f64>,
1615    /// The text that was retrieved from the file.
1616    #[serde(skip_serializing_if = "Option::is_none", default)]
1617    pub text: Option<String>,
1618}
1619
1620#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1621#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1622#[non_exhaustive]
1623pub enum ResponseFileSearchToolCallStatus {
1624    #[serde(rename = "in_progress")]
1625    InProgress,
1626    #[serde(rename = "searching")]
1627    Searching,
1628    #[serde(rename = "completed")]
1629    Completed,
1630    #[serde(rename = "incomplete")]
1631    Incomplete,
1632    #[serde(rename = "failed")]
1633    Failed,
1634}
1635
1636/// The results of a file search tool call.
1637#[derive(Debug, Clone, Serialize, Deserialize)]
1638#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1639pub struct ResponseFileSearchToolCall {
1640    /// The unique ID of the file search tool call.
1641    pub id: String,
1642    /// The queries used to search for files.
1643    pub queries: Vec<String>,
1644    /// The status of the file search tool call.
1645    pub status: ResponseFileSearchToolCallStatus,
1646    /// The type of the file search tool call. Always `file_search_call`.
1647    #[serde(rename = "type")]
1648    pub type_: String,
1649    /// The results of the file search tool call.
1650    #[serde(skip_serializing_if = "Option::is_none", default)]
1651    pub results: Option<Vec<FileSearchResult>>,
1652}
1653
1654pub type ResponseFormatTextConfig = serde_json::Value;
1655
1656/// JSON Schema response format.
1657#[derive(Debug, Clone, Serialize, Deserialize)]
1658#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1659pub struct ResponseFormatTextJSONSchemaConfig {
1660    /// The name of the response format.
1661    pub name: String,
1662    /// The schema for the response format, described as a JSON Schema object. Learn how
1663    #[serde(rename = "schema")]
1664    pub schema_: std::collections::HashMap<String, serde_json::Value>,
1665    /// The type of response format being defined. Always `json_schema`.
1666    #[serde(rename = "type")]
1667    pub type_: String,
1668    /// A description of what the response format is for, used by the model to determine
1669    #[serde(skip_serializing_if = "Option::is_none", default)]
1670    pub description: Option<String>,
1671    /// Whether to enable strict schema adherence when generating the output. If set to
1672    #[serde(skip_serializing_if = "Option::is_none", default)]
1673    pub strict: Option<bool>,
1674}
1675
1676pub type ResponseFunctionCallOutputItem = serde_json::Value;
1677
1678pub type ResponseFunctionCallOutputItemList = Vec<ResponseFunctionCallOutputItem>;
1679
1680/// Indicates that the shell call exceeded its configured time limit.
1681#[derive(Debug, Clone, Serialize, Deserialize)]
1682#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1683pub struct OutcomeTimeout {
1684    /// The outcome type. Always `timeout`.
1685    #[serde(rename = "type")]
1686    pub type_: String,
1687}
1688
1689/// Indicates that the shell commands finished and returned an exit code.
1690#[derive(Debug, Clone, Serialize, Deserialize)]
1691#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1692pub struct OutcomeExit {
1693    /// The exit code returned by the shell process.
1694    pub exit_code: i64,
1695    /// The outcome type. Always `exit`.
1696    #[serde(rename = "type")]
1697    pub type_: String,
1698}
1699
1700pub type Outcome = serde_json::Value;
1701
1702/// Captured stdout and stderr for a portion of a shell tool call output.
1703#[derive(Debug, Clone, Serialize, Deserialize)]
1704#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1705pub struct ResponseFunctionShellCallOutputContent {
1706    /// The exit or timeout outcome associated with this shell call.
1707    pub outcome: Outcome,
1708    /// Captured stderr output for the shell call.
1709    pub stderr: String,
1710    /// Captured stdout output for the shell call.
1711    pub stdout: String,
1712}
1713
1714/// The shell commands and limits that describe how to run the tool call.
1715#[derive(Debug, Clone, Serialize, Deserialize)]
1716#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1717pub struct FunctionShellAction {
1718    pub commands: Vec<String>,
1719    /// Optional maximum number of characters to return from each command.
1720    #[serde(skip_serializing_if = "Option::is_none", default)]
1721    pub max_output_length: Option<i64>,
1722    /// Optional timeout in milliseconds for the commands.
1723    #[serde(skip_serializing_if = "Option::is_none", default)]
1724    pub timeout_ms: Option<i64>,
1725}
1726
1727#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1728#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1729#[non_exhaustive]
1730pub enum ResponseFunctionShellToolCallStatus {
1731    #[serde(rename = "in_progress")]
1732    InProgress,
1733    #[serde(rename = "completed")]
1734    Completed,
1735    #[serde(rename = "incomplete")]
1736    Incomplete,
1737}
1738
1739/// A tool call that executes one or more shell commands in a managed environment.
1740#[derive(Debug, Clone, Serialize, Deserialize)]
1741#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1742pub struct ResponseFunctionShellToolCall {
1743    /// The unique ID of the shell tool call.
1744    pub id: String,
1745    /// The shell commands and limits that describe how to run the tool call.
1746    pub action: FunctionShellAction,
1747    /// The unique ID of the shell tool call generated by the model.
1748    pub call_id: String,
1749    /// Represents the use of a local environment to perform shell actions.
1750    #[serde(skip_serializing_if = "Option::is_none", default)]
1751    pub environment: Option<Environment>,
1752    /// The status of the shell call.
1753    pub status: ResponseFunctionShellToolCallStatus,
1754    /// The type of the item. Always `shell_call`.
1755    #[serde(rename = "type")]
1756    pub type_: String,
1757    /// The ID of the entity that created this tool call.
1758    #[serde(skip_serializing_if = "Option::is_none", default)]
1759    pub created_by: Option<String>,
1760}
1761
1762/// Indicates that the shell call exceeded its configured time limit.
1763#[derive(Debug, Clone, Serialize, Deserialize)]
1764#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1765pub struct OutputOutcomeTimeout {
1766    /// The outcome type. Always `timeout`.
1767    #[serde(rename = "type")]
1768    pub type_: String,
1769}
1770
1771/// Indicates that the shell commands finished and returned an exit code.
1772#[derive(Debug, Clone, Serialize, Deserialize)]
1773#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1774pub struct OutputOutcomeExit {
1775    /// Exit code from the shell process.
1776    pub exit_code: i64,
1777    /// The outcome type. Always `exit`.
1778    #[serde(rename = "type")]
1779    pub type_: String,
1780}
1781
1782pub type OutputOutcome = serde_json::Value;
1783
1784/// The content of a shell tool call output that was emitted.
1785#[derive(Debug, Clone, Serialize, Deserialize)]
1786#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1787pub struct FunctionShellOutput {
1788    /// Represents either an exit outcome (with an exit code) or a timeout outcome for a
1789    pub outcome: OutputOutcome,
1790    /// The standard error output that was captured.
1791    pub stderr: String,
1792    /// The standard output that was captured.
1793    pub stdout: String,
1794    /// The identifier of the actor that created the item.
1795    #[serde(skip_serializing_if = "Option::is_none", default)]
1796    pub created_by: Option<String>,
1797}
1798
1799#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1800#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1801#[non_exhaustive]
1802pub enum ResponseFunctionShellToolCallOutputStatus {
1803    #[serde(rename = "in_progress")]
1804    InProgress,
1805    #[serde(rename = "completed")]
1806    Completed,
1807    #[serde(rename = "incomplete")]
1808    Incomplete,
1809}
1810
1811/// The output of a shell tool call that was emitted.
1812#[derive(Debug, Clone, Serialize, Deserialize)]
1813#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1814pub struct ResponseFunctionShellToolCallOutput {
1815    /// The unique ID of the shell call output.
1816    pub id: String,
1817    /// The unique ID of the shell tool call generated by the model.
1818    pub call_id: String,
1819    /// The maximum length of the shell command output.
1820    #[serde(skip_serializing_if = "Option::is_none", default)]
1821    pub max_output_length: Option<i64>,
1822    /// An array of shell call output contents
1823    pub output: Vec<FunctionShellOutput>,
1824    /// The status of the shell call output.
1825    pub status: ResponseFunctionShellToolCallOutputStatus,
1826    /// The type of the shell call output. Always `shell_call_output`.
1827    #[serde(rename = "type")]
1828    pub type_: String,
1829    /// The identifier of the actor that created the item.
1830    #[serde(skip_serializing_if = "Option::is_none", default)]
1831    pub created_by: Option<String>,
1832}
1833
1834#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1835#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1836#[non_exhaustive]
1837pub enum ResponseFunctionToolCallStatus {
1838    #[serde(rename = "in_progress")]
1839    InProgress,
1840    #[serde(rename = "completed")]
1841    Completed,
1842    #[serde(rename = "incomplete")]
1843    Incomplete,
1844}
1845
1846/// A tool call to run a function.
1847#[derive(Debug, Clone, Serialize, Deserialize)]
1848#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1849pub struct ResponseFunctionToolCall {
1850    /// A JSON string of the arguments to pass to the function.
1851    pub arguments: String,
1852    /// The unique ID of the function tool call generated by the model.
1853    pub call_id: String,
1854    /// The name of the function to run.
1855    pub name: String,
1856    /// The type of the function tool call. Always `function_call`.
1857    #[serde(rename = "type")]
1858    pub type_: String,
1859    /// The unique ID of the function tool call.
1860    #[serde(skip_serializing_if = "Option::is_none", default)]
1861    pub id: Option<String>,
1862    /// The namespace of the function to run.
1863    #[serde(skip_serializing_if = "Option::is_none", default)]
1864    pub namespace: Option<String>,
1865    /// The status of the item.
1866    #[serde(skip_serializing_if = "Option::is_none", default)]
1867    pub status: Option<ResponseFunctionToolCallStatus>,
1868}
1869
1870#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1871#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1872#[non_exhaustive]
1873pub enum ResponseFunctionToolCallOutputItemStatus {
1874    #[serde(rename = "in_progress")]
1875    InProgress,
1876    #[serde(rename = "completed")]
1877    Completed,
1878    #[serde(rename = "incomplete")]
1879    Incomplete,
1880}
1881
1882#[derive(Debug, Clone, Serialize, Deserialize)]
1883#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1884pub struct ResponseFunctionToolCallOutputItem {
1885    /// The unique ID of the function call tool output.
1886    pub id: String,
1887    /// The unique ID of the function tool call generated by the model.
1888    pub call_id: String,
1889    /// The output from the function call generated by your code. Can be a string or an
1890    pub output: String,
1891    /// The type of the function tool call output. Always `function_call_output`.
1892    #[serde(rename = "type")]
1893    pub type_: String,
1894    /// The status of the item.
1895    #[serde(skip_serializing_if = "Option::is_none", default)]
1896    pub status: Option<ResponseFunctionToolCallOutputItemStatus>,
1897}
1898
1899/// A source used in the search.
1900#[derive(Debug, Clone, Serialize, Deserialize)]
1901#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1902pub struct ActionSearchSource {
1903    /// The type of source. Always `url`.
1904    #[serde(rename = "type")]
1905    pub type_: String,
1906    /// The URL of the source.
1907    pub url: String,
1908}
1909
1910/// Action type "search" - Performs a web search query.
1911#[derive(Debug, Clone, Serialize, Deserialize)]
1912#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1913pub struct ActionSearch {
1914    /// [DEPRECATED] The search query.
1915    pub query: String,
1916    /// The action type.
1917    #[serde(rename = "type")]
1918    pub type_: String,
1919    /// The search queries.
1920    #[serde(skip_serializing_if = "Option::is_none", default)]
1921    pub queries: Option<Vec<String>>,
1922    /// The sources used in the search.
1923    #[serde(skip_serializing_if = "Option::is_none", default)]
1924    pub sources: Option<Vec<ActionSearchSource>>,
1925}
1926
1927/// Action type "open_page" - Opens a specific URL from search results.
1928#[derive(Debug, Clone, Serialize, Deserialize)]
1929#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1930pub struct ActionOpenPage {
1931    /// The action type.
1932    #[serde(rename = "type")]
1933    pub type_: String,
1934    /// The URL opened by the model.
1935    #[serde(skip_serializing_if = "Option::is_none", default)]
1936    pub url: Option<String>,
1937}
1938
1939/// Action type "find_in_page": Searches for a pattern within a loaded page.
1940#[derive(Debug, Clone, Serialize, Deserialize)]
1941#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1942pub struct ActionFind {
1943    /// The pattern or text to search for within the page.
1944    pub pattern: String,
1945    /// The action type.
1946    #[serde(rename = "type")]
1947    pub type_: String,
1948    /// The URL of the page searched for the pattern.
1949    pub url: String,
1950}
1951
1952#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1953#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1954#[non_exhaustive]
1955pub enum ResponseFunctionWebSearchStatus {
1956    #[serde(rename = "in_progress")]
1957    InProgress,
1958    #[serde(rename = "searching")]
1959    Searching,
1960    #[serde(rename = "completed")]
1961    Completed,
1962    #[serde(rename = "failed")]
1963    Failed,
1964}
1965
1966/// The results of a web search tool call.
1967#[derive(Debug, Clone, Serialize, Deserialize)]
1968#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1969pub struct ResponseFunctionWebSearch {
1970    /// The unique ID of the web search tool call.
1971    pub id: String,
1972    /// An object describing the specific action taken in this web search call. Includes
1973    pub action: FunctionShellAction,
1974    /// The status of the web search tool call.
1975    pub status: ResponseFunctionWebSearchStatus,
1976    /// The type of the web search tool call. Always `web_search_call`.
1977    #[serde(rename = "type")]
1978    pub type_: String,
1979}
1980
1981/// Emitted when an image generation tool call has completed and the final image is available.
1982#[derive(Debug, Clone, Serialize, Deserialize)]
1983#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1984pub struct ResponseImageGenCallCompletedEvent {
1985    /// The unique identifier of the image generation item being processed.
1986    pub item_id: String,
1987    /// The index of the output item in the response's output array.
1988    pub output_index: i64,
1989    /// The sequence number of this event.
1990    pub sequence_number: i64,
1991    /// The type of the event. Always 'response.image_generation_call.completed'.
1992    #[serde(rename = "type")]
1993    pub type_: String,
1994}
1995
1996/// Emitted when an image generation tool call is actively generating an image (intermediate state).
1997#[derive(Debug, Clone, Serialize, Deserialize)]
1998#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
1999pub struct ResponseImageGenCallGeneratingEvent {
2000    /// The unique identifier of the image generation item being processed.
2001    pub item_id: String,
2002    /// The index of the output item in the response's output array.
2003    pub output_index: i64,
2004    /// The sequence number of the image generation item being processed.
2005    pub sequence_number: i64,
2006    /// The type of the event. Always 'response.image_generation_call.generating'.
2007    #[serde(rename = "type")]
2008    pub type_: String,
2009}
2010
2011/// Emitted when an image generation tool call is in progress.
2012#[derive(Debug, Clone, Serialize, Deserialize)]
2013#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2014pub struct ResponseImageGenCallInProgressEvent {
2015    /// The unique identifier of the image generation item being processed.
2016    pub item_id: String,
2017    /// The index of the output item in the response's output array.
2018    pub output_index: i64,
2019    /// The sequence number of the image generation item being processed.
2020    pub sequence_number: i64,
2021    /// The type of the event. Always 'response.image_generation_call.in_progress'.
2022    #[serde(rename = "type")]
2023    pub type_: String,
2024}
2025
2026/// Emitted when a partial image is available during image generation streaming.
2027#[derive(Debug, Clone, Serialize, Deserialize)]
2028#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2029pub struct ResponseImageGenCallPartialImageEvent {
2030    /// The unique identifier of the image generation item being processed.
2031    pub item_id: String,
2032    /// The index of the output item in the response's output array.
2033    pub output_index: i64,
2034    /// Base64-encoded partial image data, suitable for rendering as an image.
2035    pub partial_image_b64: String,
2036    /// 0-based index for the partial image (backend is 1-based, but this is 0-based for
2037    pub partial_image_index: i64,
2038    /// The sequence number of the image generation item being processed.
2039    pub sequence_number: i64,
2040    /// The type of the event. Always 'response.image_generation_call.partial_image'.
2041    #[serde(rename = "type")]
2042    pub type_: String,
2043}
2044
2045/// Emitted when the response is in progress.
2046#[derive(Debug, Clone, Serialize, Deserialize)]
2047#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2048pub struct ResponseInProgressEvent {
2049    /// The response that is in progress.
2050    pub response: Response,
2051    /// The sequence number of this event.
2052    pub sequence_number: i64,
2053    /// The type of the event. Always `response.in_progress`.
2054    #[serde(rename = "type")]
2055    pub type_: String,
2056}
2057
2058#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2059#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2060#[non_exhaustive]
2061pub enum ResponseIncludable {
2062    #[serde(rename = "file_search_call.results")]
2063    FileSearchCallResults,
2064    #[serde(rename = "web_search_call.results")]
2065    WebSearchCallResults,
2066    #[serde(rename = "web_search_call.action.sources")]
2067    WebSearchCallActionSources,
2068    #[serde(rename = "message.input_image.image_url")]
2069    MessageInputImageImageUrl,
2070    #[serde(rename = "computer_call_output.output.image_url")]
2071    ComputerCallOutputOutputImageUrl,
2072    #[serde(rename = "code_interpreter_call.outputs")]
2073    CodeInterpreterCallOutputs,
2074    #[serde(rename = "reasoning.encrypted_content")]
2075    ReasoningEncryptedContent,
2076    #[serde(rename = "message.output_text.logprobs")]
2077    MessageOutputTextLogprobs,
2078}
2079
2080#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2081#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2082#[non_exhaustive]
2083pub enum InputAudioFormat {
2084    #[serde(rename = "mp3")]
2085    Mp3,
2086    #[serde(rename = "wav")]
2087    Wav,
2088}
2089
2090#[derive(Debug, Clone, Serialize, Deserialize)]
2091#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2092pub struct InputAudio {
2093    /// Base64-encoded audio data.
2094    pub data: String,
2095    /// The format of the audio data. Currently supported formats are `mp3` and `wav`.
2096    pub format: InputAudioFormat,
2097}
2098
2099/// An audio input to the model.
2100#[derive(Debug, Clone, Serialize, Deserialize)]
2101#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2102pub struct ResponseInputAudio {
2103    pub input_audio: InputAudio,
2104    /// The type of the input item. Always `input_audio`.
2105    #[serde(rename = "type")]
2106    pub type_: String,
2107}
2108
2109pub type ResponseInputContent = serde_json::Value;
2110
2111/// A file input to the model.
2112#[derive(Debug, Clone, Serialize, Deserialize)]
2113#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2114pub struct ResponseInputFile {
2115    /// The type of the input item. Always `input_file`.
2116    #[serde(rename = "type")]
2117    pub type_: String,
2118    /// The content of the file to be sent to the model.
2119    #[serde(skip_serializing_if = "Option::is_none", default)]
2120    pub file_data: Option<String>,
2121    /// The ID of the file to be sent to the model.
2122    #[serde(skip_serializing_if = "Option::is_none", default)]
2123    pub file_id: Option<String>,
2124    /// The URL of the file to be sent to the model.
2125    #[serde(skip_serializing_if = "Option::is_none", default)]
2126    pub file_url: Option<String>,
2127    /// The name of the file to be sent to the model.
2128    #[serde(skip_serializing_if = "Option::is_none", default)]
2129    pub filename: Option<String>,
2130}
2131
2132/// A file input to the model.
2133#[derive(Debug, Clone, Serialize, Deserialize)]
2134#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2135pub struct ResponseInputFileContent {
2136    /// The type of the input item. Always `input_file`.
2137    #[serde(rename = "type")]
2138    pub type_: String,
2139    /// The base64-encoded data of the file to be sent to the model.
2140    #[serde(skip_serializing_if = "Option::is_none", default)]
2141    pub file_data: Option<String>,
2142    /// The ID of the file to be sent to the model.
2143    #[serde(skip_serializing_if = "Option::is_none", default)]
2144    pub file_id: Option<String>,
2145    /// The URL of the file to be sent to the model.
2146    #[serde(skip_serializing_if = "Option::is_none", default)]
2147    pub file_url: Option<String>,
2148    /// The name of the file to be sent to the model.
2149    #[serde(skip_serializing_if = "Option::is_none", default)]
2150    pub filename: Option<String>,
2151}
2152
2153#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2154#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2155#[non_exhaustive]
2156pub enum ResponseInputImageDetail {
2157    #[serde(rename = "low")]
2158    Low,
2159    #[serde(rename = "high")]
2160    High,
2161    #[serde(rename = "auto")]
2162    Auto,
2163    #[serde(rename = "original")]
2164    Original,
2165}
2166
2167/// An image input to the model.
2168#[derive(Debug, Clone, Serialize, Deserialize)]
2169#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2170pub struct ResponseInputImage {
2171    /// The detail level of the image to be sent to the model.
2172    pub detail: ResponseInputImageDetail,
2173    /// The type of the input item. Always `input_image`.
2174    #[serde(rename = "type")]
2175    pub type_: String,
2176    /// The ID of the file to be sent to the model.
2177    #[serde(skip_serializing_if = "Option::is_none", default)]
2178    pub file_id: Option<String>,
2179    /// The URL of the image to be sent to the model.
2180    #[serde(skip_serializing_if = "Option::is_none", default)]
2181    pub image_url: Option<String>,
2182}
2183
2184#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2185#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2186#[non_exhaustive]
2187pub enum ResponseInputImageContentDetail {
2188    #[serde(rename = "low")]
2189    Low,
2190    #[serde(rename = "high")]
2191    High,
2192    #[serde(rename = "auto")]
2193    Auto,
2194    #[serde(rename = "original")]
2195    Original,
2196}
2197
2198/// An image input to the model.
2199#[derive(Debug, Clone, Serialize, Deserialize)]
2200#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2201pub struct ResponseInputImageContent {
2202    /// The type of the input item. Always `input_image`.
2203    #[serde(rename = "type")]
2204    pub type_: String,
2205    /// The detail level of the image to be sent to the model.
2206    #[serde(skip_serializing_if = "Option::is_none", default)]
2207    pub detail: Option<ResponseInputImageContentDetail>,
2208    /// The ID of the file to be sent to the model.
2209    #[serde(skip_serializing_if = "Option::is_none", default)]
2210    pub file_id: Option<String>,
2211    /// The URL of the image to be sent to the model.
2212    #[serde(skip_serializing_if = "Option::is_none", default)]
2213    pub image_url: Option<String>,
2214}
2215
2216#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2217#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2218#[non_exhaustive]
2219pub enum MessageRole {
2220    #[serde(rename = "user")]
2221    User,
2222    #[serde(rename = "system")]
2223    System,
2224    #[serde(rename = "developer")]
2225    Developer,
2226}
2227
2228#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2229#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2230#[non_exhaustive]
2231pub enum MessageStatus {
2232    #[serde(rename = "in_progress")]
2233    InProgress,
2234    #[serde(rename = "completed")]
2235    Completed,
2236    #[serde(rename = "incomplete")]
2237    Incomplete,
2238}
2239
2240/// A message input to the model with a role indicating instruction following
2241#[derive(Debug, Clone, Serialize, Deserialize)]
2242#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2243pub struct Message {
2244    /// A list of one or many input items to the model, containing different content
2245    pub content: ResponseInputMessageContentList,
2246    /// The role of the message input. One of `user`, `system`, or `developer`.
2247    pub role: MessageRole,
2248    /// The status of item.
2249    #[serde(skip_serializing_if = "Option::is_none", default)]
2250    pub status: Option<MessageStatus>,
2251    /// The type of the message input. Always set to `message`.
2252    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
2253    pub type_: Option<String>,
2254}
2255
2256/// A pending safety check for the computer call.
2257#[derive(Debug, Clone, Serialize, Deserialize)]
2258#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2259pub struct ComputerCallOutputAcknowledgedSafetyCheck {
2260    /// The ID of the pending safety check.
2261    pub id: String,
2262    /// The type of the pending safety check.
2263    #[serde(skip_serializing_if = "Option::is_none", default)]
2264    pub code: Option<String>,
2265    /// Details about the pending safety check.
2266    #[serde(skip_serializing_if = "Option::is_none", default)]
2267    pub message: Option<String>,
2268}
2269
2270#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2271#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2272#[non_exhaustive]
2273pub enum ComputerCallOutputStatus {
2274    #[serde(rename = "in_progress")]
2275    InProgress,
2276    #[serde(rename = "completed")]
2277    Completed,
2278    #[serde(rename = "incomplete")]
2279    Incomplete,
2280}
2281
2282/// The output of a computer tool call.
2283#[derive(Debug, Clone, Serialize, Deserialize)]
2284#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2285pub struct ComputerCallOutput {
2286    /// The ID of the computer tool call that produced the output.
2287    pub call_id: String,
2288    /// A computer screenshot image used with the computer use tool.
2289    pub output: ResponseComputerToolCallOutputScreenshot,
2290    /// The type of the computer tool call output. Always `computer_call_output`.
2291    #[serde(rename = "type")]
2292    pub type_: String,
2293    /// The ID of the computer tool call output.
2294    #[serde(skip_serializing_if = "Option::is_none", default)]
2295    pub id: Option<String>,
2296    /// The safety checks reported by the API that have been acknowledged by the
2297    #[serde(skip_serializing_if = "Option::is_none", default)]
2298    pub acknowledged_safety_checks: Option<Vec<ComputerCallOutputAcknowledgedSafetyCheck>>,
2299    /// The status of the message input.
2300    #[serde(skip_serializing_if = "Option::is_none", default)]
2301    pub status: Option<ComputerCallOutputStatus>,
2302}
2303
2304#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2305#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2306#[non_exhaustive]
2307pub enum FunctionCallOutputStatus {
2308    #[serde(rename = "in_progress")]
2309    InProgress,
2310    #[serde(rename = "completed")]
2311    Completed,
2312    #[serde(rename = "incomplete")]
2313    Incomplete,
2314}
2315
2316#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2317#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2318#[non_exhaustive]
2319pub enum ToolSearchCallExecution {
2320    #[serde(rename = "server")]
2321    Server,
2322    #[serde(rename = "client")]
2323    Client,
2324}
2325
2326#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2327#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2328#[non_exhaustive]
2329pub enum ToolSearchCallStatus {
2330    #[serde(rename = "in_progress")]
2331    InProgress,
2332    #[serde(rename = "completed")]
2333    Completed,
2334    #[serde(rename = "incomplete")]
2335    Incomplete,
2336}
2337
2338#[derive(Debug, Clone, Serialize, Deserialize)]
2339#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2340pub struct ToolSearchCall {
2341    /// The arguments supplied to the tool search call.
2342    pub arguments: serde_json::Value,
2343    /// The item type. Always `tool_search_call`.
2344    #[serde(rename = "type")]
2345    pub type_: String,
2346    /// The unique ID of this tool search call.
2347    #[serde(skip_serializing_if = "Option::is_none", default)]
2348    pub id: Option<String>,
2349    /// The unique ID of the tool search call generated by the model.
2350    #[serde(skip_serializing_if = "Option::is_none", default)]
2351    pub call_id: Option<String>,
2352    /// Whether tool search was executed by the server or by the client.
2353    #[serde(skip_serializing_if = "Option::is_none", default)]
2354    pub execution: Option<ToolSearchCallExecution>,
2355    /// The status of the tool search call.
2356    #[serde(skip_serializing_if = "Option::is_none", default)]
2357    pub status: Option<ToolSearchCallStatus>,
2358}
2359
2360#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2361#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2362#[non_exhaustive]
2363pub enum ImageGenerationCallStatus {
2364    #[serde(rename = "in_progress")]
2365    InProgress,
2366    #[serde(rename = "completed")]
2367    Completed,
2368    #[serde(rename = "generating")]
2369    Generating,
2370    #[serde(rename = "failed")]
2371    Failed,
2372}
2373
2374/// An image generation request made by the model.
2375#[derive(Debug, Clone, Serialize, Deserialize)]
2376#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2377pub struct ImageGenerationCall {
2378    /// The unique ID of the image generation call.
2379    pub id: String,
2380    /// The generated image encoded in base64.
2381    #[serde(skip_serializing_if = "Option::is_none", default)]
2382    pub result: Option<String>,
2383    /// The status of the image generation call.
2384    pub status: ImageGenerationCallStatus,
2385    /// The type of the image generation call. Always `image_generation_call`.
2386    #[serde(rename = "type")]
2387    pub type_: String,
2388}
2389
2390/// Execute a shell command on the server.
2391#[derive(Debug, Clone, Serialize, Deserialize)]
2392#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2393pub struct LocalShellCallAction {
2394    /// The command to run.
2395    pub command: Vec<String>,
2396    /// Environment variables to set for the command.
2397    pub env: std::collections::HashMap<String, String>,
2398    /// The type of the local shell action. Always `exec`.
2399    #[serde(rename = "type")]
2400    pub type_: String,
2401    /// Optional timeout in milliseconds for the command.
2402    #[serde(skip_serializing_if = "Option::is_none", default)]
2403    pub timeout_ms: Option<i64>,
2404    /// Optional user to run the command as.
2405    #[serde(skip_serializing_if = "Option::is_none", default)]
2406    pub user: Option<String>,
2407    /// Optional working directory to run the command in.
2408    #[serde(skip_serializing_if = "Option::is_none", default)]
2409    pub working_directory: Option<String>,
2410}
2411
2412#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2413#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2414#[non_exhaustive]
2415pub enum LocalShellCallStatus {
2416    #[serde(rename = "in_progress")]
2417    InProgress,
2418    #[serde(rename = "completed")]
2419    Completed,
2420    #[serde(rename = "incomplete")]
2421    Incomplete,
2422}
2423
2424/// A tool call to run a command on the local shell.
2425#[derive(Debug, Clone, Serialize, Deserialize)]
2426#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2427pub struct LocalShellCall {
2428    /// The unique ID of the local shell call.
2429    pub id: String,
2430    /// Execute a shell command on the server.
2431    pub action: LocalShellCallAction,
2432    /// The unique ID of the local shell tool call generated by the model.
2433    pub call_id: String,
2434    /// The status of the local shell call.
2435    pub status: LocalShellCallStatus,
2436    /// The type of the local shell call. Always `local_shell_call`.
2437    #[serde(rename = "type")]
2438    pub type_: String,
2439}
2440
2441#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2442#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2443#[non_exhaustive]
2444pub enum LocalShellCallOutputStatus {
2445    #[serde(rename = "in_progress")]
2446    InProgress,
2447    #[serde(rename = "completed")]
2448    Completed,
2449    #[serde(rename = "incomplete")]
2450    Incomplete,
2451}
2452
2453/// The output of a local shell tool call.
2454#[derive(Debug, Clone, Serialize, Deserialize)]
2455#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2456pub struct LocalShellCallOutput {
2457    /// The unique ID of the local shell tool call generated by the model.
2458    pub id: String,
2459    /// A JSON string of the output of the local shell tool call.
2460    pub output: String,
2461    /// The type of the local shell tool call output. Always `local_shell_call_output`.
2462    #[serde(rename = "type")]
2463    pub type_: String,
2464    /// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
2465    #[serde(skip_serializing_if = "Option::is_none", default)]
2466    pub status: Option<LocalShellCallOutputStatus>,
2467}
2468
2469/// The shell commands and limits that describe how to run the tool call.
2470#[derive(Debug, Clone, Serialize, Deserialize)]
2471#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2472pub struct ShellCallAction {
2473    /// Ordered shell commands for the execution environment to run.
2474    pub commands: Vec<String>,
2475    /// Maximum number of UTF-8 characters to capture from combined stdout and stderr
2476    #[serde(skip_serializing_if = "Option::is_none", default)]
2477    pub max_output_length: Option<i64>,
2478    /// Maximum wall-clock time in milliseconds to allow the shell commands to run.
2479    #[serde(skip_serializing_if = "Option::is_none", default)]
2480    pub timeout_ms: Option<i64>,
2481}
2482
2483pub type ShellCallEnvironment = serde_json::Value;
2484
2485#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2486#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2487#[non_exhaustive]
2488pub enum ShellCallStatus {
2489    #[serde(rename = "in_progress")]
2490    InProgress,
2491    #[serde(rename = "completed")]
2492    Completed,
2493    #[serde(rename = "incomplete")]
2494    Incomplete,
2495}
2496
2497/// A tool representing a request to execute one or more shell commands.
2498#[derive(Debug, Clone, Serialize, Deserialize)]
2499#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2500pub struct ShellCall {
2501    /// The shell commands and limits that describe how to run the tool call.
2502    pub action: ShellCallAction,
2503    /// The unique ID of the shell tool call generated by the model.
2504    pub call_id: String,
2505    /// The type of the item. Always `shell_call`.
2506    #[serde(rename = "type")]
2507    pub type_: String,
2508    /// The unique ID of the shell tool call.
2509    #[serde(skip_serializing_if = "Option::is_none", default)]
2510    pub id: Option<String>,
2511    /// The environment to execute the shell commands in.
2512    #[serde(skip_serializing_if = "Option::is_none", default)]
2513    pub environment: Option<ShellCallEnvironment>,
2514    /// The status of the shell call.
2515    #[serde(skip_serializing_if = "Option::is_none", default)]
2516    pub status: Option<ShellCallStatus>,
2517}
2518
2519#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2520#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2521#[non_exhaustive]
2522pub enum ShellCallOutputStatus {
2523    #[serde(rename = "in_progress")]
2524    InProgress,
2525    #[serde(rename = "completed")]
2526    Completed,
2527    #[serde(rename = "incomplete")]
2528    Incomplete,
2529}
2530
2531/// The streamed output items emitted by a shell tool call.
2532#[derive(Debug, Clone, Serialize, Deserialize)]
2533#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2534pub struct ShellCallOutput {
2535    /// The unique ID of the shell tool call generated by the model.
2536    pub call_id: String,
2537    /// Captured chunks of stdout and stderr output, along with their associated
2538    pub output: Vec<ResponseFunctionShellCallOutputContent>,
2539    /// The type of the item. Always `shell_call_output`.
2540    #[serde(rename = "type")]
2541    pub type_: String,
2542    /// The unique ID of the shell tool call output.
2543    #[serde(skip_serializing_if = "Option::is_none", default)]
2544    pub id: Option<String>,
2545    /// The maximum number of UTF-8 characters captured for this shell call's combined
2546    #[serde(skip_serializing_if = "Option::is_none", default)]
2547    pub max_output_length: Option<i64>,
2548    /// The status of the shell call output.
2549    #[serde(skip_serializing_if = "Option::is_none", default)]
2550    pub status: Option<ShellCallOutputStatus>,
2551}
2552
2553/// Instruction for creating a new file via the apply_patch tool.
2554#[derive(Debug, Clone, Serialize, Deserialize)]
2555#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2556pub struct ApplyPatchCallOperationCreateFile {
2557    /// Unified diff content to apply when creating the file.
2558    pub diff: String,
2559    /// Path of the file to create relative to the workspace root.
2560    pub path: String,
2561    /// The operation type. Always `create_file`.
2562    #[serde(rename = "type")]
2563    pub type_: String,
2564}
2565
2566/// Instruction for deleting an existing file via the apply_patch tool.
2567#[derive(Debug, Clone, Serialize, Deserialize)]
2568#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2569pub struct ApplyPatchCallOperationDeleteFile {
2570    /// Path of the file to delete relative to the workspace root.
2571    pub path: String,
2572    /// The operation type. Always `delete_file`.
2573    #[serde(rename = "type")]
2574    pub type_: String,
2575}
2576
2577/// Instruction for updating an existing file via the apply_patch tool.
2578#[derive(Debug, Clone, Serialize, Deserialize)]
2579#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2580pub struct ApplyPatchCallOperationUpdateFile {
2581    /// Unified diff content to apply to the existing file.
2582    pub diff: String,
2583    /// Path of the file to update relative to the workspace root.
2584    pub path: String,
2585    /// The operation type. Always `update_file`.
2586    #[serde(rename = "type")]
2587    pub type_: String,
2588}
2589
2590pub type ApplyPatchCallOperation = serde_json::Value;
2591
2592#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2593#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2594#[non_exhaustive]
2595pub enum ApplyPatchCallStatus {
2596    #[serde(rename = "in_progress")]
2597    InProgress,
2598    #[serde(rename = "completed")]
2599    Completed,
2600}
2601
2602/// A tool call representing a request to create, delete, or update files using diff patches.
2603#[derive(Debug, Clone, Serialize, Deserialize)]
2604#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2605pub struct ApplyPatchCall {
2606    /// The unique ID of the apply patch tool call generated by the model.
2607    pub call_id: String,
2608    /// The specific create, delete, or update instruction for the apply_patch tool
2609    pub operation: ApplyPatchCallOperation,
2610    /// The status of the apply patch tool call. One of `in_progress` or `completed`.
2611    pub status: ApplyPatchCallStatus,
2612    /// The type of the item. Always `apply_patch_call`.
2613    #[serde(rename = "type")]
2614    pub type_: String,
2615    /// The unique ID of the apply patch tool call.
2616    #[serde(skip_serializing_if = "Option::is_none", default)]
2617    pub id: Option<String>,
2618}
2619
2620#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2621#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2622#[non_exhaustive]
2623pub enum ApplyPatchCallOutputStatus {
2624    #[serde(rename = "completed")]
2625    Completed,
2626    #[serde(rename = "failed")]
2627    Failed,
2628}
2629
2630/// The streamed output emitted by an apply patch tool call.
2631#[derive(Debug, Clone, Serialize, Deserialize)]
2632#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2633pub struct ApplyPatchCallOutput {
2634    /// The unique ID of the apply patch tool call generated by the model.
2635    pub call_id: String,
2636    /// The status of the apply patch tool call output. One of `completed` or `failed`.
2637    pub status: ApplyPatchCallOutputStatus,
2638    /// The type of the item. Always `apply_patch_call_output`.
2639    #[serde(rename = "type")]
2640    pub type_: String,
2641    /// The unique ID of the apply patch tool call output.
2642    #[serde(skip_serializing_if = "Option::is_none", default)]
2643    pub id: Option<String>,
2644    /// Optional human-readable log text from the apply patch tool (e.g., patch results
2645    #[serde(skip_serializing_if = "Option::is_none", default)]
2646    pub output: Option<String>,
2647}
2648
2649/// A tool available on an MCP server.
2650#[derive(Debug, Clone, Serialize, Deserialize)]
2651#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2652pub struct McpListToolsTool {
2653    /// The JSON schema describing the tool's input.
2654    pub input_schema: serde_json::Value,
2655    /// The name of the tool.
2656    pub name: String,
2657    /// Additional annotations about the tool.
2658    #[serde(skip_serializing_if = "Option::is_none", default)]
2659    pub annotations: Option<serde_json::Value>,
2660    /// The description of the tool.
2661    #[serde(skip_serializing_if = "Option::is_none", default)]
2662    pub description: Option<String>,
2663}
2664
2665/// A list of tools available on an MCP server.
2666#[derive(Debug, Clone, Serialize, Deserialize)]
2667#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2668pub struct McpListTools {
2669    /// The unique ID of the list.
2670    pub id: String,
2671    /// The label of the MCP server.
2672    pub server_label: String,
2673    /// The tools available on the server.
2674    pub tools: Vec<McpListToolsTool>,
2675    /// The type of the item. Always `mcp_list_tools`.
2676    #[serde(rename = "type")]
2677    pub type_: String,
2678    /// Error message if the server could not list tools.
2679    #[serde(skip_serializing_if = "Option::is_none", default)]
2680    pub error: Option<String>,
2681}
2682
2683/// A request for human approval of a tool invocation.
2684#[derive(Debug, Clone, Serialize, Deserialize)]
2685#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2686pub struct McpApprovalRequest {
2687    /// The unique ID of the approval request.
2688    pub id: String,
2689    /// A JSON string of arguments for the tool.
2690    pub arguments: String,
2691    /// The name of the tool to run.
2692    pub name: String,
2693    /// The label of the MCP server making the request.
2694    pub server_label: String,
2695    /// The type of the item. Always `mcp_approval_request`.
2696    #[serde(rename = "type")]
2697    pub type_: String,
2698}
2699
2700/// A response to an MCP approval request.
2701#[derive(Debug, Clone, Serialize, Deserialize)]
2702#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2703pub struct McpApprovalResponse {
2704    /// The ID of the approval request being answered.
2705    pub approval_request_id: String,
2706    /// Whether the request was approved.
2707    pub approve: bool,
2708    /// The type of the item. Always `mcp_approval_response`.
2709    #[serde(rename = "type")]
2710    pub type_: String,
2711    /// The unique ID of the approval response
2712    #[serde(skip_serializing_if = "Option::is_none", default)]
2713    pub id: Option<String>,
2714    /// Optional reason for the decision.
2715    #[serde(skip_serializing_if = "Option::is_none", default)]
2716    pub reason: Option<String>,
2717}
2718
2719#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2720#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2721#[non_exhaustive]
2722pub enum McpCallStatus {
2723    #[serde(rename = "in_progress")]
2724    InProgress,
2725    #[serde(rename = "completed")]
2726    Completed,
2727    #[serde(rename = "incomplete")]
2728    Incomplete,
2729    #[serde(rename = "calling")]
2730    Calling,
2731    #[serde(rename = "failed")]
2732    Failed,
2733}
2734
2735/// An invocation of a tool on an MCP server.
2736#[derive(Debug, Clone, Serialize, Deserialize)]
2737#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2738pub struct McpCall {
2739    /// The unique ID of the tool call.
2740    pub id: String,
2741    /// A JSON string of the arguments passed to the tool.
2742    pub arguments: String,
2743    /// The name of the tool that was run.
2744    pub name: String,
2745    /// The label of the MCP server running the tool.
2746    pub server_label: String,
2747    /// The type of the item. Always `mcp_call`.
2748    #[serde(rename = "type")]
2749    pub type_: String,
2750    /// Unique identifier for the MCP tool call approval request. Include this value in
2751    #[serde(skip_serializing_if = "Option::is_none", default)]
2752    pub approval_request_id: Option<String>,
2753    /// The error from the tool call, if any.
2754    #[serde(skip_serializing_if = "Option::is_none", default)]
2755    pub error: Option<String>,
2756    /// The output from the tool call.
2757    #[serde(skip_serializing_if = "Option::is_none", default)]
2758    pub output: Option<String>,
2759    /// The status of the tool call.
2760    #[serde(skip_serializing_if = "Option::is_none", default)]
2761    pub status: Option<McpCallStatus>,
2762}
2763
2764/// An internal identifier for an item to reference.
2765#[derive(Debug, Clone, Serialize, Deserialize)]
2766#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2767pub struct ItemReference {
2768    /// The ID of the item to reference.
2769    pub id: String,
2770    /// The type of item to reference. Always `item_reference`.
2771    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
2772    pub type_: Option<String>,
2773}
2774
2775pub type ResponseInputMessageContentList = Vec<ResponseInputContent>;
2776
2777#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2778#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2779#[non_exhaustive]
2780pub enum ResponseInputMessageItemRole {
2781    #[serde(rename = "user")]
2782    User,
2783    #[serde(rename = "system")]
2784    System,
2785    #[serde(rename = "developer")]
2786    Developer,
2787}
2788
2789#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2790#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2791#[non_exhaustive]
2792pub enum ResponseInputMessageItemStatus {
2793    #[serde(rename = "in_progress")]
2794    InProgress,
2795    #[serde(rename = "completed")]
2796    Completed,
2797    #[serde(rename = "incomplete")]
2798    Incomplete,
2799}
2800
2801#[derive(Debug, Clone, Serialize, Deserialize)]
2802#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2803pub struct ResponseInputMessageItem {
2804    /// The unique ID of the message input.
2805    pub id: String,
2806    /// A list of one or many input items to the model, containing different content
2807    pub content: ResponseInputMessageContentList,
2808    /// The role of the message input. One of `user`, `system`, or `developer`.
2809    pub role: ResponseInputMessageItemRole,
2810    /// The status of item.
2811    #[serde(skip_serializing_if = "Option::is_none", default)]
2812    pub status: Option<ResponseInputMessageItemStatus>,
2813    /// The type of the message input. Always set to `message`.
2814    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
2815    pub type_: Option<String>,
2816}
2817
2818/// A text input to the model.
2819#[derive(Debug, Clone, Serialize, Deserialize)]
2820#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2821pub struct ResponseInputText {
2822    /// The text input to the model.
2823    pub text: String,
2824    /// The type of the input item. Always `input_text`.
2825    #[serde(rename = "type")]
2826    pub type_: String,
2827}
2828
2829/// A text input to the model.
2830#[derive(Debug, Clone, Serialize, Deserialize)]
2831#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2832pub struct ResponseInputTextContent {
2833    /// The text input to the model.
2834    pub text: String,
2835    /// The type of the input item. Always `input_text`.
2836    #[serde(rename = "type")]
2837    pub type_: String,
2838}
2839
2840pub type ResponseItem = serde_json::Value;
2841
2842/// A list of Response items.
2843#[derive(Debug, Clone, Serialize, Deserialize)]
2844#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2845pub struct ResponseItemList {
2846    /// A list of items used to generate this response.
2847    pub data: Vec<ResponseItem>,
2848    /// The ID of the first item in the list.
2849    pub first_id: String,
2850    /// Whether there are more items available.
2851    pub has_more: bool,
2852    /// The ID of the last item in the list.
2853    pub last_id: String,
2854    /// The type of object returned, must be `list`.
2855    pub object: String,
2856}
2857
2858/// Represents the use of a local environment to perform shell actions.
2859#[derive(Debug, Clone, Serialize, Deserialize)]
2860#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2861pub struct ResponseLocalEnvironment {
2862    /// The environment type. Always `local`.
2863    #[serde(rename = "type")]
2864    pub type_: String,
2865}
2866
2867/// Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
2868#[derive(Debug, Clone, Serialize, Deserialize)]
2869#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2870pub struct ResponseMcpCallArgumentsDeltaEvent {
2871    /// A JSON string containing the partial update to the arguments for the MCP tool
2872    pub delta: String,
2873    /// The unique identifier of the MCP tool call item being processed.
2874    pub item_id: String,
2875    /// The index of the output item in the response's output array.
2876    pub output_index: i64,
2877    /// The sequence number of this event.
2878    pub sequence_number: i64,
2879    /// The type of the event. Always 'response.mcp_call_arguments.delta'.
2880    #[serde(rename = "type")]
2881    pub type_: String,
2882}
2883
2884/// Emitted when the arguments for an MCP tool call are finalized.
2885#[derive(Debug, Clone, Serialize, Deserialize)]
2886#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2887pub struct ResponseMcpCallArgumentsDoneEvent {
2888    /// A JSON string containing the finalized arguments for the MCP tool call.
2889    pub arguments: String,
2890    /// The unique identifier of the MCP tool call item being processed.
2891    pub item_id: String,
2892    /// The index of the output item in the response's output array.
2893    pub output_index: i64,
2894    /// The sequence number of this event.
2895    pub sequence_number: i64,
2896    /// The type of the event. Always 'response.mcp_call_arguments.done'.
2897    #[serde(rename = "type")]
2898    pub type_: String,
2899}
2900
2901/// Emitted when an MCP  tool call has completed successfully.
2902#[derive(Debug, Clone, Serialize, Deserialize)]
2903#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2904pub struct ResponseMcpCallCompletedEvent {
2905    /// The ID of the MCP tool call item that completed.
2906    pub item_id: String,
2907    /// The index of the output item that completed.
2908    pub output_index: i64,
2909    /// The sequence number of this event.
2910    pub sequence_number: i64,
2911    /// The type of the event. Always 'response.mcp_call.completed'.
2912    #[serde(rename = "type")]
2913    pub type_: String,
2914}
2915
2916/// Emitted when an MCP  tool call has failed.
2917#[derive(Debug, Clone, Serialize, Deserialize)]
2918#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2919pub struct ResponseMcpCallFailedEvent {
2920    /// The ID of the MCP tool call item that failed.
2921    pub item_id: String,
2922    /// The index of the output item that failed.
2923    pub output_index: i64,
2924    /// The sequence number of this event.
2925    pub sequence_number: i64,
2926    /// The type of the event. Always 'response.mcp_call.failed'.
2927    #[serde(rename = "type")]
2928    pub type_: String,
2929}
2930
2931/// Emitted when an MCP  tool call is in progress.
2932#[derive(Debug, Clone, Serialize, Deserialize)]
2933#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2934pub struct ResponseMcpCallInProgressEvent {
2935    /// The unique identifier of the MCP tool call item being processed.
2936    pub item_id: String,
2937    /// The index of the output item in the response's output array.
2938    pub output_index: i64,
2939    /// The sequence number of this event.
2940    pub sequence_number: i64,
2941    /// The type of the event. Always 'response.mcp_call.in_progress'.
2942    #[serde(rename = "type")]
2943    pub type_: String,
2944}
2945
2946/// Emitted when the list of available MCP tools has been successfully retrieved.
2947#[derive(Debug, Clone, Serialize, Deserialize)]
2948#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2949pub struct ResponseMcpListToolsCompletedEvent {
2950    /// The ID of the MCP tool call item that produced this output.
2951    pub item_id: String,
2952    /// The index of the output item that was processed.
2953    pub output_index: i64,
2954    /// The sequence number of this event.
2955    pub sequence_number: i64,
2956    /// The type of the event. Always 'response.mcp_list_tools.completed'.
2957    #[serde(rename = "type")]
2958    pub type_: String,
2959}
2960
2961/// Emitted when the attempt to list available MCP tools has failed.
2962#[derive(Debug, Clone, Serialize, Deserialize)]
2963#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2964pub struct ResponseMcpListToolsFailedEvent {
2965    /// The ID of the MCP tool call item that failed.
2966    pub item_id: String,
2967    /// The index of the output item that failed.
2968    pub output_index: i64,
2969    /// The sequence number of this event.
2970    pub sequence_number: i64,
2971    /// The type of the event. Always 'response.mcp_list_tools.failed'.
2972    #[serde(rename = "type")]
2973    pub type_: String,
2974}
2975
2976/// Emitted when the system is in the process of retrieving the list of available MCP tools.
2977#[derive(Debug, Clone, Serialize, Deserialize)]
2978#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2979pub struct ResponseMcpListToolsInProgressEvent {
2980    /// The ID of the MCP tool call item that is being processed.
2981    pub item_id: String,
2982    /// The index of the output item that is being processed.
2983    pub output_index: i64,
2984    /// The sequence number of this event.
2985    pub sequence_number: i64,
2986    /// The type of the event. Always 'response.mcp_list_tools.in_progress'.
2987    #[serde(rename = "type")]
2988    pub type_: String,
2989}
2990
2991/// Emitted when an output item is marked done.
2992#[derive(Debug, Clone, Serialize, Deserialize)]
2993#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
2994pub struct ResponseOutputItemDoneEvent {
2995    /// The output item that was marked done.
2996    pub item: ResponseOutputItem,
2997    /// The index of the output item that was marked done.
2998    pub output_index: i64,
2999    /// The sequence number of this event.
3000    pub sequence_number: i64,
3001    /// The type of the event. Always `response.output_item.done`.
3002    #[serde(rename = "type")]
3003    pub type_: String,
3004}
3005
3006pub type Content = serde_json::Value;
3007
3008#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3009#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3010#[non_exhaustive]
3011pub enum ResponseOutputMessageStatus {
3012    #[serde(rename = "in_progress")]
3013    InProgress,
3014    #[serde(rename = "completed")]
3015    Completed,
3016    #[serde(rename = "incomplete")]
3017    Incomplete,
3018}
3019
3020#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3021#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3022#[non_exhaustive]
3023pub enum ResponseOutputMessagePhase {
3024    #[serde(rename = "commentary")]
3025    Commentary,
3026    #[serde(rename = "final_answer")]
3027    FinalAnswer,
3028}
3029
3030/// An output message from the model.
3031#[derive(Debug, Clone, Serialize, Deserialize)]
3032#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3033pub struct ResponseOutputMessage {
3034    /// The unique ID of the output message.
3035    pub id: String,
3036    /// The content of the output message.
3037    pub content: Vec<ReasoningItemContent>,
3038    /// The role of the output message. Always `assistant`.
3039    pub role: String,
3040    /// The status of the message input.
3041    pub status: ResponseOutputMessageStatus,
3042    /// The type of the output message. Always `message`.
3043    #[serde(rename = "type")]
3044    pub type_: String,
3045    /// Labels an `assistant` message as intermediate commentary (`commentary`) or the
3046    #[serde(skip_serializing_if = "Option::is_none", default)]
3047    pub phase: Option<ResponseOutputMessagePhase>,
3048}
3049
3050/// A refusal from the model.
3051#[derive(Debug, Clone, Serialize, Deserialize)]
3052#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3053pub struct ResponseOutputRefusal {
3054    /// The refusal explanation from the model.
3055    pub refusal: String,
3056    /// The type of the refusal. Always `refusal`.
3057    #[serde(rename = "type")]
3058    pub type_: String,
3059}
3060
3061/// A citation to a file.
3062#[derive(Debug, Clone, Serialize, Deserialize)]
3063#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3064pub struct AnnotationFileCitation {
3065    /// The ID of the file.
3066    pub file_id: String,
3067    /// The filename of the file cited.
3068    pub filename: String,
3069    /// The index of the file in the list of files.
3070    pub index: i64,
3071    /// The type of the file citation. Always `file_citation`.
3072    #[serde(rename = "type")]
3073    pub type_: String,
3074}
3075
3076/// A citation for a web resource used to generate a model response.
3077#[derive(Debug, Clone, Serialize, Deserialize)]
3078#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3079pub struct AnnotationURLCitation {
3080    /// The index of the last character of the URL citation in the message.
3081    pub end_index: i64,
3082    /// The index of the first character of the URL citation in the message.
3083    pub start_index: i64,
3084    /// The title of the web resource.
3085    pub title: String,
3086    /// The type of the URL citation. Always `url_citation`.
3087    #[serde(rename = "type")]
3088    pub type_: String,
3089    /// The URL of the web resource.
3090    pub url: String,
3091}
3092
3093/// A citation for a container file used to generate a model response.
3094#[derive(Debug, Clone, Serialize, Deserialize)]
3095#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3096pub struct AnnotationContainerFileCitation {
3097    /// The ID of the container file.
3098    pub container_id: String,
3099    /// The index of the last character of the container file citation in the message.
3100    pub end_index: i64,
3101    /// The ID of the file.
3102    pub file_id: String,
3103    /// The filename of the container file cited.
3104    pub filename: String,
3105    /// The index of the first character of the container file citation in the message.
3106    pub start_index: i64,
3107    /// The type of the container file citation. Always `container_file_citation`.
3108    #[serde(rename = "type")]
3109    pub type_: String,
3110}
3111
3112/// A path to a file.
3113#[derive(Debug, Clone, Serialize, Deserialize)]
3114#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3115pub struct AnnotationFilePath {
3116    /// The ID of the file.
3117    pub file_id: String,
3118    /// The index of the file in the list of files.
3119    pub index: i64,
3120    /// The type of the file path. Always `file_path`.
3121    #[serde(rename = "type")]
3122    pub type_: String,
3123}
3124
3125pub type Annotation = serde_json::Value;
3126
3127/// The top log probability of a token.
3128#[derive(Debug, Clone, Serialize, Deserialize)]
3129#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3130pub struct LogprobTopLogprob {
3131    pub token: String,
3132    pub bytes: Vec<i64>,
3133    pub logprob: f64,
3134}
3135
3136/// The log probability of a token.
3137#[derive(Debug, Clone, Serialize, Deserialize)]
3138#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3139pub struct Logprob {
3140    pub token: String,
3141    pub bytes: Vec<i64>,
3142    pub logprob: f64,
3143    pub top_logprobs: Vec<LogprobTopLogprob>,
3144}
3145
3146/// A text output from the model.
3147#[derive(Debug, Clone, Serialize, Deserialize)]
3148#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3149pub struct ResponseOutputText {
3150    /// The annotations of the text output.
3151    pub annotations: Vec<Annotation>,
3152    /// The text output from the model.
3153    pub text: String,
3154    /// The type of the output text. Always `output_text`.
3155    #[serde(rename = "type")]
3156    pub type_: String,
3157    #[serde(skip_serializing_if = "Option::is_none", default)]
3158    pub logprobs: Option<Vec<Logprob>>,
3159}
3160
3161/// Emitted when an annotation is added to output text content.
3162#[derive(Debug, Clone, Serialize, Deserialize)]
3163#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3164pub struct ResponseOutputTextAnnotationAddedEvent {
3165    /// The annotation object being added. (See annotation schema for details.)
3166    pub annotation: serde_json::Value,
3167    /// The index of the annotation within the content part.
3168    pub annotation_index: i64,
3169    /// The index of the content part within the output item.
3170    pub content_index: i64,
3171    /// The unique identifier of the item to which the annotation is being added.
3172    pub item_id: String,
3173    /// The index of the output item in the response's output array.
3174    pub output_index: i64,
3175    /// The sequence number of this event.
3176    pub sequence_number: i64,
3177    /// The type of the event. Always 'response.output_text.annotation.added'.
3178    #[serde(rename = "type")]
3179    pub type_: String,
3180}
3181
3182pub type Variables = serde_json::Value;
3183
3184/// Reference to a prompt template and its variables.
3185#[derive(Debug, Clone, Serialize, Deserialize)]
3186#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3187pub struct ResponsePrompt {
3188    /// The unique identifier of the prompt template to use.
3189    pub id: String,
3190    /// Optional map of values to substitute in for variables in your prompt.
3191    #[serde(skip_serializing_if = "Option::is_none", default)]
3192    pub variables: Option<std::collections::HashMap<String, Variables>>,
3193    /// Optional version of the prompt template.
3194    #[serde(skip_serializing_if = "Option::is_none", default)]
3195    pub version: Option<String>,
3196}
3197
3198/// Emitted when a response is queued and waiting to be processed.
3199#[derive(Debug, Clone, Serialize, Deserialize)]
3200#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3201pub struct ResponseQueuedEvent {
3202    /// The full response object that is queued.
3203    pub response: Response,
3204    /// The sequence number for this event.
3205    pub sequence_number: i64,
3206    /// The type of the event. Always 'response.queued'.
3207    #[serde(rename = "type")]
3208    pub type_: String,
3209}
3210
3211/// A summary text from the model.
3212#[derive(Debug, Clone, Serialize, Deserialize)]
3213#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3214pub struct ReasoningItemSummary {
3215    /// A summary of the reasoning output from the model so far.
3216    pub text: String,
3217    /// The type of the object. Always `summary_text`.
3218    #[serde(rename = "type")]
3219    pub type_: String,
3220}
3221
3222/// Reasoning text from the model.
3223#[derive(Debug, Clone, Serialize, Deserialize)]
3224#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3225pub struct ReasoningItemContent {
3226    /// The reasoning text from the model.
3227    pub text: String,
3228    /// The type of the reasoning text. Always `reasoning_text`.
3229    #[serde(rename = "type")]
3230    pub type_: String,
3231}
3232
3233#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3234#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3235#[non_exhaustive]
3236pub enum ResponseReasoningItemStatus {
3237    #[serde(rename = "in_progress")]
3238    InProgress,
3239    #[serde(rename = "completed")]
3240    Completed,
3241    #[serde(rename = "incomplete")]
3242    Incomplete,
3243}
3244
3245/// A description of the chain of thought used by a reasoning model while generating
3246#[derive(Debug, Clone, Serialize, Deserialize)]
3247#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3248pub struct ResponseReasoningItem {
3249    /// The unique identifier of the reasoning content.
3250    pub id: String,
3251    /// Reasoning summary content.
3252    pub summary: Vec<ReasoningItemSummary>,
3253    /// The type of the object. Always `reasoning`.
3254    #[serde(rename = "type")]
3255    pub type_: String,
3256    /// Reasoning text content.
3257    #[serde(skip_serializing_if = "Option::is_none", default)]
3258    pub content: Option<Vec<ReasoningItemContent>>,
3259    /// The encrypted content of the reasoning item - populated when a response is
3260    #[serde(skip_serializing_if = "Option::is_none", default)]
3261    pub encrypted_content: Option<String>,
3262    /// The status of the item.
3263    #[serde(skip_serializing_if = "Option::is_none", default)]
3264    pub status: Option<ResponseReasoningItemStatus>,
3265}
3266
3267/// The summary part that was added.
3268#[derive(Debug, Clone, Serialize, Deserialize)]
3269#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3270pub struct ReasoningSummaryPart {
3271    /// The text of the summary part.
3272    pub text: String,
3273    /// The type of the summary part. Always `summary_text`.
3274    #[serde(rename = "type")]
3275    pub type_: String,
3276}
3277
3278/// Emitted when a new reasoning summary part is added.
3279#[derive(Debug, Clone, Serialize, Deserialize)]
3280#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3281pub struct ResponseReasoningSummaryPartAddedEvent {
3282    /// The ID of the item this summary part is associated with.
3283    pub item_id: String,
3284    /// The index of the output item this summary part is associated with.
3285    pub output_index: i64,
3286    /// The summary part that was added.
3287    pub part: ReasoningSummaryPart,
3288    /// The sequence number of this event.
3289    pub sequence_number: i64,
3290    /// The index of the summary part within the reasoning summary.
3291    pub summary_index: i64,
3292    /// The type of the event. Always `response.reasoning_summary_part.added`.
3293    #[serde(rename = "type")]
3294    pub type_: String,
3295}
3296
3297/// Emitted when a reasoning summary part is completed.
3298#[derive(Debug, Clone, Serialize, Deserialize)]
3299#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3300pub struct ResponseReasoningSummaryPartDoneEvent {
3301    /// The ID of the item this summary part is associated with.
3302    pub item_id: String,
3303    /// The index of the output item this summary part is associated with.
3304    pub output_index: i64,
3305    /// The completed summary part.
3306    pub part: ReasoningSummaryPart,
3307    /// The sequence number of this event.
3308    pub sequence_number: i64,
3309    /// The index of the summary part within the reasoning summary.
3310    pub summary_index: i64,
3311    /// The type of the event. Always `response.reasoning_summary_part.done`.
3312    #[serde(rename = "type")]
3313    pub type_: String,
3314}
3315
3316/// Emitted when a reasoning summary text is completed.
3317#[derive(Debug, Clone, Serialize, Deserialize)]
3318#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3319pub struct ResponseReasoningSummaryTextDoneEvent {
3320    /// The ID of the item this summary text is associated with.
3321    pub item_id: String,
3322    /// The index of the output item this summary text is associated with.
3323    pub output_index: i64,
3324    /// The sequence number of this event.
3325    pub sequence_number: i64,
3326    /// The index of the summary part within the reasoning summary.
3327    pub summary_index: i64,
3328    /// The full text of the completed reasoning summary.
3329    pub text: String,
3330    /// The type of the event. Always `response.reasoning_summary_text.done`.
3331    #[serde(rename = "type")]
3332    pub type_: String,
3333}
3334
3335/// Emitted when a reasoning text is completed.
3336#[derive(Debug, Clone, Serialize, Deserialize)]
3337#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3338pub struct ResponseReasoningTextDoneEvent {
3339    /// The index of the reasoning content part.
3340    pub content_index: i64,
3341    /// The ID of the item this reasoning text is associated with.
3342    pub item_id: String,
3343    /// The index of the output item this reasoning text is associated with.
3344    pub output_index: i64,
3345    /// The sequence number of this event.
3346    pub sequence_number: i64,
3347    /// The full text of the completed reasoning content.
3348    pub text: String,
3349    /// The type of the event. Always `response.reasoning_text.done`.
3350    #[serde(rename = "type")]
3351    pub type_: String,
3352}
3353
3354/// Emitted when there is a partial refusal text.
3355#[derive(Debug, Clone, Serialize, Deserialize)]
3356#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3357pub struct ResponseRefusalDeltaEvent {
3358    /// The index of the content part that the refusal text is added to.
3359    pub content_index: i64,
3360    /// The refusal text that is added.
3361    pub delta: String,
3362    /// The ID of the output item that the refusal text is added to.
3363    pub item_id: String,
3364    /// The index of the output item that the refusal text is added to.
3365    pub output_index: i64,
3366    /// The sequence number of this event.
3367    pub sequence_number: i64,
3368    /// The type of the event. Always `response.refusal.delta`.
3369    #[serde(rename = "type")]
3370    pub type_: String,
3371}
3372
3373/// Emitted when refusal text is finalized.
3374#[derive(Debug, Clone, Serialize, Deserialize)]
3375#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3376pub struct ResponseRefusalDoneEvent {
3377    /// The index of the content part that the refusal text is finalized.
3378    pub content_index: i64,
3379    /// The ID of the output item that the refusal text is finalized.
3380    pub item_id: String,
3381    /// The index of the output item that the refusal text is finalized.
3382    pub output_index: i64,
3383    /// The refusal text that is finalized.
3384    pub refusal: String,
3385    /// The sequence number of this event.
3386    pub sequence_number: i64,
3387    /// The type of the event. Always `response.refusal.done`.
3388    #[serde(rename = "type")]
3389    pub type_: String,
3390}
3391
3392#[derive(Debug, Clone, Serialize, Deserialize)]
3393#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3394pub struct ResponseRetrieveParamsBase {
3395    /// Additional fields to include in the response.
3396    #[serde(skip_serializing_if = "Option::is_none", default)]
3397    pub include: Option<Vec<ResponseIncludable>>,
3398    /// When true, stream obfuscation will be enabled.
3399    #[serde(skip_serializing_if = "Option::is_none", default)]
3400    pub include_obfuscation: Option<bool>,
3401    /// The sequence number of the event after which to start streaming.
3402    #[serde(skip_serializing_if = "Option::is_none", default)]
3403    pub starting_after: Option<i64>,
3404}
3405
3406pub type ResponseRetrieveParams = serde_json::Value;
3407
3408#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3409#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3410#[non_exhaustive]
3411pub enum ResponseStatus {
3412    #[serde(rename = "completed")]
3413    Completed,
3414    #[serde(rename = "failed")]
3415    Failed,
3416    #[serde(rename = "in_progress")]
3417    InProgress,
3418    #[serde(rename = "cancelled")]
3419    Cancelled,
3420    #[serde(rename = "queued")]
3421    Queued,
3422    #[serde(rename = "incomplete")]
3423    Incomplete,
3424}
3425
3426#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3427#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3428#[non_exhaustive]
3429pub enum ResponseTextConfigVerbosity {
3430    #[serde(rename = "low")]
3431    Low,
3432    #[serde(rename = "medium")]
3433    Medium,
3434    #[serde(rename = "high")]
3435    High,
3436}
3437
3438/// Emitted when text content is finalized.
3439#[derive(Debug, Clone, Serialize, Deserialize)]
3440#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3441pub struct ResponseTextDoneEvent {
3442    /// The index of the content part that the text content is finalized.
3443    pub content_index: i64,
3444    /// The ID of the output item that the text content is finalized.
3445    pub item_id: String,
3446    /// The log probabilities of the tokens in the delta.
3447    pub logprobs: Vec<Logprob>,
3448    /// The index of the output item that the text content is finalized.
3449    pub output_index: i64,
3450    /// The sequence number for this event.
3451    pub sequence_number: i64,
3452    /// The text content that is finalized.
3453    pub text: String,
3454    /// The type of the event. Always `response.output_text.done`.
3455    #[serde(rename = "type")]
3456    pub type_: String,
3457}
3458
3459#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3460#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3461#[non_exhaustive]
3462pub enum ResponseToolSearchCallExecution {
3463    #[serde(rename = "server")]
3464    Server,
3465    #[serde(rename = "client")]
3466    Client,
3467}
3468
3469#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3470#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3471#[non_exhaustive]
3472pub enum ResponseToolSearchCallStatus {
3473    #[serde(rename = "in_progress")]
3474    InProgress,
3475    #[serde(rename = "completed")]
3476    Completed,
3477    #[serde(rename = "incomplete")]
3478    Incomplete,
3479}
3480
3481#[derive(Debug, Clone, Serialize, Deserialize)]
3482#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3483pub struct ResponseToolSearchCall {
3484    /// The unique ID of the tool search call item.
3485    pub id: String,
3486    /// Arguments used for the tool search call.
3487    pub arguments: serde_json::Value,
3488    /// The unique ID of the tool search call generated by the model.
3489    #[serde(skip_serializing_if = "Option::is_none", default)]
3490    pub call_id: Option<String>,
3491    /// Whether tool search was executed by the server or by the client.
3492    pub execution: ResponseToolSearchCallExecution,
3493    /// The status of the tool search call item that was recorded.
3494    pub status: ResponseToolSearchCallStatus,
3495    /// The type of the item. Always `tool_search_call`.
3496    #[serde(rename = "type")]
3497    pub type_: String,
3498    /// The identifier of the actor that created the item.
3499    #[serde(skip_serializing_if = "Option::is_none", default)]
3500    pub created_by: Option<String>,
3501}
3502
3503#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3504#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3505#[non_exhaustive]
3506pub enum ResponseToolSearchOutputItemExecution {
3507    #[serde(rename = "server")]
3508    Server,
3509    #[serde(rename = "client")]
3510    Client,
3511}
3512
3513#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3514#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3515#[non_exhaustive]
3516pub enum ResponseToolSearchOutputItemStatus {
3517    #[serde(rename = "in_progress")]
3518    InProgress,
3519    #[serde(rename = "completed")]
3520    Completed,
3521    #[serde(rename = "incomplete")]
3522    Incomplete,
3523}
3524
3525#[derive(Debug, Clone, Serialize, Deserialize)]
3526#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3527pub struct ResponseToolSearchOutputItem {
3528    /// The unique ID of the tool search output item.
3529    pub id: String,
3530    /// The unique ID of the tool search call generated by the model.
3531    #[serde(skip_serializing_if = "Option::is_none", default)]
3532    pub call_id: Option<String>,
3533    /// Whether tool search was executed by the server or by the client.
3534    pub execution: ResponseToolSearchOutputItemExecution,
3535    /// The status of the tool search output item that was recorded.
3536    pub status: ResponseToolSearchOutputItemStatus,
3537    /// The loaded tool definitions returned by tool search.
3538    pub tools: Vec<Tool>,
3539    /// The type of the item. Always `tool_search_output`.
3540    #[serde(rename = "type")]
3541    pub type_: String,
3542    /// The identifier of the actor that created the item.
3543    #[serde(skip_serializing_if = "Option::is_none", default)]
3544    pub created_by: Option<String>,
3545}
3546
3547/// Emitted when a web search call is completed.
3548#[derive(Debug, Clone, Serialize, Deserialize)]
3549#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3550pub struct ResponseWebSearchCallCompletedEvent {
3551    /// Unique ID for the output item associated with the web search call.
3552    pub item_id: String,
3553    /// The index of the output item that the web search call is associated with.
3554    pub output_index: i64,
3555    /// The sequence number of the web search call being processed.
3556    pub sequence_number: i64,
3557    /// The type of the event. Always `response.web_search_call.completed`.
3558    #[serde(rename = "type")]
3559    pub type_: String,
3560}
3561
3562/// Emitted when a web search call is initiated.
3563#[derive(Debug, Clone, Serialize, Deserialize)]
3564#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3565pub struct ResponseWebSearchCallInProgressEvent {
3566    /// Unique ID for the output item associated with the web search call.
3567    pub item_id: String,
3568    /// The index of the output item that the web search call is associated with.
3569    pub output_index: i64,
3570    /// The sequence number of the web search call being processed.
3571    pub sequence_number: i64,
3572    /// The type of the event. Always `response.web_search_call.in_progress`.
3573    #[serde(rename = "type")]
3574    pub type_: String,
3575}
3576
3577/// Emitted when a web search call is executing.
3578#[derive(Debug, Clone, Serialize, Deserialize)]
3579#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3580pub struct ResponseWebSearchCallSearchingEvent {
3581    /// Unique ID for the output item associated with the web search call.
3582    pub item_id: String,
3583    /// The index of the output item that the web search call is associated with.
3584    pub output_index: i64,
3585    /// The sequence number of the web search call being processed.
3586    pub sequence_number: i64,
3587    /// The type of the event. Always `response.web_search_call.searching`.
3588    #[serde(rename = "type")]
3589    pub type_: String,
3590}
3591
3592#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3593#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3594#[non_exhaustive]
3595pub enum ResponsesClientEventPromptCacheRetention {
3596    #[serde(rename = "in-memory")]
3597    InMemory,
3598    #[serde(rename = "24h")]
3599    V24h,
3600}
3601
3602#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3603#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3604#[non_exhaustive]
3605pub enum ResponsesClientEventServiceTier {
3606    #[serde(rename = "auto")]
3607    Auto,
3608    #[serde(rename = "default")]
3609    Default,
3610    #[serde(rename = "flex")]
3611    Flex,
3612    #[serde(rename = "scale")]
3613    Scale,
3614    #[serde(rename = "priority")]
3615    Priority,
3616}
3617
3618#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3619#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3620#[non_exhaustive]
3621pub enum ResponsesClientEventTruncation {
3622    #[serde(rename = "auto")]
3623    Auto,
3624    #[serde(rename = "disabled")]
3625    Disabled,
3626}
3627
3628#[derive(Debug, Clone, Serialize, Deserialize)]
3629#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3630pub struct ResponsesClientEvent {
3631    /// The type of the client event. Always `response.create`.
3632    #[serde(rename = "type")]
3633    pub type_: String,
3634    /// Whether to run the model response in the background.
3635    #[serde(skip_serializing_if = "Option::is_none", default)]
3636    pub background: Option<bool>,
3637    /// Context management configuration for this request.
3638    #[serde(skip_serializing_if = "Option::is_none", default)]
3639    pub context_management: Option<Vec<ContextManagement>>,
3640    /// The conversation that this response belongs to.
3641    #[serde(skip_serializing_if = "Option::is_none", default)]
3642    pub conversation: Option<Conversation>,
3643    /// Specify additional output data to include in the model response.
3644    #[serde(skip_serializing_if = "Option::is_none", default)]
3645    pub include: Option<Vec<ResponseIncludable>>,
3646    /// Text, image, or file inputs to the model, used to generate a response.
3647    #[serde(skip_serializing_if = "Option::is_none", default)]
3648    pub input: Option<String>,
3649    /// A system (or developer) message inserted into the model's context.
3650    #[serde(skip_serializing_if = "Option::is_none", default)]
3651    pub instructions: Option<String>,
3652    /// An upper bound for the number of tokens that can be generated for a response,
3653    #[serde(skip_serializing_if = "Option::is_none", default)]
3654    pub max_output_tokens: Option<i64>,
3655    /// The maximum number of total calls to built-in tools that can be processed in a
3656    #[serde(skip_serializing_if = "Option::is_none", default)]
3657    pub max_tool_calls: Option<i64>,
3658    /// Set of 16 key-value pairs that can be attached to an object.
3659    #[serde(skip_serializing_if = "Option::is_none", default)]
3660    pub metadata: Option<serde_json::Value>,
3661    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
3662    #[serde(skip_serializing_if = "Option::is_none", default)]
3663    pub model: Option<serde_json::Value>,
3664    /// Whether to allow the model to run tool calls in parallel.
3665    #[serde(skip_serializing_if = "Option::is_none", default)]
3666    pub parallel_tool_calls: Option<bool>,
3667    /// The unique ID of the previous response to the model.
3668    #[serde(skip_serializing_if = "Option::is_none", default)]
3669    pub previous_response_id: Option<String>,
3670    /// Reference to a prompt template and its variables.
3671    #[serde(skip_serializing_if = "Option::is_none", default)]
3672    pub prompt: Option<ResponsePrompt>,
3673    /// Used by OpenAI to cache responses for similar requests to optimize your cache
3674    #[serde(skip_serializing_if = "Option::is_none", default)]
3675    pub prompt_cache_key: Option<String>,
3676    /// The retention policy for the prompt cache.
3677    #[serde(skip_serializing_if = "Option::is_none", default)]
3678    pub prompt_cache_retention: Option<ResponsesClientEventPromptCacheRetention>,
3679    /// **gpt-5 and o-series models only**
3680    #[serde(skip_serializing_if = "Option::is_none", default)]
3681    pub reasoning: Option<serde_json::Value>,
3682    /// A stable identifier used to help detect users of your application that may be
3683    #[serde(skip_serializing_if = "Option::is_none", default)]
3684    pub safety_identifier: Option<String>,
3685    /// Specifies the processing type used for serving the request.
3686    #[serde(skip_serializing_if = "Option::is_none", default)]
3687    pub service_tier: Option<ResponsesClientEventServiceTier>,
3688    /// Whether to store the generated model response for later retrieval via API.
3689    #[serde(skip_serializing_if = "Option::is_none", default)]
3690    pub store: Option<bool>,
3691    /// If set to true, the model response data will be streamed to the client as it is
3692    #[serde(skip_serializing_if = "Option::is_none", default)]
3693    pub stream: Option<bool>,
3694    /// Options for streaming responses. Only set this when you set `stream: true`.
3695    #[serde(skip_serializing_if = "Option::is_none", default)]
3696    pub stream_options: Option<StreamOptions>,
3697    /// What sampling temperature to use, between 0 and 2.
3698    #[serde(skip_serializing_if = "Option::is_none", default)]
3699    pub temperature: Option<f64>,
3700    /// Configuration options for a text response from the model.
3701    #[serde(skip_serializing_if = "Option::is_none", default)]
3702    pub text: Option<ResponseTextConfig>,
3703    /// How the model should select which tool (or tools) to use when generating a
3704    #[serde(skip_serializing_if = "Option::is_none", default)]
3705    pub tool_choice: Option<ToolChoice>,
3706    /// An array of tools the model may call while generating a response.
3707    #[serde(skip_serializing_if = "Option::is_none", default)]
3708    pub tools: Option<Vec<Tool>>,
3709    /// An integer between 0 and 20 specifying the number of most likely tokens to
3710    #[serde(skip_serializing_if = "Option::is_none", default)]
3711    pub top_logprobs: Option<i64>,
3712    /// An alternative to sampling with temperature, called nucleus sampling, where the
3713    #[serde(skip_serializing_if = "Option::is_none", default)]
3714    pub top_p: Option<f64>,
3715    /// The truncation strategy to use for the model response.
3716    #[serde(skip_serializing_if = "Option::is_none", default)]
3717    pub truncation: Option<ResponsesClientEventTruncation>,
3718    /// This field is being replaced by `safety_identifier` and `prompt_cache_key`.
3719    #[serde(skip_serializing_if = "Option::is_none", default)]
3720    pub user: Option<String>,
3721}
3722
3723pub type ResponsesServerEvent = serde_json::Value;
3724
3725#[derive(Debug, Clone, Serialize, Deserialize)]
3726#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3727pub struct SkillReference {
3728    /// The ID of the referenced skill.
3729    pub skill_id: String,
3730    /// References a skill created with the /v1/skills endpoint.
3731    #[serde(rename = "type")]
3732    pub type_: String,
3733    /// Optional skill version. Use a positive integer or 'latest'. Omit for default.
3734    #[serde(skip_serializing_if = "Option::is_none", default)]
3735    pub version: Option<String>,
3736}
3737
3738/// A filter object to specify which tools are allowed.
3739#[derive(Debug, Clone, Serialize, Deserialize)]
3740#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3741pub struct McpAllowedToolsMcpToolFilter {
3742    /// Indicates whether or not a tool modifies data or is read-only.
3743    #[serde(skip_serializing_if = "Option::is_none", default)]
3744    pub read_only: Option<bool>,
3745    /// List of allowed tool names.
3746    #[serde(skip_serializing_if = "Option::is_none", default)]
3747    pub tool_names: Option<Vec<String>>,
3748}
3749
3750pub type McpAllowedTools = serde_json::Value;
3751
3752/// A filter object to specify which tools are allowed.
3753#[derive(Debug, Clone, Serialize, Deserialize)]
3754#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3755pub struct McpRequireApprovalMcpToolApprovalFilterAlways {
3756    /// Indicates whether or not a tool modifies data or is read-only.
3757    #[serde(skip_serializing_if = "Option::is_none", default)]
3758    pub read_only: Option<bool>,
3759    /// List of allowed tool names.
3760    #[serde(skip_serializing_if = "Option::is_none", default)]
3761    pub tool_names: Option<Vec<String>>,
3762}
3763
3764/// A filter object to specify which tools are allowed.
3765#[derive(Debug, Clone, Serialize, Deserialize)]
3766#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3767pub struct McpRequireApprovalMcpToolApprovalFilterNever {
3768    /// Indicates whether or not a tool modifies data or is read-only.
3769    #[serde(skip_serializing_if = "Option::is_none", default)]
3770    pub read_only: Option<bool>,
3771    /// List of allowed tool names.
3772    #[serde(skip_serializing_if = "Option::is_none", default)]
3773    pub tool_names: Option<Vec<String>>,
3774}
3775
3776/// Specify which of the MCP server's tools require approval.
3777#[derive(Debug, Clone, Serialize, Deserialize)]
3778#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3779pub struct McpRequireApprovalMcpToolApprovalFilter {
3780    /// A filter object to specify which tools are allowed.
3781    #[serde(skip_serializing_if = "Option::is_none", default)]
3782    pub always: Option<McpRequireApprovalMcpToolApprovalFilterAlways>,
3783    /// A filter object to specify which tools are allowed.
3784    #[serde(skip_serializing_if = "Option::is_none", default)]
3785    pub never: Option<McpRequireApprovalMcpToolApprovalFilterNever>,
3786}
3787
3788#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3789#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3790#[non_exhaustive]
3791pub enum McpRequireApproval {
3792    Always,
3793    Never,
3794}
3795
3796#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3797#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3798#[non_exhaustive]
3799pub enum McpConnectorId {
3800    #[serde(rename = "connector_dropbox")]
3801    ConnectorDropbox,
3802    #[serde(rename = "connector_gmail")]
3803    ConnectorGmail,
3804    #[serde(rename = "connector_googlecalendar")]
3805    ConnectorGooglecalendar,
3806    #[serde(rename = "connector_googledrive")]
3807    ConnectorGoogledrive,
3808    #[serde(rename = "connector_microsoftteams")]
3809    ConnectorMicrosoftteams,
3810    #[serde(rename = "connector_outlookcalendar")]
3811    ConnectorOutlookcalendar,
3812    #[serde(rename = "connector_outlookemail")]
3813    ConnectorOutlookemail,
3814    #[serde(rename = "connector_sharepoint")]
3815    ConnectorSharepoint,
3816}
3817
3818/// Give the model access to additional tools via remote Model Context Protocol
3819#[derive(Debug, Clone, Serialize, Deserialize)]
3820#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3821pub struct Mcp {
3822    /// A label for this MCP server, used to identify it in tool calls.
3823    pub server_label: String,
3824    /// The type of the MCP tool. Always `mcp`.
3825    #[serde(rename = "type")]
3826    pub type_: String,
3827    /// List of allowed tool names or a filter object.
3828    #[serde(skip_serializing_if = "Option::is_none", default)]
3829    pub allowed_tools: Option<McpAllowedTools>,
3830    /// An OAuth access token that can be used with a remote MCP server, either with a
3831    #[serde(skip_serializing_if = "Option::is_none", default)]
3832    pub authorization: Option<String>,
3833    /// Identifier for service connectors, like those available in ChatGPT.
3834    #[serde(skip_serializing_if = "Option::is_none", default)]
3835    pub connector_id: Option<McpConnectorId>,
3836    /// Whether this MCP tool is deferred and discovered via tool search.
3837    #[serde(skip_serializing_if = "Option::is_none", default)]
3838    pub defer_loading: Option<bool>,
3839    /// Optional HTTP headers to send to the MCP server.
3840    #[serde(skip_serializing_if = "Option::is_none", default)]
3841    pub headers: Option<std::collections::HashMap<String, String>>,
3842    /// Specify which of the MCP server's tools require approval.
3843    #[serde(skip_serializing_if = "Option::is_none", default)]
3844    pub require_approval: Option<McpRequireApproval>,
3845    /// Optional description of the MCP server, used to provide more context.
3846    #[serde(skip_serializing_if = "Option::is_none", default)]
3847    pub server_description: Option<String>,
3848    /// The URL for the MCP server.
3849    #[serde(skip_serializing_if = "Option::is_none", default)]
3850    pub server_url: Option<String>,
3851}
3852
3853pub type CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy = serde_json::Value;
3854
3855#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3856#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3857#[non_exhaustive]
3858pub enum CodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit {
3859    #[serde(rename = "1g")]
3860    V1g,
3861    #[serde(rename = "4g")]
3862    V4g,
3863    #[serde(rename = "16g")]
3864    V16g,
3865    #[serde(rename = "64g")]
3866    V64g,
3867}
3868
3869/// Configuration for a code interpreter container.
3870#[derive(Debug, Clone, Serialize, Deserialize)]
3871#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3872pub struct CodeInterpreterContainerCodeInterpreterToolAuto {
3873    /// Always `auto`.
3874    #[serde(rename = "type")]
3875    pub type_: String,
3876    /// An optional list of uploaded files to make available to your code.
3877    #[serde(skip_serializing_if = "Option::is_none", default)]
3878    pub file_ids: Option<Vec<String>>,
3879    /// The memory limit for the code interpreter container.
3880    #[serde(skip_serializing_if = "Option::is_none", default)]
3881    pub memory_limit: Option<CodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit>,
3882    /// Network access policy for the container.
3883    #[serde(skip_serializing_if = "Option::is_none", default)]
3884    pub network_policy: Option<CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy>,
3885}
3886
3887pub type CodeInterpreterContainer = serde_json::Value;
3888
3889/// A tool that runs Python code to help generate a response to a prompt.
3890#[derive(Debug, Clone, Serialize, Deserialize)]
3891#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3892pub struct CodeInterpreter {
3893    /// The code interpreter container.
3894    pub container: CodeInterpreterContainer,
3895    /// The type of the code interpreter tool. Always `code_interpreter`.
3896    #[serde(rename = "type")]
3897    pub type_: String,
3898}
3899
3900/// Optional mask for inpainting.
3901#[derive(Debug, Clone, Serialize, Deserialize)]
3902#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3903pub struct ImageGenerationInputImageMask {
3904    /// File ID for the mask image.
3905    #[serde(skip_serializing_if = "Option::is_none", default)]
3906    pub file_id: Option<String>,
3907    /// Base64-encoded mask image.
3908    #[serde(skip_serializing_if = "Option::is_none", default)]
3909    pub image_url: Option<String>,
3910}
3911
3912#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3913#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3914#[non_exhaustive]
3915pub enum ImageGenerationAction {
3916    #[serde(rename = "generate")]
3917    Generate,
3918    #[serde(rename = "edit")]
3919    Edit,
3920    #[serde(rename = "auto")]
3921    Auto,
3922}
3923
3924#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3925#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3926#[non_exhaustive]
3927pub enum ImageGenerationBackground {
3928    #[serde(rename = "transparent")]
3929    Transparent,
3930    #[serde(rename = "opaque")]
3931    Opaque,
3932    #[serde(rename = "auto")]
3933    Auto,
3934}
3935
3936#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3937#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3938#[non_exhaustive]
3939pub enum ImageGenerationInputFidelity {
3940    #[serde(rename = "high")]
3941    High,
3942    #[serde(rename = "low")]
3943    Low,
3944}
3945
3946#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3947#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3948#[non_exhaustive]
3949pub enum ImageGenerationModeration {
3950    #[serde(rename = "auto")]
3951    Auto,
3952    #[serde(rename = "low")]
3953    Low,
3954}
3955
3956#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3957#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3958#[non_exhaustive]
3959pub enum ImageGenerationOutputFormat {
3960    #[serde(rename = "png")]
3961    Png,
3962    #[serde(rename = "webp")]
3963    Webp,
3964    #[serde(rename = "jpeg")]
3965    Jpeg,
3966}
3967
3968#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3969#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3970#[non_exhaustive]
3971pub enum ImageGenerationQuality {
3972    #[serde(rename = "low")]
3973    Low,
3974    #[serde(rename = "medium")]
3975    Medium,
3976    #[serde(rename = "high")]
3977    High,
3978    #[serde(rename = "auto")]
3979    Auto,
3980}
3981
3982#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3983#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3984#[non_exhaustive]
3985pub enum ImageGenerationSize {
3986    #[serde(rename = "1024x1024")]
3987    V1024x1024,
3988    #[serde(rename = "1024x1536")]
3989    V1024x1536,
3990    #[serde(rename = "1536x1024")]
3991    V1536x1024,
3992    #[serde(rename = "auto")]
3993    Auto,
3994}
3995
3996/// A tool that generates images using the GPT image models.
3997#[derive(Debug, Clone, Serialize, Deserialize)]
3998#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
3999pub struct ImageGeneration {
4000    /// The type of the image generation tool. Always `image_generation`.
4001    #[serde(rename = "type")]
4002    pub type_: String,
4003    /// Whether to generate a new image or edit an existing image. Default: `auto`.
4004    #[serde(skip_serializing_if = "Option::is_none", default)]
4005    pub action: Option<ImageGenerationAction>,
4006    /// Background type for the generated image.
4007    #[serde(skip_serializing_if = "Option::is_none", default)]
4008    pub background: Option<ImageGenerationBackground>,
4009    /// Control how much effort the model will exert to match the style and features,
4010    #[serde(skip_serializing_if = "Option::is_none", default)]
4011    pub input_fidelity: Option<ImageGenerationInputFidelity>,
4012    /// Optional mask for inpainting.
4013    #[serde(skip_serializing_if = "Option::is_none", default)]
4014    pub input_image_mask: Option<ImageGenerationInputImageMask>,
4015    /// The image generation model to use. Default: `gpt-image-1`.
4016    #[serde(skip_serializing_if = "Option::is_none", default)]
4017    pub model: Option<String>,
4018    /// Moderation level for the generated image. Default: `auto`.
4019    #[serde(skip_serializing_if = "Option::is_none", default)]
4020    pub moderation: Option<ImageGenerationModeration>,
4021    /// Compression level for the output image. Default: 100.
4022    #[serde(skip_serializing_if = "Option::is_none", default)]
4023    pub output_compression: Option<i64>,
4024    /// The output format of the generated image.
4025    #[serde(skip_serializing_if = "Option::is_none", default)]
4026    pub output_format: Option<ImageGenerationOutputFormat>,
4027    /// Number of partial images to generate in streaming mode, from 0 (default value)
4028    #[serde(skip_serializing_if = "Option::is_none", default)]
4029    pub partial_images: Option<i64>,
4030    /// The quality of the generated image.
4031    #[serde(skip_serializing_if = "Option::is_none", default)]
4032    pub quality: Option<ImageGenerationQuality>,
4033    /// The size of the generated image.
4034    #[serde(skip_serializing_if = "Option::is_none", default)]
4035    pub size: Option<ImageGenerationSize>,
4036}
4037
4038/// A tool that allows the model to execute shell commands in a local environment.
4039#[derive(Debug, Clone, Serialize, Deserialize)]
4040#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4041pub struct LocalShell {
4042    /// The type of the local shell tool. Always `local_shell`.
4043    #[serde(rename = "type")]
4044    pub type_: String,
4045}
4046
4047#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4048#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4049#[non_exhaustive]
4050pub enum ToolChoiceAllowedMode {
4051    #[serde(rename = "auto")]
4052    Auto,
4053    #[serde(rename = "required")]
4054    Required,
4055}
4056
4057/// Constrains the tools available to the model to a pre-defined set.
4058#[derive(Debug, Clone, Serialize, Deserialize)]
4059#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4060pub struct ToolChoiceAllowed {
4061    /// Constrains the tools available to the model to a pre-defined set.
4062    pub mode: ToolChoiceAllowedMode,
4063    /// A list of tool definitions that the model should be allowed to call.
4064    pub tools: Vec<std::collections::HashMap<String, serde_json::Value>>,
4065    /// Allowed tool configuration type. Always `allowed_tools`.
4066    #[serde(rename = "type")]
4067    pub type_: String,
4068}
4069
4070/// Forces the model to call the apply_patch tool when executing a tool call.
4071#[derive(Debug, Clone, Serialize, Deserialize)]
4072#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4073pub struct ToolChoiceApplyPatch {
4074    /// The tool to call. Always `apply_patch`.
4075    #[serde(rename = "type")]
4076    pub type_: String,
4077}
4078
4079/// Use this option to force the model to call a specific custom tool.
4080#[derive(Debug, Clone, Serialize, Deserialize)]
4081#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4082pub struct ToolChoiceCustom {
4083    /// The name of the custom tool to call.
4084    pub name: String,
4085    /// For custom tool calling, the type is always `custom`.
4086    #[serde(rename = "type")]
4087    pub type_: String,
4088}
4089
4090/// Use this option to force the model to call a specific tool on a remote MCP server.
4091#[derive(Debug, Clone, Serialize, Deserialize)]
4092#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4093pub struct ToolChoiceMcp {
4094    /// The label of the MCP server to use.
4095    pub server_label: String,
4096    /// For MCP tools, the type is always `mcp`.
4097    #[serde(rename = "type")]
4098    pub type_: String,
4099    /// The name of the tool to call on the server.
4100    #[serde(skip_serializing_if = "Option::is_none", default)]
4101    pub name: Option<String>,
4102}
4103
4104/// Forces the model to call the shell tool when a tool call is required.
4105#[derive(Debug, Clone, Serialize, Deserialize)]
4106#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4107pub struct ToolChoiceShell {
4108    /// The tool to call. Always `shell`.
4109    #[serde(rename = "type")]
4110    pub type_: String,
4111}
4112
4113#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4114#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4115#[non_exhaustive]
4116pub enum ToolChoiceTypesType {
4117    #[serde(rename = "file_search")]
4118    FileSearch,
4119    #[serde(rename = "web_search_preview")]
4120    WebSearchPreview,
4121    #[serde(rename = "computer")]
4122    Computer,
4123    #[serde(rename = "computer_use_preview")]
4124    ComputerUsePreview,
4125    #[serde(rename = "computer_use")]
4126    ComputerUse,
4127    #[serde(rename = "web_search_preview_2025_03_11")]
4128    WebSearchPreview20250311,
4129    #[serde(rename = "image_generation")]
4130    ImageGeneration,
4131    #[serde(rename = "code_interpreter")]
4132    CodeInterpreter,
4133}
4134
4135/// Indicates that the model should use a built-in tool to generate a response.
4136#[derive(Debug, Clone, Serialize, Deserialize)]
4137#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4138pub struct ToolChoiceTypes {
4139    /// The type of hosted tool the model should to use.
4140    #[serde(rename = "type")]
4141    pub type_: ToolChoiceTypesType,
4142}
4143
4144#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4145#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4146#[non_exhaustive]
4147pub enum ToolSearchToolExecution {
4148    #[serde(rename = "server")]
4149    Server,
4150    #[serde(rename = "client")]
4151    Client,
4152}
4153
4154/// Hosted or BYOT tool search configuration for deferred tools.
4155#[derive(Debug, Clone, Serialize, Deserialize)]
4156#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4157pub struct ToolSearchTool {
4158    /// The type of the tool. Always `tool_search`.
4159    #[serde(rename = "type")]
4160    pub type_: String,
4161    /// Description shown to the model for a client-executed tool search tool.
4162    #[serde(skip_serializing_if = "Option::is_none", default)]
4163    pub description: Option<String>,
4164    /// Whether tool search is executed by the server or by the client.
4165    #[serde(skip_serializing_if = "Option::is_none", default)]
4166    pub execution: Option<ToolSearchToolExecution>,
4167    /// Parameter schema for a client-executed tool search tool.
4168    #[serde(skip_serializing_if = "Option::is_none", default)]
4169    pub parameters: Option<serde_json::Value>,
4170}
4171
4172/// The user's location.
4173#[derive(Debug, Clone, Serialize, Deserialize)]
4174#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4175pub struct UserLocation {
4176    /// The type of location approximation. Always `approximate`.
4177    #[serde(rename = "type")]
4178    pub type_: String,
4179    /// Free text input for the city of the user, e.g. `San Francisco`.
4180    #[serde(skip_serializing_if = "Option::is_none", default)]
4181    pub city: Option<String>,
4182    /// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
4183    #[serde(skip_serializing_if = "Option::is_none", default)]
4184    pub country: Option<String>,
4185    /// Free text input for the region of the user, e.g. `California`.
4186    #[serde(skip_serializing_if = "Option::is_none", default)]
4187    pub region: Option<String>,
4188    /// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
4189    #[serde(skip_serializing_if = "Option::is_none", default)]
4190    pub timezone: Option<String>,
4191}
4192
4193#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4194#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4195#[non_exhaustive]
4196pub enum WebSearchPreviewToolType {
4197    #[serde(rename = "web_search_preview")]
4198    WebSearchPreview,
4199    #[serde(rename = "web_search_preview_2025_03_11")]
4200    WebSearchPreview20250311,
4201}
4202
4203#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4204#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4205#[non_exhaustive]
4206pub enum WebSearchPreviewToolSearchContextSize {
4207    #[serde(rename = "low")]
4208    Low,
4209    #[serde(rename = "medium")]
4210    Medium,
4211    #[serde(rename = "high")]
4212    High,
4213}
4214
4215/// This tool searches the web for relevant results to use in a response.
4216#[derive(Debug, Clone, Serialize, Deserialize)]
4217#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4218pub struct WebSearchPreviewTool {
4219    /// The type of the web search tool.
4220    #[serde(rename = "type")]
4221    pub type_: WebSearchPreviewToolType,
4222    #[serde(skip_serializing_if = "Option::is_none", default)]
4223    pub search_content_types: Option<Vec<serde_json::Value>>,
4224    /// High level guidance for the amount of context window space to use for the
4225    #[serde(skip_serializing_if = "Option::is_none", default)]
4226    pub search_context_size: Option<WebSearchPreviewToolSearchContextSize>,
4227    /// The user's location.
4228    #[serde(skip_serializing_if = "Option::is_none", default)]
4229    pub user_location: Option<UserLocation>,
4230}
4231
4232#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4233#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4234#[non_exhaustive]
4235pub enum WebSearchToolType {
4236    #[serde(rename = "web_search")]
4237    WebSearch,
4238    #[serde(rename = "web_search_2025_08_26")]
4239    WebSearch20250826,
4240}
4241
4242#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4243#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4244#[non_exhaustive]
4245pub enum WebSearchToolSearchContextSize {
4246    #[serde(rename = "low")]
4247    Low,
4248    #[serde(rename = "medium")]
4249    Medium,
4250    #[serde(rename = "high")]
4251    High,
4252}
4253
4254/// Search the Internet for sources related to the prompt.
4255#[derive(Debug, Clone, Serialize, Deserialize)]
4256#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
4257pub struct WebSearchTool {
4258    /// The type of the web search tool.
4259    #[serde(rename = "type")]
4260    pub type_: WebSearchToolType,
4261    /// Filters for the search.
4262    #[serde(skip_serializing_if = "Option::is_none", default)]
4263    pub filters: Option<Filters>,
4264    /// High level guidance for the amount of context window space to use for the
4265    #[serde(skip_serializing_if = "Option::is_none", default)]
4266    pub search_context_size: Option<WebSearchToolSearchContextSize>,
4267    /// The approximate location of the user.
4268    #[serde(skip_serializing_if = "Option::is_none", default)]
4269    pub user_location: Option<UserLocation>,
4270}