@@ -17,16 +17,24 @@ public class RealtimeSessionBody
1717 public string Model { get ; set ; } = null ! ;
1818
1919 [ JsonPropertyName ( "temperature" ) ]
20- public float Temperature { get ; set ; } = 0.8f ;
20+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
21+ public float ? Temperature { get ; set ; } = 0.8f ;
2122
2223 [ JsonPropertyName ( "modalities" ) ]
23- public string [ ] Modalities { get ; set ; } = [ "audio" , "text" ] ;
24+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
25+ public string [ ] ? Modalities { get ; set ; } = [ "audio" , "text" ] ;
26+
27+ [ JsonPropertyName ( "output_modalities" ) ]
28+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
29+ public string [ ] ? OutputModalities { get ; set ; } = [ "audio" ] ;
2430
2531 [ JsonPropertyName ( "input_audio_format" ) ]
26- public string InputAudioFormat { get ; set ; } = null ! ;
32+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
33+ public string ? InputAudioFormat { get ; set ; }
2734
2835 [ JsonPropertyName ( "output_audio_format" ) ]
29- public string OutputAudioFormat { get ; set ; } = null ! ;
36+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
37+ public string ? OutputAudioFormat { get ; set ; }
3038
3139 [ JsonPropertyName ( "input_audio_transcription" ) ]
3240 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
@@ -36,10 +44,20 @@ public class RealtimeSessionBody
3644 public string Instructions { get ; set ; } = "You are a friendly assistant." ;
3745
3846 [ JsonPropertyName ( "voice" ) ]
39- public string Voice { get ; set ; } = "sage" ;
47+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
48+ public string ? Voice { get ; set ; } = "saga" ;
49+
50+ [ JsonPropertyName ( "type" ) ]
51+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
52+ public string ? Type { get ; set ; }
4053
4154 [ JsonPropertyName ( "max_response_output_tokens" ) ]
42- public int MaxResponseOutputTokens { get ; set ; } = 512 ;
55+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
56+ public int ? MaxResponseOutputTokens { get ; set ; } = 512 ;
57+
58+ [ JsonPropertyName ( "max_output_tokens" ) ]
59+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
60+ public int ? MaxOutputTokens { get ; set ; }
4361
4462 [ JsonPropertyName ( "tool_choice" ) ]
4563 public string ToolChoice { get ; set ; } = "auto" ;
@@ -48,17 +66,31 @@ public class RealtimeSessionBody
4866 public FunctionDef [ ] Tools { get ; set ; } = [ ] ;
4967
5068 [ JsonPropertyName ( "turn_detection" ) ]
69+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
5170 public RealtimeSessionTurnDetection ? TurnDetection { get ; set ; } = new ( ) ;
5271
5372 [ JsonPropertyName ( "input_audio_noise_reduction" ) ]
54- public InputAudioNoiseReduction InputAudioNoiseReduction { get ; set ; } = new ( ) ;
73+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
74+ public InputAudioNoiseReduction ? InputAudioNoiseReduction { get ; set ; } = new ( ) ;
75+
76+ [ JsonPropertyName ( "audio" ) ]
77+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
78+ public RealtimeAudioConfig ? Audio { get ; set ; }
79+
80+ [ JsonPropertyName ( "reasoning" ) ]
81+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
82+ public RealtimeReasoningConfig ? Reasoning { get ; set ; }
5583}
5684
5785public class RealtimeSessionTurnDetection
5886{
5987 [ JsonPropertyName ( "interrupt_response" ) ]
6088 public bool InterruptResponse { get ; set ; } = true ;
6189
90+ [ JsonPropertyName ( "create_response" ) ]
91+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
92+ public bool ? CreateResponse { get ; set ; }
93+
6294 /// <summary>
6395 /// Milliseconds
6496 /// </summary>
@@ -77,6 +109,9 @@ public class RealtimeSessionTurnDetection
77109 [ JsonPropertyName ( "type" ) ]
78110 public string Type { get ; set ; } = "semantic_vad" ;
79111
112+ /// <summary>
113+ /// For semantic_vad
114+ /// </summary>
80115 [ JsonPropertyName ( "eagerness" ) ]
81116 public string Eagerness { get ; set ; } = "auto" ;
82117}
@@ -93,11 +128,75 @@ public class InputAudioTranscription
93128 [ JsonPropertyName ( "prompt" ) ]
94129 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
95130 public string ? Prompt { get ; set ; }
131+
132+ [ JsonPropertyName ( "delay" ) ]
133+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
134+ public string ? Delay { get ; set ; }
96135}
97136
98137public class InputAudioNoiseReduction
99138{
100139 [ JsonPropertyName ( "type" ) ]
101140 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
102141 public string Type { get ; set ; } = "far_field" ;
142+ }
143+
144+ public class RealtimeAudioConfig
145+ {
146+ [ JsonPropertyName ( "input" ) ]
147+ public RealtimeAudioConfigInput Input { get ; set ; } = new ( ) ;
148+
149+ [ JsonPropertyName ( "output" ) ]
150+ public RealtimeAudioConfigOutput Output { get ; set ; } = new ( ) ;
151+ }
152+
153+ public class RealtimeAudioConfigInput
154+ {
155+ [ JsonPropertyName ( "format" ) ]
156+ public RealtimeAudioFormat Format { get ; set ; } = new ( ) ;
157+
158+ [ JsonPropertyName ( "noise_reduction" ) ]
159+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
160+ public InputAudioNoiseReduction ? NoiseReduction { get ; set ; }
161+
162+ [ JsonPropertyName ( "transcription" ) ]
163+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
164+ public InputAudioTranscription ? Transcription { get ; set ; }
165+
166+ [ JsonPropertyName ( "turn_detection" ) ]
167+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
168+ public RealtimeSessionTurnDetection ? TurnDetection { get ; set ; }
169+ }
170+
171+ public class RealtimeAudioConfigOutput
172+ {
173+ [ JsonPropertyName ( "format" ) ]
174+ public RealtimeAudioFormat Format { get ; set ; } = new ( ) ;
175+
176+ [ JsonPropertyName ( "voice" ) ]
177+ public string Voice { get ; set ; } = "alloy" ;
178+
179+ [ JsonPropertyName ( "speed" ) ]
180+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
181+ public float ? Speed { get ; set ; }
182+ }
183+
184+ public class RealtimeAudioFormat
185+ {
186+ [ JsonPropertyName ( "type" ) ]
187+ public string Type { get ; set ; } = null ! ;
188+
189+ [ JsonPropertyName ( "rate" ) ]
190+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
191+ public int ? Rate { get ; set ; }
192+ }
193+
194+ public class RealtimeReasoningConfig
195+ {
196+ /// <summary>
197+ /// "minimal", "low", "medium", "high", "xhigh"
198+ /// </summary>
199+ [ JsonPropertyName ( "effort" ) ]
200+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
201+ public string ? Effort { get ; set ; }
103202}
0 commit comments