Skip to main content

gproxy_protocol/wire/openai/realtime/
response_config.rs

1//! Native Realtime wire DTOs. Source definitions are cited on each object.
2//! Verified with Realtime.md and openai-python snapshot
3//! e12b81d3bbf644ec7045e152d69bc4b68d69cd48 (2026-09-13).
4//! https://github.com/openai/openai-python/tree/e12b81d3bbf644ec7045e152d69bc4b68d69cd48/src/openai/types/realtime
5use super::wire::present_nullable;
6use super::{
7    ConversationItem, Metadata, RealtimeAudioFormats, RealtimeFunctionTool, RealtimeReasoning,
8    ResponsePrompt, ToolChoiceFunction, ToolChoiceMcp, ToolChoiceOptions,
9};
10use crate::Rest;
11use serde::{Deserialize, Serialize};
12
13/// Source: `openai/types/realtime/realtime_response_create_params.py`, `RealtimeResponseCreateParams`.
14#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
15#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
16#[derive(gproxy_protocol_macros::DeclaredFields)]
17pub struct RealtimeResponseCreateParams {
18    #[serde(
19        default,
20        deserialize_with = "present_nullable",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub audio: Option<Option<RealtimeResponseCreateAudioOutput>>,
24    #[serde(
25        default,
26        deserialize_with = "present_nullable",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub conversation: Option<Option<String>>,
30    #[serde(
31        default,
32        deserialize_with = "present_nullable",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub input: Option<Option<Vec<ConversationItem>>>,
36    #[serde(
37        default,
38        deserialize_with = "present_nullable",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub instructions: Option<Option<String>>,
42    #[serde(
43        default,
44        deserialize_with = "present_nullable",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub max_output_tokens: Option<Option<RealtimeResponseCreateParamsMaxOutputTokens>>,
48    #[serde(
49        default,
50        deserialize_with = "present_nullable",
51        skip_serializing_if = "Option::is_none"
52    )]
53    pub metadata: Option<Option<Metadata>>,
54    #[serde(
55        default,
56        deserialize_with = "present_nullable",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub output_modalities: Option<Option<Vec<RealtimeResponseCreateParamsOutputModalitiesItem>>>,
60    #[serde(
61        default,
62        deserialize_with = "present_nullable",
63        skip_serializing_if = "Option::is_none"
64    )]
65    pub parallel_tool_calls: Option<Option<bool>>,
66    #[serde(
67        default,
68        deserialize_with = "present_nullable",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub prompt: Option<Option<ResponsePrompt>>,
72    #[serde(
73        default,
74        deserialize_with = "present_nullable",
75        skip_serializing_if = "Option::is_none"
76    )]
77    pub reasoning: Option<Option<RealtimeReasoning>>,
78    #[serde(
79        default,
80        deserialize_with = "present_nullable",
81        skip_serializing_if = "Option::is_none"
82    )]
83    pub tool_choice: Option<Option<RealtimeResponseCreateParamsToolChoice>>,
84    #[serde(
85        default,
86        deserialize_with = "present_nullable",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub tools: Option<Option<Vec<RealtimeResponseCreateParamsTool>>>,
90    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
91    pub rest: Rest,
92}
93
94/// Source: `openai/types/realtime/realtime_response_create_audio_output.py`, `RealtimeResponseCreateAudioOutput`.
95#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
96#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
97#[derive(gproxy_protocol_macros::DeclaredFields)]
98pub struct RealtimeResponseCreateAudioOutput {
99    #[serde(
100        default,
101        deserialize_with = "present_nullable",
102        skip_serializing_if = "Option::is_none"
103    )]
104    pub output: Option<Option<RealtimeResponseCreateAudioOutputOutput>>,
105    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
106    pub rest: Rest,
107}
108
109/// Source: `openai/types/realtime/realtime_response_create_params.py`, `ToolChoice`.
110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
111#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
112#[serde(untagged)]
113#[derive(gproxy_protocol_macros::DeclaredFields)]
114pub enum RealtimeResponseCreateParamsToolChoice {
115    ToolChoiceOptions(ToolChoiceOptions),
116    ToolChoiceFunction(ToolChoiceFunction),
117    ToolChoiceMcp(ToolChoiceMcp),
118}
119
120/// Source: `openai/types/realtime/realtime_response_create_params.py`, `Tool`.
121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
122#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
123#[serde(untagged)]
124#[allow(clippy::large_enum_variant)]
125#[derive(gproxy_protocol_macros::DeclaredFields)]
126pub enum RealtimeResponseCreateParamsTool {
127    RealtimeFunctionTool(RealtimeFunctionTool),
128    RealtimeResponseCreateMcpTool(RealtimeResponseCreateMcpTool),
129}
130
131/// Source: `openai/types/realtime/realtime_response_create_audio_output.py`, `Output`.
132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
133#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
134#[derive(gproxy_protocol_macros::DeclaredFields)]
135pub struct RealtimeResponseCreateAudioOutputOutput {
136    #[serde(
137        default,
138        deserialize_with = "present_nullable",
139        skip_serializing_if = "Option::is_none"
140    )]
141    pub format: Option<Option<RealtimeAudioFormats>>,
142    #[serde(
143        default,
144        deserialize_with = "present_nullable",
145        skip_serializing_if = "Option::is_none"
146    )]
147    pub voice: Option<Option<RealtimeResponseCreateAudioOutputOutputVoice>>,
148    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
149    pub rest: Rest,
150}
151
152/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `RealtimeResponseCreateMcpTool`.
153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
154#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
155#[derive(gproxy_protocol_macros::DeclaredFields)]
156pub struct RealtimeResponseCreateMcpTool {
157    pub server_label: String,
158    #[serde(rename = "type")]
159    pub type_: RealtimeResponseCreateMcpToolType,
160    #[serde(
161        default,
162        deserialize_with = "present_nullable",
163        skip_serializing_if = "Option::is_none"
164    )]
165    pub allowed_callers: Option<Option<Vec<RealtimeResponseCreateMcpToolAllowedCallersItem>>>,
166    #[serde(
167        default,
168        deserialize_with = "present_nullable",
169        skip_serializing_if = "Option::is_none"
170    )]
171    pub allowed_tools: Option<Option<RealtimeResponseCreateMcpToolAllowedTools>>,
172    #[serde(
173        default,
174        deserialize_with = "present_nullable",
175        skip_serializing_if = "Option::is_none"
176    )]
177    pub authorization: Option<Option<String>>,
178    #[serde(
179        default,
180        deserialize_with = "present_nullable",
181        skip_serializing_if = "Option::is_none"
182    )]
183    pub connector_id: Option<Option<RealtimeResponseCreateMcpToolConnectorId>>,
184    #[serde(
185        default,
186        deserialize_with = "present_nullable",
187        skip_serializing_if = "Option::is_none"
188    )]
189    pub defer_loading: Option<Option<bool>>,
190    #[serde(
191        default,
192        deserialize_with = "present_nullable",
193        skip_serializing_if = "Option::is_none"
194    )]
195    pub headers: Option<Option<std::collections::BTreeMap<String, String>>>,
196    #[serde(
197        default,
198        deserialize_with = "present_nullable",
199        skip_serializing_if = "Option::is_none"
200    )]
201    pub require_approval: Option<Option<RealtimeResponseCreateMcpToolRequireApproval>>,
202    #[serde(
203        default,
204        deserialize_with = "present_nullable",
205        skip_serializing_if = "Option::is_none"
206    )]
207    pub server_description: Option<Option<String>>,
208    #[serde(
209        default,
210        deserialize_with = "present_nullable",
211        skip_serializing_if = "Option::is_none"
212    )]
213    pub server_url: Option<Option<String>>,
214    #[serde(
215        default,
216        deserialize_with = "present_nullable",
217        skip_serializing_if = "Option::is_none"
218    )]
219    pub tunnel_id: Option<Option<String>>,
220    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
221    pub rest: Rest,
222}
223
224/// Source: `openai/types/realtime/realtime_response_create_audio_output.py`, `OutputVoice`.
225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
226#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
227#[serde(untagged)]
228#[derive(gproxy_protocol_macros::DeclaredFields)]
229pub enum RealtimeResponseCreateAudioOutputOutputVoice {
230    Text(String),
231    RealtimeResponseCreateAudioOutputOutputVoiceID(RealtimeResponseCreateAudioOutputOutputVoiceID),
232}
233
234/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `AllowedTools`.
235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
236#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
237#[serde(untagged)]
238#[derive(gproxy_protocol_macros::DeclaredFields)]
239pub enum RealtimeResponseCreateMcpToolAllowedTools {
240    Items(Vec<String>),
241    RealtimeResponseCreateMcpToolAllowedToolsMcpToolFilter(
242        RealtimeResponseCreateMcpToolAllowedToolsMcpToolFilter,
243    ),
244    Variant3(()),
245}
246
247/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `RequireApproval`.
248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
249#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
250#[serde(untagged)]
251#[derive(gproxy_protocol_macros::DeclaredFields)]
252pub enum RealtimeResponseCreateMcpToolRequireApproval {
253    RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilter(
254        RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilter,
255    ),
256    Literal(RealtimeResponseCreateMcpToolRequireApprovalVariant2),
257    Variant3(()),
258}
259
260/// Source: `openai/types/realtime/realtime_response_create_audio_output.py`, `OutputVoiceID`.
261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
262#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
263#[derive(gproxy_protocol_macros::DeclaredFields)]
264pub struct RealtimeResponseCreateAudioOutputOutputVoiceID {
265    pub id: String,
266    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
267    pub rest: Rest,
268}
269
270/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `AllowedToolsMcpToolFilter`.
271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
272#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
273#[derive(gproxy_protocol_macros::DeclaredFields)]
274pub struct RealtimeResponseCreateMcpToolAllowedToolsMcpToolFilter {
275    #[serde(
276        default,
277        deserialize_with = "present_nullable",
278        skip_serializing_if = "Option::is_none"
279    )]
280    pub read_only: Option<Option<bool>>,
281    #[serde(
282        default,
283        deserialize_with = "present_nullable",
284        skip_serializing_if = "Option::is_none"
285    )]
286    pub tool_names: Option<Option<Vec<String>>>,
287    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
288    pub rest: Rest,
289}
290
291/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `RequireApprovalMcpToolApprovalFilter`.
292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
293#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
294#[derive(gproxy_protocol_macros::DeclaredFields)]
295pub struct RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilter {
296    #[serde(
297        default,
298        deserialize_with = "present_nullable",
299        skip_serializing_if = "Option::is_none"
300    )]
301    pub always:
302        Option<Option<RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilterAlways>>,
303    #[serde(
304        default,
305        deserialize_with = "present_nullable",
306        skip_serializing_if = "Option::is_none"
307    )]
308    pub never:
309        Option<Option<RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilterNever>>,
310    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
311    pub rest: Rest,
312}
313
314/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `RequireApprovalMcpToolApprovalFilterAlways`.
315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
316#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
317#[derive(gproxy_protocol_macros::DeclaredFields)]
318pub struct RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilterAlways {
319    #[serde(
320        default,
321        deserialize_with = "present_nullable",
322        skip_serializing_if = "Option::is_none"
323    )]
324    pub read_only: Option<Option<bool>>,
325    #[serde(
326        default,
327        deserialize_with = "present_nullable",
328        skip_serializing_if = "Option::is_none"
329    )]
330    pub tool_names: Option<Option<Vec<String>>>,
331    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
332    pub rest: Rest,
333}
334
335/// Source: `openai/types/realtime/realtime_response_create_mcp_tool.py`, `RequireApprovalMcpToolApprovalFilterNever`.
336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
337#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
338#[derive(gproxy_protocol_macros::DeclaredFields)]
339pub struct RealtimeResponseCreateMcpToolRequireApprovalMcpToolApprovalFilterNever {
340    #[serde(
341        default,
342        deserialize_with = "present_nullable",
343        skip_serializing_if = "Option::is_none"
344    )]
345    pub read_only: Option<Option<bool>>,
346    #[serde(
347        default,
348        deserialize_with = "present_nullable",
349        skip_serializing_if = "Option::is_none"
350    )]
351    pub tool_names: Option<Option<Vec<String>>>,
352    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
353    pub rest: Rest,
354}
355
356#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
357#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
358#[derive(gproxy_protocol_macros::DeclaredFields)]
359pub enum RealtimeResponseCreateParamsMaxOutputTokensVariant2 {
360    #[serde(rename = "inf")]
361    Inf,
362}
363
364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
365#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
366#[serde(untagged)]
367#[derive(gproxy_protocol_macros::DeclaredFields)]
368pub enum RealtimeResponseCreateParamsMaxOutputTokens {
369    Number(i64),
370    Literal(RealtimeResponseCreateParamsMaxOutputTokensVariant2),
371}
372
373#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
374#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
375#[derive(gproxy_protocol_macros::DeclaredFields)]
376pub enum RealtimeResponseCreateParamsOutputModalitiesItem {
377    #[serde(rename = "text")]
378    Text,
379    #[serde(rename = "audio")]
380    Audio,
381}
382
383#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
384#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
385#[derive(gproxy_protocol_macros::DeclaredFields)]
386pub enum RealtimeResponseCreateMcpToolType {
387    #[serde(rename = "mcp")]
388    Mcp,
389}
390
391#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
392#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
393#[derive(gproxy_protocol_macros::DeclaredFields)]
394pub enum RealtimeResponseCreateMcpToolAllowedCallersItem {
395    #[serde(rename = "direct")]
396    Direct,
397    #[serde(rename = "programmatic")]
398    Programmatic,
399}
400
401#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
402#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
403#[derive(gproxy_protocol_macros::DeclaredFields)]
404pub enum RealtimeResponseCreateMcpToolConnectorId {
405    #[serde(rename = "connector_dropbox")]
406    ConnectorDropbox,
407    #[serde(rename = "connector_gmail")]
408    ConnectorGmail,
409    #[serde(rename = "connector_googlecalendar")]
410    ConnectorGooglecalendar,
411    #[serde(rename = "connector_googledrive")]
412    ConnectorGoogledrive,
413    #[serde(rename = "connector_microsoftteams")]
414    ConnectorMicrosoftteams,
415    #[serde(rename = "connector_outlookcalendar")]
416    ConnectorOutlookcalendar,
417    #[serde(rename = "connector_outlookemail")]
418    ConnectorOutlookemail,
419    #[serde(rename = "connector_sharepoint")]
420    ConnectorSharepoint,
421}
422
423#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
424#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
425#[derive(gproxy_protocol_macros::DeclaredFields)]
426pub enum RealtimeResponseCreateMcpToolRequireApprovalVariant2 {
427    #[serde(rename = "always")]
428    Always,
429    #[serde(rename = "never")]
430    Never,
431}