4 4
5These are events that the OpenAI Realtime Translation WebSocket server will accept from the client.5These are events that the OpenAI Realtime Translation WebSocket server will accept from the client.
6 6
7<a id="session.update"></a>
8
7## session.update9## session.update
8 10
9Send this event to update the translation session configuration. Translation11Send this event to update the translation session configuration. Translation
14 16
15Schema name: `RealtimeTranslationClientEventSessionUpdate`17Schema name: `RealtimeTranslationClientEventSessionUpdate`
16 18
17```json19- `session: RealtimeTranslationSessionUpdateRequest`
18{20
19 "(resource) realtime > (model) realtime_translation_session_update_event > (schema)": {21 Translation session fields to update. The session `type` and `model` are set
20 "kind": "HttpDeclTypeAlias",22 at creation and cannot be changed with `session.update`.
21 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate",23
22 "docstring": "Send this event to update the translation session configuration. Translation\nsessions support updates to `audio.output.language`, `audio.input.transcription`,\nand `audio.input.noise_reduction`.\n",24 - `audio: optional object { input, output }`
23 "ident": "RealtimeTranslationSessionUpdateEvent",25
24 "type": {26 Configuration for translation input and output audio.
25 "kind": "HttpTypeObject",27
26 "members": [28 - `input: optional object { noise_reduction, transcription }`
27 {29
28 "ident": "session"30 - `noise_reduction: optional object { type } or null`
29 },31
30 {32 Optional input noise reduction. Set to `null` to disable it.
31 "ident": "type"33
32 },34 - `type: NoiseReductionType`
33 {35
34 "ident": "event_id"36 Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.
35 }37
36 ]38 - `"near_field"`
37 },39
38 "childrenParentSchema": "object",40 - `"far_field"`
39 "children": [41
40 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) session",42 - `transcription: optional object { model } or null`
41 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type",43
42 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) event_id"44 Optional source-language transcription. When configured, the server emits
43 ]45 `session.input_transcript.delta` events. Translation itself still runs from
44 },46 the input audio stream.
45 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) session": {47
46 "kind": "HttpDeclProperty",48 - `model: string`
47 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/session",49
48 "deprecated": false,50 The transcription model to use for source transcript deltas.
49 "key": "session",51
50 "docstring": "Translation session fields to update. The session `type` and `model` are set\nat creation and cannot be changed with `session.update`.\n",52 - `output: optional object { language }`
51 "title": "Realtime translation session update",53
52 "type": {54 - `language: optional string`
53 "kind": "HttpTypeReference",55
54 "ident": "RealtimeTranslationSessionUpdateRequest",56 Target language for translated output audio and transcript deltas.
55 "$ref": "(resource) realtime > (model) realtime_translation_session_update_request > (schema)"57
56 },58- `type: "session.update"`
57 "optional": false,59
58 "nullable": false,60 The event type, must be `session.update`.
59 "modelImplicit": false,61
60 "schemaType": "object",62 - `"session.update"`
61 "modelPath": "(resource) realtime > (model) realtime_translation_session_update_request",63
62 "childrenParentSchema": "object",64- `event_id: optional string`
63 "children": [65
64 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio"66 Optional client-generated ID used to identify this event.
65 ]
66 },
67 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type": {
68 "kind": "HttpDeclProperty",
69 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/type",
70 "deprecated": false,
71 "key": "type",
72 "docstring": "The event type, must be `session.update`.",
73 "type": {
74 "kind": "HttpTypeUnion",
75 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/type",
76 "types": [
77 {
78 "kind": "HttpTypeLiteral",
79 "literal": "session.update"
80 }
81 ]
82 },
83 "optional": false,
84 "nullable": false,
85 "schemaType": "enum",
86 "childrenParentSchema": "enum",
87 "children": [
88 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type > (member) 0"
89 ]
90 },
91 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) event_id": {
92 "kind": "HttpDeclProperty",
93 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionUpdate/properties/event_id",
94 "deprecated": false,
95 "key": "event_id",
96 "docstring": "Optional client-generated ID used to identify this event.",
97 "type": {
98 "kind": "HttpTypeString"
99 },
100 "constraints": {
101 "maxLength": 512
102 },
103 "optional": true,
104 "nullable": false,
105 "schemaType": "string",
106 "children": []
107 },
108 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio": {
109 "kind": "HttpDeclProperty",
110 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio",
111 "deprecated": false,
112 "key": "audio",
113 "docstring": "Configuration for translation input and output audio.\n",
114 "type": {
115 "kind": "HttpTypeObject",
116 "members": [
117 {
118 "ident": "input"
119 },
120 {
121 "ident": "output"
122 }
123 ]
124 },
125 "optional": true,
126 "nullable": false,
127 "schemaType": "object",
128 "childrenParentSchema": "object",
129 "children": [
130 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input",
131 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output"
132 ]
133 },
134 "(resource) realtime > (model) realtime_translation_session_update_request > (schema)": {
135 "kind": "HttpDeclTypeAlias",
136 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest",
137 "docstring": "Realtime translation session fields that can be updated with `session.update`.\n",
138 "ident": "RealtimeTranslationSessionUpdateRequest",
139 "type": {
140 "kind": "HttpTypeObject",
141 "members": [
142 {
143 "ident": "audio"
144 }
145 ]
146 },
147 "childrenParentSchema": "object",
148 "children": [
149 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio"
150 ]
151 },
152 "(resource) realtime > (model) realtime_translation_session_update_event > (schema) > (property) type > (member) 0": {
153 "kind": "HttpDeclReference",
154 "type": {
155 "kind": "HttpTypeLiteral",
156 "literal": "session.update"
157 }
158 },
159 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input": {
160 "kind": "HttpDeclProperty",
161 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input",
162 "deprecated": false,
163 "key": "input",
164 "type": {
165 "kind": "HttpTypeObject",
166 "members": [
167 {
168 "ident": "noise_reduction"
169 },
170 {
171 "ident": "transcription"
172 }
173 ]
174 },
175 "optional": true,
176 "nullable": false,
177 "schemaType": "object",
178 "childrenParentSchema": "object",
179 "children": [
180 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction",
181 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription"
182 ]
183 },
184 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output": {
185 "kind": "HttpDeclProperty",
186 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/output",
187 "deprecated": false,
188 "key": "output",
189 "type": {
190 "kind": "HttpTypeObject",
191 "members": [
192 {
193 "ident": "language"
194 }
195 ]
196 },
197 "optional": true,
198 "nullable": false,
199 "schemaType": "object",
200 "childrenParentSchema": "object",
201 "children": [
202 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output > (property) language"
203 ]
204 },
205 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction": {
206 "kind": "HttpDeclProperty",
207 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/noise_reduction",
208 "deprecated": false,
209 "key": "noise_reduction",
210 "docstring": "Optional input noise reduction. Set to `null` to disable it.\n",
211 "type": {
212 "kind": "HttpTypeObject",
213 "members": [
214 {
215 "ident": "type"
216 }
217 ]
218 },
219 "optional": true,
220 "nullable": true,
221 "schemaType": "object",
222 "childrenParentSchema": "object",
223 "children": [
224 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type"
225 ]
226 },
227 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription": {
228 "kind": "HttpDeclProperty",
229 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/transcription",
230 "deprecated": false,
231 "key": "transcription",
232 "docstring": "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n",
233 "type": {
234 "kind": "HttpTypeObject",
235 "members": [
236 {
237 "ident": "model"
238 }
239 ]
240 },
241 "optional": true,
242 "nullable": true,
243 "schemaType": "object",
244 "childrenParentSchema": "object",
245 "children": [
246 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription > (property) model"
247 ]
248 },
249 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) output > (property) language": {
250 "kind": "HttpDeclProperty",
251 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/output/properties/language",
252 "deprecated": false,
253 "key": "language",
254 "docstring": "Target language for translated output audio and transcript deltas.\n",
255 "type": {
256 "kind": "HttpTypeString"
257 },
258 "optional": true,
259 "nullable": false,
260 "schemaType": "string",
261 "children": []
262 },
263 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) noise_reduction > (property) type": {
264 "kind": "HttpDeclProperty",
265 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/noise_reduction/anyOf/0/properties/type",
266 "deprecated": false,
267 "key": "type",
268 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",
269 "type": {
270 "kind": "HttpTypeReference",
271 "ident": "NoiseReductionType",
272 "$ref": "(resource) realtime > (model) noise_reduction_type > (schema)"
273 },
274 "optional": false,
275 "nullable": false,
276 "modelImplicit": false,
277 "schemaType": "enum",
278 "modelPath": "(resource) realtime > (model) noise_reduction_type",
279 "childrenParentSchema": "enum",
280 "children": [
281 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",
282 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"
283 ]
284 },
285 "(resource) realtime > (model) realtime_translation_session_update_request > (schema) > (property) audio > (property) input > (property) transcription > (property) model": {
286 "kind": "HttpDeclProperty",
287 "oasRef": "#/components/schemas/RealtimeTranslationSessionUpdateRequest/properties/audio/properties/input/properties/transcription/anyOf/0/properties/model",
288 "deprecated": false,
289 "key": "model",
290 "docstring": "The transcription model to use for source transcript deltas.",
291 "type": {
292 "kind": "HttpTypeString"
293 },
294 "optional": false,
295 "nullable": false,
296 "schemaType": "string",
297 "children": []
298 },
299 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0": {
300 "kind": "HttpDeclReference",
301 "type": {
302 "kind": "HttpTypeLiteral",
303 "literal": "near_field"
304 }
305 },
306 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1": {
307 "kind": "HttpDeclReference",
308 "type": {
309 "kind": "HttpTypeLiteral",
310 "literal": "far_field"
311 }
312 },
313 "(resource) realtime > (model) noise_reduction_type > (schema)": {
314 "kind": "HttpDeclTypeAlias",
315 "oasRef": "#/components/schemas/NoiseReductionType",
316 "docstring": "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n",
317 "ident": "NoiseReductionType",
318 "type": {
319 "kind": "HttpTypeUnion",
320 "oasRef": "#/components/schemas/NoiseReductionType",
321 "types": [
322 {
323 "kind": "HttpTypeLiteral",
324 "literal": "near_field"
325 },
326 {
327 "kind": "HttpTypeLiteral",
328 "literal": "far_field"
329 }
330 ]
331 },
332 "childrenParentSchema": "enum",
333 "children": [
334 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 0",
335 "(resource) realtime > (model) noise_reduction_type > (schema) > (member) 1"
336 ]
337 }
338}
339```
340 67
341### Example68### Example
342 69
359}86}
360```87```
361 88
89<a id="session.input_audio_buffer.append"></a>
90
362## session.input_audio_buffer.append91## session.input_audio_buffer.append
363 92
364Send this event to append audio bytes to the translation session input audio buffer.93Send this event to append audio bytes to the translation session input audio buffer.
381 110
382Schema name: `RealtimeTranslationClientEventInputAudioBufferAppend`111Schema name: `RealtimeTranslationClientEventInputAudioBufferAppend`
383 112
384```json113- `audio: string`
385{114
386 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema)": {115 Base64-encoded 24 kHz PCM16 mono audio bytes.
387 "kind": "HttpDeclTypeAlias",116
388 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend",117- `type: "session.input_audio_buffer.append"`
389 "docstring": "Send this event to append audio bytes to the translation session input audio buffer.\n\nWebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono\nlittle-endian raw audio bytes. Unsupported websocket audio formats return a\nvalidation error because lower-quality audio materially degrades translation\nquality.\n\nTranslation consumes 200 ms engine frames. For best realtime behavior, append\naudio in 200 ms chunks. If a chunk is shorter, the server buffers it until it\nhas enough audio for one frame. If a chunk is longer, the server splits it into\n200 ms frames and enqueues them back-to-back.\n\nKeep appending silence while the session is active. If a client stops sending\naudio and later resumes, model time treats the resumed audio as contiguous with\nthe previous audio rather than as a real-world pause.\n",118
390 "ident": "RealtimeTranslationInputAudioBufferAppendEvent",119 The event type, must be `session.input_audio_buffer.append`.
391 "type": {120
392 "kind": "HttpTypeObject",121 - `"session.input_audio_buffer.append"`
393 "members": [122
394 {123- `event_id: optional string`
395 "ident": "audio"124
396 },125 Optional client-generated ID used to identify this event.
397 {
398 "ident": "type"
399 },
400 {
401 "ident": "event_id"
402 }
403 ]
404 },
405 "childrenParentSchema": "object",
406 "children": [
407 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) audio",
408 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type",
409 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) event_id"
410 ]
411 },
412 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) audio": {
413 "kind": "HttpDeclProperty",
414 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/audio",
415 "deprecated": false,
416 "key": "audio",
417 "docstring": "Base64-encoded 24 kHz PCM16 mono audio bytes.",
418 "type": {
419 "kind": "HttpTypeString"
420 },
421 "optional": false,
422 "nullable": false,
423 "schemaType": "string",
424 "children": []
425 },
426 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type": {
427 "kind": "HttpDeclProperty",
428 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/type",
429 "deprecated": false,
430 "key": "type",
431 "docstring": "The event type, must be `session.input_audio_buffer.append`.",
432 "type": {
433 "kind": "HttpTypeUnion",
434 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/type",
435 "types": [
436 {
437 "kind": "HttpTypeLiteral",
438 "literal": "session.input_audio_buffer.append"
439 }
440 ]
441 },
442 "optional": false,
443 "nullable": false,
444 "schemaType": "enum",
445 "childrenParentSchema": "enum",
446 "children": [
447 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type > (member) 0"
448 ]
449 },
450 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) event_id": {
451 "kind": "HttpDeclProperty",
452 "oasRef": "#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend/properties/event_id",
453 "deprecated": false,
454 "key": "event_id",
455 "docstring": "Optional client-generated ID used to identify this event.",
456 "type": {
457 "kind": "HttpTypeString"
458 },
459 "constraints": {
460 "maxLength": 512
461 },
462 "optional": true,
463 "nullable": false,
464 "schemaType": "string",
465 "children": []
466 },
467 "(resource) realtime > (model) realtime_translation_input_audio_buffer_append_event > (schema) > (property) type > (member) 0": {
468 "kind": "HttpDeclReference",
469 "type": {
470 "kind": "HttpTypeLiteral",
471 "literal": "session.input_audio_buffer.append"
472 }
473 }
474}
475```
476 126
477### Example127### Example
478 128
484}134}
485```135```
486 136
137<a id="session.close"></a>
138
487## session.close139## session.close
488 140
489Gracefully close the realtime translation session. The server flushes pending141Gracefully close the realtime translation session. The server flushes pending
494 146
495Schema name: `RealtimeTranslationClientEventSessionClose`147Schema name: `RealtimeTranslationClientEventSessionClose`
496 148
497```json149- `type: "session.close"`
498{150
499 "(resource) realtime > (model) realtime_translation_session_close_event > (schema)": {151 The event type, must be `session.close`.
500 "kind": "HttpDeclTypeAlias",152
501 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose",153 - `"session.close"`
502 "docstring": "Gracefully close the realtime translation session. The server flushes pending\ninput audio and emits any remaining translated output before closing the\nsession.\n",154
503 "ident": "RealtimeTranslationSessionCloseEvent",155- `event_id: optional string`
504 "type": {156
505 "kind": "HttpTypeObject",157 Optional client-generated ID used to identify this event.
506 "members": [
507 {
508 "ident": "type"
509 },
510 {
511 "ident": "event_id"
512 }
513 ]
514 },
515 "childrenParentSchema": "object",
516 "children": [
517 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type",
518 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) event_id"
519 ]
520 },
521 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type": {
522 "kind": "HttpDeclProperty",
523 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose/properties/type",
524 "deprecated": false,
525 "key": "type",
526 "docstring": "The event type, must be `session.close`.",
527 "type": {
528 "kind": "HttpTypeUnion",
529 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose/properties/type",
530 "types": [
531 {
532 "kind": "HttpTypeLiteral",
533 "literal": "session.close"
534 }
535 ]
536 },
537 "optional": false,
538 "nullable": false,
539 "schemaType": "enum",
540 "childrenParentSchema": "enum",
541 "children": [
542 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type > (member) 0"
543 ]
544 },
545 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) event_id": {
546 "kind": "HttpDeclProperty",
547 "oasRef": "#/components/schemas/RealtimeTranslationClientEventSessionClose/properties/event_id",
548 "deprecated": false,
549 "key": "event_id",
550 "docstring": "Optional client-generated ID used to identify this event.",
551 "type": {
552 "kind": "HttpTypeString"
553 },
554 "constraints": {
555 "maxLength": 512
556 },
557 "optional": true,
558 "nullable": false,
559 "schemaType": "string",
560 "children": []
561 },
562 "(resource) realtime > (model) realtime_translation_session_close_event > (schema) > (property) type > (member) 0": {
563 "kind": "HttpDeclReference",
564 "type": {
565 "kind": "HttpTypeLiteral",
566 "literal": "session.close"
567 }
568 }
569}
570```
571 158
572### Example159### Example
573 160