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