Skip to main content

gproxy_protocol/wire/openai/realtime/
session_response.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    RealtimeReasoning, RealtimeSessionCreateResponseAudio, RealtimeSessionCreateResponseTool,
8    RealtimeSessionCreateResponseToolChoice, RealtimeTruncation, ResponsePrompt,
9};
10use crate::Rest;
11use serde::{Deserialize, Serialize};
12
13/// Source: `openai/types/realtime/realtime_session_create_response.py`, `RealtimeSessionCreateResponse`.
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)]
17#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
18pub struct RealtimeSessionCreateResponse {
19    pub id: String,
20    pub object: RealtimeSessionCreateResponseObject,
21    #[serde(rename = "type")]
22    pub type_: RealtimeSessionCreateResponseType,
23    #[serde(
24        default,
25        deserialize_with = "present_nullable",
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub audio: Option<Option<RealtimeSessionCreateResponseAudio>>,
29    #[serde(
30        default,
31        deserialize_with = "present_nullable",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub expires_at: Option<Option<i64>>,
35    #[serde(
36        default,
37        deserialize_with = "present_nullable",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub include: Option<Option<Vec<RealtimeSessionCreateResponseIncludeItem>>>,
41    #[serde(
42        default,
43        deserialize_with = "present_nullable",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub instructions: Option<Option<String>>,
47    #[serde(
48        default,
49        deserialize_with = "present_nullable",
50        skip_serializing_if = "Option::is_none"
51    )]
52    pub max_output_tokens: Option<Option<RealtimeSessionCreateResponseMaxOutputTokens>>,
53    #[serde(
54        default,
55        deserialize_with = "present_nullable",
56        skip_serializing_if = "Option::is_none"
57    )]
58    pub model: Option<Option<String>>,
59    #[serde(
60        default,
61        deserialize_with = "present_nullable",
62        skip_serializing_if = "Option::is_none"
63    )]
64    pub output_modalities: Option<Option<Vec<RealtimeSessionCreateResponseOutputModalitiesItem>>>,
65    #[serde(
66        default,
67        deserialize_with = "present_nullable",
68        skip_serializing_if = "Option::is_none"
69    )]
70    pub prompt: Option<Option<ResponsePrompt>>,
71    #[serde(
72        default,
73        deserialize_with = "present_nullable",
74        skip_serializing_if = "Option::is_none"
75    )]
76    pub reasoning: Option<Option<RealtimeReasoning>>,
77    #[serde(
78        default,
79        deserialize_with = "present_nullable",
80        skip_serializing_if = "Option::is_none"
81    )]
82    pub tool_choice: Option<Option<RealtimeSessionCreateResponseToolChoice>>,
83    #[serde(
84        default,
85        deserialize_with = "present_nullable",
86        skip_serializing_if = "Option::is_none"
87    )]
88    pub tools: Option<Option<Vec<RealtimeSessionCreateResponseTool>>>,
89    #[serde(
90        default,
91        deserialize_with = "present_nullable",
92        skip_serializing_if = "Option::is_none"
93    )]
94    pub tracing: Option<Option<RealtimeSessionCreateResponseTracing>>,
95    #[serde(
96        default,
97        deserialize_with = "present_nullable",
98        skip_serializing_if = "Option::is_none"
99    )]
100    pub truncation: Option<Option<RealtimeTruncation>>,
101    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
102    pub rest: Rest,
103}
104
105/// Source: `openai/types/realtime/realtime_session_create_response.py`, `Tracing`.
106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
107#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
108#[serde(untagged)]
109#[derive(gproxy_protocol_macros::DeclaredFields)]
110#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
111pub enum RealtimeSessionCreateResponseTracing {
112    Literal(RealtimeSessionCreateResponseTracingVariant1),
113    RealtimeSessionCreateResponseTracingTracingConfiguration(
114        RealtimeSessionCreateResponseTracingTracingConfiguration,
115    ),
116    Variant3(()),
117}
118
119/// Source: `openai/types/realtime/realtime_session_create_response.py`, `TracingTracingConfiguration`.
120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
121#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
122#[derive(gproxy_protocol_macros::DeclaredFields)]
123#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
124pub struct RealtimeSessionCreateResponseTracingTracingConfiguration {
125    #[serde(
126        default,
127        deserialize_with = "present_nullable",
128        skip_serializing_if = "Option::is_none"
129    )]
130    pub group_id: Option<Option<String>>,
131    #[serde(
132        default,
133        deserialize_with = "present_nullable",
134        skip_serializing_if = "Option::is_none"
135    )]
136    pub metadata: Option<Option<serde_json::Value>>,
137    #[serde(
138        default,
139        deserialize_with = "present_nullable",
140        skip_serializing_if = "Option::is_none"
141    )]
142    pub workflow_name: Option<Option<String>>,
143    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
144    pub rest: Rest,
145}
146
147#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
148#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
149#[derive(gproxy_protocol_macros::DeclaredFields)]
150#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
151pub enum RealtimeSessionCreateResponseObject {
152    #[serde(rename = "realtime.session")]
153    RealtimeSession,
154}
155
156#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
157#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
158#[derive(gproxy_protocol_macros::DeclaredFields)]
159#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
160pub enum RealtimeSessionCreateResponseType {
161    #[serde(rename = "realtime")]
162    Realtime,
163}
164
165#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
166#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
167#[derive(gproxy_protocol_macros::DeclaredFields)]
168#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
169pub enum RealtimeSessionCreateResponseIncludeItem {
170    #[serde(rename = "item.input_audio_transcription.logprobs")]
171    ItemInputAudioTranscriptionLogprobs,
172}
173
174#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
175#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
176#[derive(gproxy_protocol_macros::DeclaredFields)]
177#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
178pub enum RealtimeSessionCreateResponseMaxOutputTokensVariant2 {
179    #[serde(rename = "inf")]
180    Inf,
181}
182
183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
184#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
185#[serde(untagged)]
186#[derive(gproxy_protocol_macros::DeclaredFields)]
187#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
188pub enum RealtimeSessionCreateResponseMaxOutputTokens {
189    Number(i64),
190    Literal(RealtimeSessionCreateResponseMaxOutputTokensVariant2),
191}
192
193#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
194#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
195#[derive(gproxy_protocol_macros::DeclaredFields)]
196#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
197pub enum RealtimeSessionCreateResponseOutputModalitiesItem {
198    #[serde(rename = "text")]
199    Text,
200    #[serde(rename = "audio")]
201    Audio,
202}
203
204#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
205#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
206#[derive(gproxy_protocol_macros::DeclaredFields)]
207#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
208pub enum RealtimeSessionCreateResponseTracingVariant1 {
209    #[serde(rename = "auto")]
210    Auto,
211}