go/resources/realtime/subresources/client_secrets/index.md +0 −2884 deleted
File Deleted View Diff
1# Client Secrets
2
3## Create client secret
4
5`client.Realtime.ClientSecrets.New(ctx, body) (*ClientSecretNewResponse, error)`
6
7**post** `/realtime/client_secrets`
8
9Create a Realtime client secret with an associated session configuration.
10
11Client secrets are short-lived tokens that can be passed to a client app,
12such as a web frontend or mobile client, which grants access to the Realtime API without
13leaking your main API key. You can configure a custom TTL for each client secret.
14
15You can also attach session configuration options to the client secret, which will be
16applied to any sessions created using that client secret, but these can also be overridden
17by the client connection.
18
19[Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
20
21Returns the created client secret and the effective session object. The client secret is a string that looks like `ek_1234`.
22
23### Parameters
24
25- `body ClientSecretNewParams`
26
27 - `ExpiresAfter param.Field[ClientSecretNewParamsExpiresAfter]`
28
29 Configuration for the client secret expiration. Expiration refers to the time after which
30 a client secret will no longer be valid for creating sessions. The session itself may
31 continue after that time once started. A secret can be used to create multiple sessions
32 until it expires.
33
34 - `Anchor string`
35
36 The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.
37
38 - `const ClientSecretNewParamsExpiresAfterAnchorCreatedAt ClientSecretNewParamsExpiresAfterAnchor = "created_at"`
39
40 - `Seconds int64`
41
42 The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.
43
44 - `Session param.Field[ClientSecretNewParamsSessionUnion]`
45
46 Session configuration to use for the client secret. Choose either a realtime
47 session or a transcription session.
48
49 - `type RealtimeSessionCreateRequest struct{…}`
50
51 Realtime session object configuration.
52
53 - `Type Realtime`
54
55 The type of session to create. Always `realtime` for the Realtime API.
56
57 - `const RealtimeRealtime Realtime = "realtime"`
58
59 - `Audio RealtimeAudioConfig`
60
61 Configuration for input and output audio.
62
63 - `Input RealtimeAudioConfigInput`
64
65 - `Format RealtimeAudioFormatsUnion`
66
67 The format of the input audio.
68
69 - `type RealtimeAudioFormatsAudioPCM struct{…}`
70
71 The PCM audio format. Only a 24kHz sample rate is supported.
72
73 - `Rate int64`
74
75 The sample rate of the audio. Always `24000`.
76
77 - `const RealtimeAudioFormatsAudioPCMRate24000 RealtimeAudioFormatsAudioPCMRate = 24000`
78
79 - `Type string`
80
81 The audio format. Always `audio/pcm`.
82
83 - `const RealtimeAudioFormatsAudioPCMTypeAudioPCM RealtimeAudioFormatsAudioPCMType = "audio/pcm"`
84
85 - `type RealtimeAudioFormatsAudioPCMU struct{…}`
86
87 The G.711 μ-law format.
88
89 - `Type string`
90
91 The audio format. Always `audio/pcmu`.
92
93 - `const RealtimeAudioFormatsAudioPCMUTypeAudioPCMU RealtimeAudioFormatsAudioPCMUType = "audio/pcmu"`
94
95 - `type RealtimeAudioFormatsAudioPCMA struct{…}`
96
97 The G.711 A-law format.
98
99 - `Type string`
100
101 The audio format. Always `audio/pcma`.
102
103 - `const RealtimeAudioFormatsAudioPCMATypeAudioPCMA RealtimeAudioFormatsAudioPCMAType = "audio/pcma"`
104
105 - `NoiseReduction RealtimeAudioConfigInputNoiseReduction`
106
107 Configuration for input audio noise reduction. This can be set to `null` to turn off.
108 Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.
109 Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
110
111 - `Type NoiseReductionType`
112
113 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.
114
115 - `const NoiseReductionTypeNearField NoiseReductionType = "near_field"`
116
117 - `const NoiseReductionTypeFarField NoiseReductionType = "far_field"`
118
119 - `Transcription AudioTranscription`
120
121 Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.
122
123 - `Delay AudioTranscriptionDelay`
124
125 Controls how long the model waits before emitting transcription text.
126 Higher values can improve transcription accuracy at the cost of latency.
127 Only supported with `gpt-realtime-whisper` in GA Realtime sessions.
128
129 - `const AudioTranscriptionDelayMinimal AudioTranscriptionDelay = "minimal"`
130
131 - `const AudioTranscriptionDelayLow AudioTranscriptionDelay = "low"`
132
133 - `const AudioTranscriptionDelayMedium AudioTranscriptionDelay = "medium"`
134
135 - `const AudioTranscriptionDelayHigh AudioTranscriptionDelay = "high"`
136
137 - `const AudioTranscriptionDelayXhigh AudioTranscriptionDelay = "xhigh"`
138
139 - `Language string`
140
141 The language of the input audio. Supplying the input language in
142 [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format
143 will improve accuracy and latency.
144
145 - `Model AudioTranscriptionModel`
146
147 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
148
149 - `string`
150
151 - `type AudioTranscriptionModel string`
152
153 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
154
155 - `const AudioTranscriptionModelWhisper1 AudioTranscriptionModel = "whisper-1"`
156
157 - `const AudioTranscriptionModelGPT4oMiniTranscribe AudioTranscriptionModel = "gpt-4o-mini-transcribe"`
158
159 - `const AudioTranscriptionModelGPT4oMiniTranscribe2025_12_15 AudioTranscriptionModel = "gpt-4o-mini-transcribe-2025-12-15"`
160
161 - `const AudioTranscriptionModelGPT4oTranscribe AudioTranscriptionModel = "gpt-4o-transcribe"`
162
163 - `const AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize"`
164
165 - `const AudioTranscriptionModelGPTRealtimeWhisper AudioTranscriptionModel = "gpt-realtime-whisper"`
166
167 - `Prompt string`
168
169 An optional text to guide the model's style or continue a previous audio
170 segment.
171 For `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
172 For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example "expect words related to technology".
173 Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.
174
175 - `TurnDetection RealtimeAudioInputTurnDetectionUnion`
176
177 Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.
178
179 Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.
180
181 Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.
182
183 For `gpt-realtime-whisper` transcription sessions, turn detection must be
184 set to `null`; VAD is not supported.
185
186 - `RealtimeAudioInputTurnDetectionServerVad`
187
188 - `Type ServerVad`
189
190 Type of turn detection, `server_vad` to turn on simple Server VAD.
191
192 - `const ServerVadServerVad ServerVad = "server_vad"`
193
194 - `CreateResponse bool`
195
196 Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.
197
198 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
199
200 - `IdleTimeoutMs int64`
201
202 Optional timeout after which a model response will be triggered automatically. This is
203 useful for situations in which a long pause from the user is unexpected, such as a phone
204 call. The model will effectively prompt the user to continue the conversation based
205 on the current context.
206
207 The timeout value will be applied after the last model response's audio has finished playing,
208 i.e. it's set to the `response.done` time plus audio playback duration.
209
210 An `input_audio_buffer.timeout_triggered` event (plus events
211 associated with the Response) will be emitted when the timeout is reached.
212 Idle timeout is currently only supported for `server_vad` mode.
213
214 - `InterruptResponse bool`
215
216 Whether or not to automatically interrupt (cancel) any ongoing response with output to the default
217 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.
218
219 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
220
221 - `PrefixPaddingMs int64`
222
223 Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in
224 milliseconds). Defaults to 300ms.
225
226 - `SilenceDurationMs int64`
227
228 Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults
229 to 500ms. With shorter values the model will respond more quickly,
230 but may jump in on short pauses from the user.
231
232 - `Threshold float64`
233
234 Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
235 higher threshold will require louder audio to activate the model, and
236 thus might perform better in noisy environments.
237
238 - `RealtimeAudioInputTurnDetectionSemanticVad`
239
240 - `Type SemanticVad`
241
242 Type of turn detection, `semantic_vad` to turn on Semantic VAD.
243
244 - `const SemanticVadSemanticVad SemanticVad = "semantic_vad"`
245
246 - `CreateResponse bool`
247
248 Whether or not to automatically generate a response when a VAD stop event occurs.
249
250 - `Eagerness string`
251
252 Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.
253
254 - `const RealtimeAudioInputTurnDetectionSemanticVadEagernessLow RealtimeAudioInputTurnDetectionSemanticVadEagerness = "low"`
255
256 - `const RealtimeAudioInputTurnDetectionSemanticVadEagernessMedium RealtimeAudioInputTurnDetectionSemanticVadEagerness = "medium"`
257
258 - `const RealtimeAudioInputTurnDetectionSemanticVadEagernessHigh RealtimeAudioInputTurnDetectionSemanticVadEagerness = "high"`
259
260 - `const RealtimeAudioInputTurnDetectionSemanticVadEagernessAuto RealtimeAudioInputTurnDetectionSemanticVadEagerness = "auto"`
261
262 - `InterruptResponse bool`
263
264 Whether or not to automatically interrupt any ongoing response with output to the default
265 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.
266
267 - `Output RealtimeAudioConfigOutput`
268
269 - `Format RealtimeAudioFormatsUnion`
270
271 The format of the output audio.
272
273 - `Speed float64`
274
275 The speed of the model's spoken response as a multiple of the original speed.
276 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.
277
278 This parameter is a post-processing adjustment to the audio after it is generated, it's
279 also possible to prompt the model to speak faster or slower.
280
281 - `Voice RealtimeAudioConfigOutputVoiceUnion`
282
283 The voice the model uses to respond. Supported built-in voices are
284 `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,
285 `marin`, and `cedar`. You may also provide a custom voice object with
286 an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed
287 during the session once the model has responded with audio at least once.
288 We recommend `marin` and `cedar` for best quality.
289
290 - `string`
291
292 - `string`
293
294 - `const RealtimeAudioConfigOutputVoiceStringAlloy RealtimeAudioConfigOutputVoiceString = "alloy"`
295
296 - `const RealtimeAudioConfigOutputVoiceStringAsh RealtimeAudioConfigOutputVoiceString = "ash"`
297
298 - `const RealtimeAudioConfigOutputVoiceStringBallad RealtimeAudioConfigOutputVoiceString = "ballad"`
299
300 - `const RealtimeAudioConfigOutputVoiceStringCoral RealtimeAudioConfigOutputVoiceString = "coral"`
301
302 - `const RealtimeAudioConfigOutputVoiceStringEcho RealtimeAudioConfigOutputVoiceString = "echo"`
303
304 - `const RealtimeAudioConfigOutputVoiceStringSage RealtimeAudioConfigOutputVoiceString = "sage"`
305
306 - `const RealtimeAudioConfigOutputVoiceStringShimmer RealtimeAudioConfigOutputVoiceString = "shimmer"`
307
308 - `const RealtimeAudioConfigOutputVoiceStringVerse RealtimeAudioConfigOutputVoiceString = "verse"`
309
310 - `const RealtimeAudioConfigOutputVoiceStringMarin RealtimeAudioConfigOutputVoiceString = "marin"`
311
312 - `const RealtimeAudioConfigOutputVoiceStringCedar RealtimeAudioConfigOutputVoiceString = "cedar"`
313
314 - `RealtimeAudioConfigOutputVoiceID`
315
316 - `ID string`
317
318 The custom voice ID, e.g. `voice_1234`.
319
320 - `Include []string`
321
322 Additional fields to include in server outputs.
323
324 `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
325
326 - `const RealtimeSessionCreateRequestIncludeItemInputAudioTranscriptionLogprobs RealtimeSessionCreateRequestInclude = "item.input_audio_transcription.logprobs"`
327
328 - `Instructions string`
329
330 The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.
331
332 Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.
333
334 - `MaxOutputTokens RealtimeSessionCreateRequestMaxOutputTokensUnion`
335
336 Maximum number of output tokens for a single assistant response,
337 inclusive of tool calls. Provide an integer between 1 and 4096 to
338 limit output tokens, or `inf` for the maximum available tokens for a
339 given model. Defaults to `inf`.
340
341 - `int64`
342
343 - `Inf`
344
345 - `const InfInf Inf = "inf"`
346
347 - `Model RealtimeSessionCreateRequestModel`
348
349 The Realtime model used for this session.
350
351 - `string`
352
353 - `RealtimeSessionCreateRequestModel`
354
355 - `const RealtimeSessionCreateRequestModelGPTRealtime RealtimeSessionCreateRequestModel = "gpt-realtime"`
356
357 - `const RealtimeSessionCreateRequestModelGPTRealtime1_5 RealtimeSessionCreateRequestModel = "gpt-realtime-1.5"`
358
359 - `const RealtimeSessionCreateRequestModelGPTRealtime2 RealtimeSessionCreateRequestModel = "gpt-realtime-2"`
360
361 - `const RealtimeSessionCreateRequestModelGPTRealtime2025_08_28 RealtimeSessionCreateRequestModel = "gpt-realtime-2025-08-28"`
362
363 - `const RealtimeSessionCreateRequestModelGPT4oRealtimePreview RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview"`
364
365 - `const RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-10-01"`
366
367 - `const RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_12_17 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-12-17"`
368
369 - `const RealtimeSessionCreateRequestModelGPT4oRealtimePreview2025_06_03 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2025-06-03"`
370
371 - `const RealtimeSessionCreateRequestModelGPT4oMiniRealtimePreview RealtimeSessionCreateRequestModel = "gpt-4o-mini-realtime-preview"`
372
373 - `const RealtimeSessionCreateRequestModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateRequestModel = "gpt-4o-mini-realtime-preview-2024-12-17"`
374
375 - `const RealtimeSessionCreateRequestModelGPTRealtimeMini RealtimeSessionCreateRequestModel = "gpt-realtime-mini"`
376
377 - `const RealtimeSessionCreateRequestModelGPTRealtimeMini2025_10_06 RealtimeSessionCreateRequestModel = "gpt-realtime-mini-2025-10-06"`
378
379 - `const RealtimeSessionCreateRequestModelGPTRealtimeMini2025_12_15 RealtimeSessionCreateRequestModel = "gpt-realtime-mini-2025-12-15"`
380
381 - `const RealtimeSessionCreateRequestModelGPTAudio1_5 RealtimeSessionCreateRequestModel = "gpt-audio-1.5"`
382
383 - `const RealtimeSessionCreateRequestModelGPTAudioMini RealtimeSessionCreateRequestModel = "gpt-audio-mini"`
384
385 - `const RealtimeSessionCreateRequestModelGPTAudioMini2025_10_06 RealtimeSessionCreateRequestModel = "gpt-audio-mini-2025-10-06"`
386
387 - `const RealtimeSessionCreateRequestModelGPTAudioMini2025_12_15 RealtimeSessionCreateRequestModel = "gpt-audio-mini-2025-12-15"`
388
389 - `OutputModalities []string`
390
391 The set of modalities the model can respond with. It defaults to `["audio"]`, indicating
392 that the model will respond with audio plus a transcript. `["text"]` can be used to make
393 the model respond with text only. It is not possible to request both `text` and `audio` at the same time.
394
395 - `const RealtimeSessionCreateRequestOutputModalityText RealtimeSessionCreateRequestOutputModality = "text"`
396
397 - `const RealtimeSessionCreateRequestOutputModalityAudio RealtimeSessionCreateRequestOutputModality = "audio"`
398
399 - `ParallelToolCalls bool`
400
401 Whether the model may call multiple tools in parallel. Only supported by
402 reasoning Realtime models such as `gpt-realtime-2`.
403
404 - `Prompt ResponsePrompt`
405
406 Reference to a prompt template and its variables.
407 [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
408
409 - `ID string`
410
411 The unique identifier of the prompt template to use.
412
413 - `Variables map[string, ResponsePromptVariableUnion]`
414
415 Optional map of values to substitute in for variables in your
416 prompt. The substitution values can either be strings, or other
417 Response input types like images or files.
418
419 - `string`
420
421 - `type ResponseInputText struct{…}`
422
423 A text input to the model.
424
425 - `Text string`
426
427 The text input to the model.
428
429 - `Type InputText`
430
431 The type of the input item. Always `input_text`.
432
433 - `const InputTextInputText InputText = "input_text"`
434
435 - `type ResponseInputImage struct{…}`
436
437 An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
438
439 - `Detail ResponseInputImageDetail`
440
441 The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.
442
443 - `const ResponseInputImageDetailLow ResponseInputImageDetail = "low"`
444
445 - `const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"`
446
447 - `const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"`
448
449 - `const ResponseInputImageDetailOriginal ResponseInputImageDetail = "original"`
450
451 - `Type InputImage`
452
453 The type of the input item. Always `input_image`.
454
455 - `const InputImageInputImage InputImage = "input_image"`
456
457 - `FileID string`
458
459 The ID of the file to be sent to the model.
460
461 - `ImageURL string`
462
463 The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
464
465 - `type ResponseInputFile struct{…}`
466
467 A file input to the model.
468
469 - `Type InputFile`
470
471 The type of the input item. Always `input_file`.
472
473 - `const InputFileInputFile InputFile = "input_file"`
474
475 - `Detail ResponseInputFileDetail`
476
477 The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`.
478
479 - `const ResponseInputFileDetailLow ResponseInputFileDetail = "low"`
480
481 - `const ResponseInputFileDetailHigh ResponseInputFileDetail = "high"`
482
483 - `FileData string`
484
485 The content of the file to be sent to the model.
486
487 - `FileID string`
488
489 The ID of the file to be sent to the model.
490
491 - `FileURL string`
492
493 The URL of the file to be sent to the model.
494
495 - `Filename string`
496
497 The name of the file to be sent to the model.
498
499 - `Version string`
500
501 Optional version of the prompt template.
502
503 - `Reasoning RealtimeReasoning`
504
505 Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
506
507 - `Effort RealtimeReasoningEffort`
508
509 Constrains effort on reasoning for reasoning-capable Realtime models such as
510 `gpt-realtime-2`.
511
512 - `const RealtimeReasoningEffortMinimal RealtimeReasoningEffort = "minimal"`
513
514 - `const RealtimeReasoningEffortLow RealtimeReasoningEffort = "low"`
515
516 - `const RealtimeReasoningEffortMedium RealtimeReasoningEffort = "medium"`
517
518 - `const RealtimeReasoningEffortHigh RealtimeReasoningEffort = "high"`
519
520 - `const RealtimeReasoningEffortXhigh RealtimeReasoningEffort = "xhigh"`
521
522 - `ToolChoice RealtimeToolChoiceConfigUnion`
523
524 How the model chooses tools. Provide one of the string modes or force a specific
525 function/MCP tool.
526
527 - `type ToolChoiceOptions string`
528
529 Controls which (if any) tool is called by the model.
530
531 `none` means the model will not call any tool and instead generates a message.
532
533 `auto` means the model can pick between generating a message or calling one or
534 more tools.
535
536 `required` means the model must call one or more tools.
537
538 - `const ToolChoiceOptionsNone ToolChoiceOptions = "none"`
539
540 - `const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"`
541
542 - `const ToolChoiceOptionsRequired ToolChoiceOptions = "required"`
543
544 - `type ToolChoiceFunction struct{…}`
545
546 Use this option to force the model to call a specific function.
547
548 - `Name string`
549
550 The name of the function to call.
551
552 - `Type Function`
553
554 For function calling, the type is always `function`.
555
556 - `const FunctionFunction Function = "function"`
557
558 - `type ToolChoiceMcp struct{…}`
559
560 Use this option to force the model to call a specific tool on a remote MCP server.
561
562 - `ServerLabel string`
563
564 The label of the MCP server to use.
565
566 - `Type Mcp`
567
568 For MCP tools, the type is always `mcp`.
569
570 - `const McpMcp Mcp = "mcp"`
571
572 - `Name string`
573
574 The name of the tool to call on the server.
575
576 - `Tools RealtimeToolsConfig`
577
578 Tools available to the model.
579
580 - `type RealtimeFunctionTool struct{…}`
581
582 - `Description string`
583
584 The description of the function, including guidance on when and how
585 to call it, and guidance about what to tell the user when calling
586 (if anything).
587
588 - `Name string`
589
590 The name of the function.
591
592 - `Parameters any`
593
594 Parameters of the function in JSON Schema.
595
596 - `Type RealtimeFunctionToolType`
597
598 The type of the tool, i.e. `function`.
599
600 - `const RealtimeFunctionToolTypeFunction RealtimeFunctionToolType = "function"`
601
602 - `RealtimeToolsConfigUnionMcp`
603
604 - `ServerLabel string`
605
606 A label for this MCP server, used to identify it in tool calls.
607
608 - `Type Mcp`
609
610 The type of the MCP tool. Always `mcp`.
611
612 - `const McpMcp Mcp = "mcp"`
613
614 - `AllowedTools RealtimeToolsConfigUnionMcpAllowedTools`
615
616 List of allowed tool names or a filter object.
617
618 - `[]string`
619
620 - `RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilter`
621
622 - `ReadOnly bool`
623
624 Indicates whether or not a tool modifies data or is read-only. If an
625 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
626 it will match this filter.
627
628 - `ToolNames []string`
629
630 List of allowed tool names.
631
632 - `Authorization string`
633
634 An OAuth access token that can be used with a remote MCP server, either
635 with a custom MCP server URL or a service connector. Your application
636 must handle the OAuth authorization flow and provide the token here.
637
638 - `ConnectorID string`
639
640 Identifier for service connectors, like those available in ChatGPT. One of
641 `server_url` or `connector_id` must be provided. Learn more about service
642 connectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
643
644 Currently supported `connector_id` values are:
645
646 - Dropbox: `connector_dropbox`
647 - Gmail: `connector_gmail`
648 - Google Calendar: `connector_googlecalendar`
649 - Google Drive: `connector_googledrive`
650 - Microsoft Teams: `connector_microsoftteams`
651 - Outlook Calendar: `connector_outlookcalendar`
652 - Outlook Email: `connector_outlookemail`
653 - SharePoint: `connector_sharepoint`
654
655 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorDropbox RealtimeToolsConfigUnionMcpConnectorID = "connector_dropbox"`
656
657 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorGmail RealtimeToolsConfigUnionMcpConnectorID = "connector_gmail"`
658
659 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorGooglecalendar RealtimeToolsConfigUnionMcpConnectorID = "connector_googlecalendar"`
660
661 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorGoogledrive RealtimeToolsConfigUnionMcpConnectorID = "connector_googledrive"`
662
663 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorMicrosoftteams RealtimeToolsConfigUnionMcpConnectorID = "connector_microsoftteams"`
664
665 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorOutlookcalendar RealtimeToolsConfigUnionMcpConnectorID = "connector_outlookcalendar"`
666
667 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorOutlookemail RealtimeToolsConfigUnionMcpConnectorID = "connector_outlookemail"`
668
669 - `const RealtimeToolsConfigUnionMcpConnectorIDConnectorSharepoint RealtimeToolsConfigUnionMcpConnectorID = "connector_sharepoint"`
670
671 - `DeferLoading bool`
672
673 Whether this MCP tool is deferred and discovered via tool search.
674
675 - `Headers map[string, string]`
676
677 Optional HTTP headers to send to the MCP server. Use for authentication
678 or other purposes.
679
680 - `RequireApproval RealtimeToolsConfigUnionMcpRequireApproval`
681
682 Specify which of the MCP server's tools require approval.
683
684 - `RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilter`
685
686 - `Always RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlways`
687
688 A filter object to specify which tools are allowed.
689
690 - `ReadOnly bool`
691
692 Indicates whether or not a tool modifies data or is read-only. If an
693 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
694 it will match this filter.
695
696 - `ToolNames []string`
697
698 List of allowed tool names.
699
700 - `Never RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNever`
701
702 A filter object to specify which tools are allowed.
703
704 - `ReadOnly bool`
705
706 Indicates whether or not a tool modifies data or is read-only. If an
707 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
708 it will match this filter.
709
710 - `ToolNames []string`
711
712 List of allowed tool names.
713
714 - `string`
715
716 - `const RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSettingAlways RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting = "always"`
717
718 - `const RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSettingNever RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting = "never"`
719
720 - `ServerDescription string`
721
722 Optional description of the MCP server, used to provide more context.
723
724 - `ServerURL string`
725
726 The URL for the MCP server. One of `server_url` or `connector_id` must be
727 provided.
728
729 - `Tracing RealtimeTracingConfigUnion`
730
731 Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once
732 tracing is enabled for a session, the configuration cannot be modified.
733
734 `auto` will create a trace for the session with default values for the
735 workflow name, group id, and metadata.
736
737 - `Auto`
738
739 - `const AutoAuto Auto = "auto"`
740
741 - `RealtimeTracingConfigTracingConfiguration`
742
743 - `GroupID string`
744
745 The group id to attach to this trace to enable filtering and
746 grouping in the Traces Dashboard.
747
748 - `Metadata any`
749
750 The arbitrary metadata to attach to this trace to enable
751 filtering in the Traces Dashboard.
752
753 - `WorkflowName string`
754
755 The name of the workflow to attach to this trace. This is used to
756 name the trace in the Traces Dashboard.
757
758 - `Truncation RealtimeTruncationUnion`
759
760 When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.
761
762 Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.
763
764 Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.
765
766 Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.
767
768 - `type RealtimeTruncationRealtimeTruncationStrategy string`
769
770 The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.
771
772 - `const RealtimeTruncationRealtimeTruncationStrategyAuto RealtimeTruncationRealtimeTruncationStrategy = "auto"`
773
774 - `const RealtimeTruncationRealtimeTruncationStrategyDisabled RealtimeTruncationRealtimeTruncationStrategy = "disabled"`
775
776 - `type RealtimeTruncationRetentionRatio struct{…}`
777
778 Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.
779
780 - `RetentionRatio float64`
781
782 Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.
783
784 - `Type RetentionRatio`
785
786 Use retention ratio truncation.
787
788 - `const RetentionRatioRetentionRatio RetentionRatio = "retention_ratio"`
789
790 - `TokenLimits RealtimeTruncationRetentionRatioTokenLimits`
791
792 Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used.
793
794 - `PostInstructions int64`
795
796 Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens.
797
798 - `type RealtimeTranscriptionSessionCreateRequest struct{…}`
799
800 Realtime transcription session object configuration.
801
802 - `Type Transcription`
803
804 The type of session to create. Always `transcription` for transcription sessions.
805
806 - `const TranscriptionTranscription Transcription = "transcription"`
807
808 - `Audio RealtimeTranscriptionSessionAudio`
809
810 Configuration for input and output audio.
811
812 - `Input RealtimeTranscriptionSessionAudioInput`
813
814 - `Format RealtimeAudioFormatsUnion`
815
816 The PCM audio format. Only a 24kHz sample rate is supported.
817
818 - `NoiseReduction RealtimeTranscriptionSessionAudioInputNoiseReduction`
819
820 Configuration for input audio noise reduction. This can be set to `null` to turn off.
821 Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.
822 Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
823
824 - `Type NoiseReductionType`
825
826 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.
827
828 - `Transcription AudioTranscription`
829
830 Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.
831
832 - `TurnDetection RealtimeTranscriptionSessionAudioInputTurnDetectionUnion`
833
834 Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.
835
836 Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.
837
838 Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.
839
840 For `gpt-realtime-whisper` transcription sessions, turn detection must be
841 set to `null`; VAD is not supported.
842
843 - `RealtimeTranscriptionSessionAudioInputTurnDetectionServerVad`
844
845 - `Type ServerVad`
846
847 Type of turn detection, `server_vad` to turn on simple Server VAD.
848
849 - `const ServerVadServerVad ServerVad = "server_vad"`
850
851 - `CreateResponse bool`
852
853 Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.
854
855 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
856
857 - `IdleTimeoutMs int64`
858
859 Optional timeout after which a model response will be triggered automatically. This is
860 useful for situations in which a long pause from the user is unexpected, such as a phone
861 call. The model will effectively prompt the user to continue the conversation based
862 on the current context.
863
864 The timeout value will be applied after the last model response's audio has finished playing,
865 i.e. it's set to the `response.done` time plus audio playback duration.
866
867 An `input_audio_buffer.timeout_triggered` event (plus events
868 associated with the Response) will be emitted when the timeout is reached.
869 Idle timeout is currently only supported for `server_vad` mode.
870
871 - `InterruptResponse bool`
872
873 Whether or not to automatically interrupt (cancel) any ongoing response with output to the default
874 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.
875
876 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
877
878 - `PrefixPaddingMs int64`
879
880 Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in
881 milliseconds). Defaults to 300ms.
882
883 - `SilenceDurationMs int64`
884
885 Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults
886 to 500ms. With shorter values the model will respond more quickly,
887 but may jump in on short pauses from the user.
888
889 - `Threshold float64`
890
891 Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
892 higher threshold will require louder audio to activate the model, and
893 thus might perform better in noisy environments.
894
895 - `RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVad`
896
897 - `Type SemanticVad`
898
899 Type of turn detection, `semantic_vad` to turn on Semantic VAD.
900
901 - `const SemanticVadSemanticVad SemanticVad = "semantic_vad"`
902
903 - `CreateResponse bool`
904
905 Whether or not to automatically generate a response when a VAD stop event occurs.
906
907 - `Eagerness string`
908
909 Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.
910
911 - `const RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagernessLow RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagerness = "low"`
912
913 - `const RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagernessMedium RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagerness = "medium"`
914
915 - `const RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagernessHigh RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagerness = "high"`
916
917 - `const RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagernessAuto RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadEagerness = "auto"`
918
919 - `InterruptResponse bool`
920
921 Whether or not to automatically interrupt any ongoing response with output to the default
922 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.
923
924 - `Include []string`
925
926 Additional fields to include in server outputs.
927
928 `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
929
930 - `const RealtimeTranscriptionSessionCreateRequestIncludeItemInputAudioTranscriptionLogprobs RealtimeTranscriptionSessionCreateRequestInclude = "item.input_audio_transcription.logprobs"`
931
932### Returns
933
934- `type ClientSecretNewResponse struct{…}`
935
936 Response from creating a session and client secret for the Realtime API.
937
938 - `ExpiresAt int64`
939
940 Expiration timestamp for the client secret, in seconds since epoch.
941
942 - `Session ClientSecretNewResponseSessionUnion`
943
944 The session configuration for either a realtime or transcription session.
945
946 - `type RealtimeSessionCreateResponse struct{…}`
947
948 A Realtime session configuration object.
949
950 - `ID string`
951
952 Unique identifier for the session that looks like `sess_1234567890abcdef`.
953
954 - `Object RealtimeSession`
955
956 The object type. Always `realtime.session`.
957
958 - `const RealtimeSessionRealtimeSession RealtimeSession = "realtime.session"`
959
960 - `Type Realtime`
961
962 The type of session to create. Always `realtime` for the Realtime API.
963
964 - `const RealtimeRealtime Realtime = "realtime"`
965
966 - `Audio RealtimeSessionCreateResponseAudio`
967
968 Configuration for input and output audio.
969
970 - `Input RealtimeSessionCreateResponseAudioInput`
971
972 - `Format RealtimeAudioFormatsUnion`
973
974 The format of the input audio.
975
976 - `type RealtimeAudioFormatsAudioPCM struct{…}`
977
978 The PCM audio format. Only a 24kHz sample rate is supported.
979
980 - `Rate int64`
981
982 The sample rate of the audio. Always `24000`.
983
984 - `const RealtimeAudioFormatsAudioPCMRate24000 RealtimeAudioFormatsAudioPCMRate = 24000`
985
986 - `Type string`
987
988 The audio format. Always `audio/pcm`.
989
990 - `const RealtimeAudioFormatsAudioPCMTypeAudioPCM RealtimeAudioFormatsAudioPCMType = "audio/pcm"`
991
992 - `type RealtimeAudioFormatsAudioPCMU struct{…}`
993
994 The G.711 μ-law format.
995
996 - `Type string`
997
998 The audio format. Always `audio/pcmu`.
999
1000 - `const RealtimeAudioFormatsAudioPCMUTypeAudioPCMU RealtimeAudioFormatsAudioPCMUType = "audio/pcmu"`
1001
1002 - `type RealtimeAudioFormatsAudioPCMA struct{…}`
1003
1004 The G.711 A-law format.
1005
1006 - `Type string`
1007
1008 The audio format. Always `audio/pcma`.
1009
1010 - `const RealtimeAudioFormatsAudioPCMATypeAudioPCMA RealtimeAudioFormatsAudioPCMAType = "audio/pcma"`
1011
1012 - `NoiseReduction RealtimeSessionCreateResponseAudioInputNoiseReduction`
1013
1014 Configuration for input audio noise reduction. This can be set to `null` to turn off.
1015 Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.
1016 Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
1017
1018 - `Type NoiseReductionType`
1019
1020 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.
1021
1022 - `const NoiseReductionTypeNearField NoiseReductionType = "near_field"`
1023
1024 - `const NoiseReductionTypeFarField NoiseReductionType = "far_field"`
1025
1026 - `Transcription AudioTranscription`
1027
1028 - `Delay AudioTranscriptionDelay`
1029
1030 Controls how long the model waits before emitting transcription text.
1031 Higher values can improve transcription accuracy at the cost of latency.
1032 Only supported with `gpt-realtime-whisper` in GA Realtime sessions.
1033
1034 - `const AudioTranscriptionDelayMinimal AudioTranscriptionDelay = "minimal"`
1035
1036 - `const AudioTranscriptionDelayLow AudioTranscriptionDelay = "low"`
1037
1038 - `const AudioTranscriptionDelayMedium AudioTranscriptionDelay = "medium"`
1039
1040 - `const AudioTranscriptionDelayHigh AudioTranscriptionDelay = "high"`
1041
1042 - `const AudioTranscriptionDelayXhigh AudioTranscriptionDelay = "xhigh"`
1043
1044 - `Language string`
1045
1046 The language of the input audio. Supplying the input language in
1047 [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format
1048 will improve accuracy and latency.
1049
1050 - `Model AudioTranscriptionModel`
1051
1052 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
1053
1054 - `string`
1055
1056 - `type AudioTranscriptionModel string`
1057
1058 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
1059
1060 - `const AudioTranscriptionModelWhisper1 AudioTranscriptionModel = "whisper-1"`
1061
1062 - `const AudioTranscriptionModelGPT4oMiniTranscribe AudioTranscriptionModel = "gpt-4o-mini-transcribe"`
1063
1064 - `const AudioTranscriptionModelGPT4oMiniTranscribe2025_12_15 AudioTranscriptionModel = "gpt-4o-mini-transcribe-2025-12-15"`
1065
1066 - `const AudioTranscriptionModelGPT4oTranscribe AudioTranscriptionModel = "gpt-4o-transcribe"`
1067
1068 - `const AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize"`
1069
1070 - `const AudioTranscriptionModelGPTRealtimeWhisper AudioTranscriptionModel = "gpt-realtime-whisper"`
1071
1072 - `Prompt string`
1073
1074 An optional text to guide the model's style or continue a previous audio
1075 segment.
1076 For `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
1077 For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example "expect words related to technology".
1078 Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.
1079
1080 - `TurnDetection RealtimeSessionCreateResponseAudioInputTurnDetectionUnion`
1081
1082 Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.
1083
1084 Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.
1085
1086 Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.
1087
1088 For `gpt-realtime-whisper` transcription sessions, turn detection must be
1089 set to `null`; VAD is not supported.
1090
1091 - `type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad struct{…}`
1092
1093 Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
1094
1095 - `Type ServerVad`
1096
1097 Type of turn detection, `server_vad` to turn on simple Server VAD.
1098
1099 - `const ServerVadServerVad ServerVad = "server_vad"`
1100
1101 - `CreateResponse bool`
1102
1103 Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.
1104
1105 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
1106
1107 - `IdleTimeoutMs int64`
1108
1109 Optional timeout after which a model response will be triggered automatically. This is
1110 useful for situations in which a long pause from the user is unexpected, such as a phone
1111 call. The model will effectively prompt the user to continue the conversation based
1112 on the current context.
1113
1114 The timeout value will be applied after the last model response's audio has finished playing,
1115 i.e. it's set to the `response.done` time plus audio playback duration.
1116
1117 An `input_audio_buffer.timeout_triggered` event (plus events
1118 associated with the Response) will be emitted when the timeout is reached.
1119 Idle timeout is currently only supported for `server_vad` mode.
1120
1121 - `InterruptResponse bool`
1122
1123 Whether or not to automatically interrupt (cancel) any ongoing response with output to the default
1124 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.
1125
1126 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
1127
1128 - `PrefixPaddingMs int64`
1129
1130 Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in
1131 milliseconds). Defaults to 300ms.
1132
1133 - `SilenceDurationMs int64`
1134
1135 Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults
1136 to 500ms. With shorter values the model will respond more quickly,
1137 but may jump in on short pauses from the user.
1138
1139 - `Threshold float64`
1140
1141 Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
1142 higher threshold will require louder audio to activate the model, and
1143 thus might perform better in noisy environments.
1144
1145 - `type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad struct{…}`
1146
1147 Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
1148
1149 - `Type SemanticVad`
1150
1151 Type of turn detection, `semantic_vad` to turn on Semantic VAD.
1152
1153 - `const SemanticVadSemanticVad SemanticVad = "semantic_vad"`
1154
1155 - `CreateResponse bool`
1156
1157 Whether or not to automatically generate a response when a VAD stop event occurs.
1158
1159 - `Eagerness string`
1160
1161 Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.
1162
1163 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessLow RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "low"`
1164
1165 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessMedium RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "medium"`
1166
1167 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessHigh RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "high"`
1168
1169 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessAuto RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "auto"`
1170
1171 - `InterruptResponse bool`
1172
1173 Whether or not to automatically interrupt any ongoing response with output to the default
1174 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.
1175
1176 - `Output RealtimeSessionCreateResponseAudioOutput`
1177
1178 - `Format RealtimeAudioFormatsUnion`
1179
1180 The format of the output audio.
1181
1182 - `Speed float64`
1183
1184 The speed of the model's spoken response as a multiple of the original speed.
1185 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.
1186
1187 This parameter is a post-processing adjustment to the audio after it is generated, it's
1188 also possible to prompt the model to speak faster or slower.
1189
1190 - `Voice string`
1191
1192 The voice the model uses to respond. Voice cannot be changed during the
1193 session once the model has responded with audio at least once. Current
1194 voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,
1195 `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for
1196 best quality.
1197
1198 - `string`
1199
1200 - `string`
1201
1202 - `const RealtimeSessionCreateResponseAudioOutputVoiceAlloy RealtimeSessionCreateResponseAudioOutputVoice = "alloy"`
1203
1204 - `const RealtimeSessionCreateResponseAudioOutputVoiceAsh RealtimeSessionCreateResponseAudioOutputVoice = "ash"`
1205
1206 - `const RealtimeSessionCreateResponseAudioOutputVoiceBallad RealtimeSessionCreateResponseAudioOutputVoice = "ballad"`
1207
1208 - `const RealtimeSessionCreateResponseAudioOutputVoiceCoral RealtimeSessionCreateResponseAudioOutputVoice = "coral"`
1209
1210 - `const RealtimeSessionCreateResponseAudioOutputVoiceEcho RealtimeSessionCreateResponseAudioOutputVoice = "echo"`
1211
1212 - `const RealtimeSessionCreateResponseAudioOutputVoiceSage RealtimeSessionCreateResponseAudioOutputVoice = "sage"`
1213
1214 - `const RealtimeSessionCreateResponseAudioOutputVoiceShimmer RealtimeSessionCreateResponseAudioOutputVoice = "shimmer"`
1215
1216 - `const RealtimeSessionCreateResponseAudioOutputVoiceVerse RealtimeSessionCreateResponseAudioOutputVoice = "verse"`
1217
1218 - `const RealtimeSessionCreateResponseAudioOutputVoiceMarin RealtimeSessionCreateResponseAudioOutputVoice = "marin"`
1219
1220 - `const RealtimeSessionCreateResponseAudioOutputVoiceCedar RealtimeSessionCreateResponseAudioOutputVoice = "cedar"`
1221
1222 - `ExpiresAt int64`
1223
1224 Expiration timestamp for the session, in seconds since epoch.
1225
1226 - `Include []string`
1227
1228 Additional fields to include in server outputs.
1229
1230 `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
1231
1232 - `const RealtimeSessionCreateResponseIncludeItemInputAudioTranscriptionLogprobs RealtimeSessionCreateResponseInclude = "item.input_audio_transcription.logprobs"`
1233
1234 - `Instructions string`
1235
1236 The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.
1237
1238 Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.
1239
1240 - `MaxOutputTokens RealtimeSessionCreateResponseMaxOutputTokensUnion`
1241
1242 Maximum number of output tokens for a single assistant response,
1243 inclusive of tool calls. Provide an integer between 1 and 4096 to
1244 limit output tokens, or `inf` for the maximum available tokens for a
1245 given model. Defaults to `inf`.
1246
1247 - `int64`
1248
1249 - `type Inf string`
1250
1251 - `const InfInf Inf = "inf"`
1252
1253 - `Model RealtimeSessionCreateResponseModel`
1254
1255 The Realtime model used for this session.
1256
1257 - `string`
1258
1259 - `type RealtimeSessionCreateResponseModel string`
1260
1261 The Realtime model used for this session.
1262
1263 - `const RealtimeSessionCreateResponseModelGPTRealtime RealtimeSessionCreateResponseModel = "gpt-realtime"`
1264
1265 - `const RealtimeSessionCreateResponseModelGPTRealtime1_5 RealtimeSessionCreateResponseModel = "gpt-realtime-1.5"`
1266
1267 - `const RealtimeSessionCreateResponseModelGPTRealtime2 RealtimeSessionCreateResponseModel = "gpt-realtime-2"`
1268
1269 - `const RealtimeSessionCreateResponseModelGPTRealtime2025_08_28 RealtimeSessionCreateResponseModel = "gpt-realtime-2025-08-28"`
1270
1271 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview"`
1272
1273 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-10-01"`
1274
1275 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-12-17"`
1276
1277 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview2025_06_03 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2025-06-03"`
1278
1279 - `const RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview"`
1280
1281 - `const RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview-2024-12-17"`
1282
1283 - `const RealtimeSessionCreateResponseModelGPTRealtimeMini RealtimeSessionCreateResponseModel = "gpt-realtime-mini"`
1284
1285 - `const RealtimeSessionCreateResponseModelGPTRealtimeMini2025_10_06 RealtimeSessionCreateResponseModel = "gpt-realtime-mini-2025-10-06"`
1286
1287 - `const RealtimeSessionCreateResponseModelGPTRealtimeMini2025_12_15 RealtimeSessionCreateResponseModel = "gpt-realtime-mini-2025-12-15"`
1288
1289 - `const RealtimeSessionCreateResponseModelGPTAudio1_5 RealtimeSessionCreateResponseModel = "gpt-audio-1.5"`
1290
1291 - `const RealtimeSessionCreateResponseModelGPTAudioMini RealtimeSessionCreateResponseModel = "gpt-audio-mini"`
1292
1293 - `const RealtimeSessionCreateResponseModelGPTAudioMini2025_10_06 RealtimeSessionCreateResponseModel = "gpt-audio-mini-2025-10-06"`
1294
1295 - `const RealtimeSessionCreateResponseModelGPTAudioMini2025_12_15 RealtimeSessionCreateResponseModel = "gpt-audio-mini-2025-12-15"`
1296
1297 - `OutputModalities []string`
1298
1299 The set of modalities the model can respond with. It defaults to `["audio"]`, indicating
1300 that the model will respond with audio plus a transcript. `["text"]` can be used to make
1301 the model respond with text only. It is not possible to request both `text` and `audio` at the same time.
1302
1303 - `const RealtimeSessionCreateResponseOutputModalityText RealtimeSessionCreateResponseOutputModality = "text"`
1304
1305 - `const RealtimeSessionCreateResponseOutputModalityAudio RealtimeSessionCreateResponseOutputModality = "audio"`
1306
1307 - `Prompt ResponsePrompt`
1308
1309 Reference to a prompt template and its variables.
1310 [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
1311
1312 - `ID string`
1313
1314 The unique identifier of the prompt template to use.
1315
1316 - `Variables map[string, ResponsePromptVariableUnion]`
1317
1318 Optional map of values to substitute in for variables in your
1319 prompt. The substitution values can either be strings, or other
1320 Response input types like images or files.
1321
1322 - `string`
1323
1324 - `type ResponseInputText struct{…}`
1325
1326 A text input to the model.
1327
1328 - `Text string`
1329
1330 The text input to the model.
1331
1332 - `Type InputText`
1333
1334 The type of the input item. Always `input_text`.
1335
1336 - `const InputTextInputText InputText = "input_text"`
1337
1338 - `type ResponseInputImage struct{…}`
1339
1340 An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
1341
1342 - `Detail ResponseInputImageDetail`
1343
1344 The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.
1345
1346 - `const ResponseInputImageDetailLow ResponseInputImageDetail = "low"`
1347
1348 - `const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"`
1349
1350 - `const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"`
1351
1352 - `const ResponseInputImageDetailOriginal ResponseInputImageDetail = "original"`
1353
1354 - `Type InputImage`
1355
1356 The type of the input item. Always `input_image`.
1357
1358 - `const InputImageInputImage InputImage = "input_image"`
1359
1360 - `FileID string`
1361
1362 The ID of the file to be sent to the model.
1363
1364 - `ImageURL string`
1365
1366 The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
1367
1368 - `type ResponseInputFile struct{…}`
1369
1370 A file input to the model.
1371
1372 - `Type InputFile`
1373
1374 The type of the input item. Always `input_file`.
1375
1376 - `const InputFileInputFile InputFile = "input_file"`
1377
1378 - `Detail ResponseInputFileDetail`
1379
1380 The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`.
1381
1382 - `const ResponseInputFileDetailLow ResponseInputFileDetail = "low"`
1383
1384 - `const ResponseInputFileDetailHigh ResponseInputFileDetail = "high"`
1385
1386 - `FileData string`
1387
1388 The content of the file to be sent to the model.
1389
1390 - `FileID string`
1391
1392 The ID of the file to be sent to the model.
1393
1394 - `FileURL string`
1395
1396 The URL of the file to be sent to the model.
1397
1398 - `Filename string`
1399
1400 The name of the file to be sent to the model.
1401
1402 - `Version string`
1403
1404 Optional version of the prompt template.
1405
1406 - `Reasoning RealtimeReasoning`
1407
1408 Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
1409
1410 - `Effort RealtimeReasoningEffort`
1411
1412 Constrains effort on reasoning for reasoning-capable Realtime models such as
1413 `gpt-realtime-2`.
1414
1415 - `const RealtimeReasoningEffortMinimal RealtimeReasoningEffort = "minimal"`
1416
1417 - `const RealtimeReasoningEffortLow RealtimeReasoningEffort = "low"`
1418
1419 - `const RealtimeReasoningEffortMedium RealtimeReasoningEffort = "medium"`
1420
1421 - `const RealtimeReasoningEffortHigh RealtimeReasoningEffort = "high"`
1422
1423 - `const RealtimeReasoningEffortXhigh RealtimeReasoningEffort = "xhigh"`
1424
1425 - `ToolChoice RealtimeSessionCreateResponseToolChoiceUnion`
1426
1427 How the model chooses tools. Provide one of the string modes or force a specific
1428 function/MCP tool.
1429
1430 - `type ToolChoiceOptions string`
1431
1432 Controls which (if any) tool is called by the model.
1433
1434 `none` means the model will not call any tool and instead generates a message.
1435
1436 `auto` means the model can pick between generating a message or calling one or
1437 more tools.
1438
1439 `required` means the model must call one or more tools.
1440
1441 - `const ToolChoiceOptionsNone ToolChoiceOptions = "none"`
1442
1443 - `const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"`
1444
1445 - `const ToolChoiceOptionsRequired ToolChoiceOptions = "required"`
1446
1447 - `type ToolChoiceFunction struct{…}`
1448
1449 Use this option to force the model to call a specific function.
1450
1451 - `Name string`
1452
1453 The name of the function to call.
1454
1455 - `Type Function`
1456
1457 For function calling, the type is always `function`.
1458
1459 - `const FunctionFunction Function = "function"`
1460
1461 - `type ToolChoiceMcp struct{…}`
1462
1463 Use this option to force the model to call a specific tool on a remote MCP server.
1464
1465 - `ServerLabel string`
1466
1467 The label of the MCP server to use.
1468
1469 - `Type Mcp`
1470
1471 For MCP tools, the type is always `mcp`.
1472
1473 - `const McpMcp Mcp = "mcp"`
1474
1475 - `Name string`
1476
1477 The name of the tool to call on the server.
1478
1479 - `Tools []RealtimeSessionCreateResponseToolUnion`
1480
1481 Tools available to the model.
1482
1483 - `type RealtimeFunctionTool struct{…}`
1484
1485 - `Description string`
1486
1487 The description of the function, including guidance on when and how
1488 to call it, and guidance about what to tell the user when calling
1489 (if anything).
1490
1491 - `Name string`
1492
1493 The name of the function.
1494
1495 - `Parameters any`
1496
1497 Parameters of the function in JSON Schema.
1498
1499 - `Type RealtimeFunctionToolType`
1500
1501 The type of the tool, i.e. `function`.
1502
1503 - `const RealtimeFunctionToolTypeFunction RealtimeFunctionToolType = "function"`
1504
1505 - `type RealtimeSessionCreateResponseToolMcpTool struct{…}`
1506
1507 Give the model access to additional tools via remote Model Context Protocol
1508 (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
1509
1510 - `ServerLabel string`
1511
1512 A label for this MCP server, used to identify it in tool calls.
1513
1514 - `Type Mcp`
1515
1516 The type of the MCP tool. Always `mcp`.
1517
1518 - `const McpMcp Mcp = "mcp"`
1519
1520 - `AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion`
1521
1522 List of allowed tool names or a filter object.
1523
1524 - `type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpAllowedTools []string`
1525
1526 A string array of allowed tool names
1527
1528 - `type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter struct{…}`
1529
1530 A filter object to specify which tools are allowed.
1531
1532 - `ReadOnly bool`
1533
1534 Indicates whether or not a tool modifies data or is read-only. If an
1535 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
1536 it will match this filter.
1537
1538 - `ToolNames []string`
1539
1540 List of allowed tool names.
1541
1542 - `Authorization string`
1543
1544 An OAuth access token that can be used with a remote MCP server, either
1545 with a custom MCP server URL or a service connector. Your application
1546 must handle the OAuth authorization flow and provide the token here.
1547
1548 - `ConnectorID string`
1549
1550 Identifier for service connectors, like those available in ChatGPT. One of
1551 `server_url` or `connector_id` must be provided. Learn more about service
1552 connectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
1553
1554 Currently supported `connector_id` values are:
1555
1556 - Dropbox: `connector_dropbox`
1557 - Gmail: `connector_gmail`
1558 - Google Calendar: `connector_googlecalendar`
1559 - Google Drive: `connector_googledrive`
1560 - Microsoft Teams: `connector_microsoftteams`
1561 - Outlook Calendar: `connector_outlookcalendar`
1562 - Outlook Email: `connector_outlookemail`
1563 - SharePoint: `connector_sharepoint`
1564
1565 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorDropbox RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_dropbox"`
1566
1567 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorGmail RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_gmail"`
1568
1569 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorGooglecalendar RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_googlecalendar"`
1570
1571 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorGoogledrive RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_googledrive"`
1572
1573 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorMicrosoftteams RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_microsoftteams"`
1574
1575 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorOutlookcalendar RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_outlookcalendar"`
1576
1577 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorOutlookemail RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_outlookemail"`
1578
1579 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorSharepoint RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_sharepoint"`
1580
1581 - `DeferLoading bool`
1582
1583 Whether this MCP tool is deferred and discovered via tool search.
1584
1585 - `Headers map[string, string]`
1586
1587 Optional HTTP headers to send to the MCP server. Use for authentication
1588 or other purposes.
1589
1590 - `RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion`
1591
1592 Specify which of the MCP server's tools require approval.
1593
1594 - `type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter struct{…}`
1595
1596 Specify which of the MCP server's tools require approval. Can be
1597 `always`, `never`, or a filter object associated with tools
1598 that require approval.
1599
1600 - `Always RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways`
1601
1602 A filter object to specify which tools are allowed.
1603
1604 - `ReadOnly bool`
1605
1606 Indicates whether or not a tool modifies data or is read-only. If an
1607 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
1608 it will match this filter.
1609
1610 - `ToolNames []string`
1611
1612 List of allowed tool names.
1613
1614 - `Never RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever`
1615
1616 A filter object to specify which tools are allowed.
1617
1618 - `ReadOnly bool`
1619
1620 Indicates whether or not a tool modifies data or is read-only. If an
1621 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
1622 it will match this filter.
1623
1624 - `ToolNames []string`
1625
1626 List of allowed tool names.
1627
1628 - `type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting string`
1629
1630 Specify a single approval policy for all tools. One of `always` or
1631 `never`. When set to `always`, all tools will require approval. When
1632 set to `never`, all tools will not require approval.
1633
1634 - `const RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingAlways RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "always"`
1635
1636 - `const RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingNever RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "never"`
1637
1638 - `ServerDescription string`
1639
1640 Optional description of the MCP server, used to provide more context.
1641
1642 - `ServerURL string`
1643
1644 The URL for the MCP server. One of `server_url` or `connector_id` must be
1645 provided.
1646
1647 - `Tracing RealtimeSessionCreateResponseTracingUnion`
1648
1649 Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once
1650 tracing is enabled for a session, the configuration cannot be modified.
1651
1652 `auto` will create a trace for the session with default values for the
1653 workflow name, group id, and metadata.
1654
1655 - `type Auto string`
1656
1657 Enables tracing and sets default values for tracing configuration options. Always `auto`.
1658
1659 - `const AutoAuto Auto = "auto"`
1660
1661 - `type RealtimeSessionCreateResponseTracingTracingConfiguration struct{…}`
1662
1663 Granular configuration for tracing.
1664
1665 - `GroupID string`
1666
1667 The group id to attach to this trace to enable filtering and
1668 grouping in the Traces Dashboard.
1669
1670 - `Metadata any`
1671
1672 The arbitrary metadata to attach to this trace to enable
1673 filtering in the Traces Dashboard.
1674
1675 - `WorkflowName string`
1676
1677 The name of the workflow to attach to this trace. This is used to
1678 name the trace in the Traces Dashboard.
1679
1680 - `Truncation RealtimeTruncationUnion`
1681
1682 When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.
1683
1684 Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.
1685
1686 Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.
1687
1688 Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.
1689
1690 - `type RealtimeTruncationRealtimeTruncationStrategy string`
1691
1692 The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.
1693
1694 - `const RealtimeTruncationRealtimeTruncationStrategyAuto RealtimeTruncationRealtimeTruncationStrategy = "auto"`
1695
1696 - `const RealtimeTruncationRealtimeTruncationStrategyDisabled RealtimeTruncationRealtimeTruncationStrategy = "disabled"`
1697
1698 - `type RealtimeTruncationRetentionRatio struct{…}`
1699
1700 Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.
1701
1702 - `RetentionRatio float64`
1703
1704 Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.
1705
1706 - `Type RetentionRatio`
1707
1708 Use retention ratio truncation.
1709
1710 - `const RetentionRatioRetentionRatio RetentionRatio = "retention_ratio"`
1711
1712 - `TokenLimits RealtimeTruncationRetentionRatioTokenLimits`
1713
1714 Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used.
1715
1716 - `PostInstructions int64`
1717
1718 Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens.
1719
1720 - `type RealtimeTranscriptionSessionCreateResponse struct{…}`
1721
1722 A Realtime transcription session configuration object.
1723
1724 - `ID string`
1725
1726 Unique identifier for the session that looks like `sess_1234567890abcdef`.
1727
1728 - `Object string`
1729
1730 The object type. Always `realtime.transcription_session`.
1731
1732 - `Type Transcription`
1733
1734 The type of session. Always `transcription` for transcription sessions.
1735
1736 - `const TranscriptionTranscription Transcription = "transcription"`
1737
1738 - `Audio RealtimeTranscriptionSessionCreateResponseAudio`
1739
1740 Configuration for input audio for the session.
1741
1742 - `Input RealtimeTranscriptionSessionCreateResponseAudioInput`
1743
1744 - `Format RealtimeAudioFormatsUnion`
1745
1746 The PCM audio format. Only a 24kHz sample rate is supported.
1747
1748 - `NoiseReduction RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction`
1749
1750 Configuration for input audio noise reduction.
1751
1752 - `Type NoiseReductionType`
1753
1754 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.
1755
1756 - `Transcription AudioTranscription`
1757
1758 - `TurnDetection RealtimeTranscriptionSessionTurnDetection`
1759
1760 Configuration for turn detection. Can be set to `null` to turn off. Server
1761 VAD means that the model will detect the start and end of speech based on
1762 audio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.
1763
1764 - `PrefixPaddingMs int64`
1765
1766 Amount of audio to include before the VAD detected speech (in
1767 milliseconds). Defaults to 300ms.
1768
1769 - `SilenceDurationMs int64`
1770
1771 Duration of silence to detect speech stop (in milliseconds). Defaults
1772 to 500ms. With shorter values the model will respond more quickly,
1773 but may jump in on short pauses from the user.
1774
1775 - `Threshold float64`
1776
1777 Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
1778 higher threshold will require louder audio to activate the model, and
1779 thus might perform better in noisy environments.
1780
1781 - `Type string`
1782
1783 Type of turn detection, only `server_vad` is currently supported.
1784
1785 - `ExpiresAt int64`
1786
1787 Expiration timestamp for the session, in seconds since epoch.
1788
1789 - `Include []string`
1790
1791 Additional fields to include in server outputs.
1792
1793 - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
1794
1795 - `const RealtimeTranscriptionSessionCreateResponseIncludeItemInputAudioTranscriptionLogprobs RealtimeTranscriptionSessionCreateResponseInclude = "item.input_audio_transcription.logprobs"`
1796
1797 - `Value string`
1798
1799 The generated client secret value.
1800
1801### Example
1802
1803```go
1804package main
1805
1806import (
1807 "context"
1808 "fmt"
1809
1810 "github.com/openai/openai-go"
1811 "github.com/openai/openai-go/option"
1812 "github.com/openai/openai-go/realtime"
1813)
1814
1815func main() {
1816 client := openai.NewClient(
1817 option.WithAPIKey("My API Key"),
1818 )
1819 clientSecret, err := client.Realtime.ClientSecrets.New(context.TODO(), realtime.ClientSecretNewParams{
1820
1821 })
1822 if err != nil {
1823 panic(err.Error())
1824 }
1825 fmt.Printf("%+v\n", clientSecret.ExpiresAt)
1826}
1827```
1828
1829#### Response
1830
1831```json
1832{
1833 "expires_at": 0,
1834 "session": {
1835 "id": "id",
1836 "object": "realtime.session",
1837 "type": "realtime",
1838 "audio": {
1839 "input": {
1840 "format": {
1841 "rate": 24000,
1842 "type": "audio/pcm"
1843 },
1844 "noise_reduction": {
1845 "type": "near_field"
1846 },
1847 "transcription": {
1848 "delay": "minimal",
1849 "language": "language",
1850 "model": "string",
1851 "prompt": "prompt"
1852 },
1853 "turn_detection": {
1854 "type": "server_vad",
1855 "create_response": true,
1856 "idle_timeout_ms": 5000,
1857 "interrupt_response": true,
1858 "prefix_padding_ms": 0,
1859 "silence_duration_ms": 0,
1860 "threshold": 0
1861 }
1862 },
1863 "output": {
1864 "format": {
1865 "rate": 24000,
1866 "type": "audio/pcm"
1867 },
1868 "speed": 0.25,
1869 "voice": "ash"
1870 }
1871 },
1872 "expires_at": 0,
1873 "include": [
1874 "item.input_audio_transcription.logprobs"
1875 ],
1876 "instructions": "instructions",
1877 "max_output_tokens": 0,
1878 "model": "string",
1879 "output_modalities": [
1880 "text"
1881 ],
1882 "prompt": {
1883 "id": "id",
1884 "variables": {
1885 "foo": "string"
1886 },
1887 "version": "version"
1888 },
1889 "reasoning": {
1890 "effort": "minimal"
1891 },
1892 "tool_choice": "none",
1893 "tools": [
1894 {
1895 "description": "description",
1896 "name": "name",
1897 "parameters": {},
1898 "type": "function"
1899 }
1900 ],
1901 "tracing": "auto",
1902 "truncation": "auto"
1903 },
1904 "value": "value"
1905}
1906```
1907
1908## Domain Types
1909
1910### Realtime Session Create Response
1911
1912- `type RealtimeSessionCreateResponse struct{…}`
1913
1914 A Realtime session configuration object.
1915
1916 - `ID string`
1917
1918 Unique identifier for the session that looks like `sess_1234567890abcdef`.
1919
1920 - `Object RealtimeSession`
1921
1922 The object type. Always `realtime.session`.
1923
1924 - `const RealtimeSessionRealtimeSession RealtimeSession = "realtime.session"`
1925
1926 - `Type Realtime`
1927
1928 The type of session to create. Always `realtime` for the Realtime API.
1929
1930 - `const RealtimeRealtime Realtime = "realtime"`
1931
1932 - `Audio RealtimeSessionCreateResponseAudio`
1933
1934 Configuration for input and output audio.
1935
1936 - `Input RealtimeSessionCreateResponseAudioInput`
1937
1938 - `Format RealtimeAudioFormatsUnion`
1939
1940 The format of the input audio.
1941
1942 - `type RealtimeAudioFormatsAudioPCM struct{…}`
1943
1944 The PCM audio format. Only a 24kHz sample rate is supported.
1945
1946 - `Rate int64`
1947
1948 The sample rate of the audio. Always `24000`.
1949
1950 - `const RealtimeAudioFormatsAudioPCMRate24000 RealtimeAudioFormatsAudioPCMRate = 24000`
1951
1952 - `Type string`
1953
1954 The audio format. Always `audio/pcm`.
1955
1956 - `const RealtimeAudioFormatsAudioPCMTypeAudioPCM RealtimeAudioFormatsAudioPCMType = "audio/pcm"`
1957
1958 - `type RealtimeAudioFormatsAudioPCMU struct{…}`
1959
1960 The G.711 μ-law format.
1961
1962 - `Type string`
1963
1964 The audio format. Always `audio/pcmu`.
1965
1966 - `const RealtimeAudioFormatsAudioPCMUTypeAudioPCMU RealtimeAudioFormatsAudioPCMUType = "audio/pcmu"`
1967
1968 - `type RealtimeAudioFormatsAudioPCMA struct{…}`
1969
1970 The G.711 A-law format.
1971
1972 - `Type string`
1973
1974 The audio format. Always `audio/pcma`.
1975
1976 - `const RealtimeAudioFormatsAudioPCMATypeAudioPCMA RealtimeAudioFormatsAudioPCMAType = "audio/pcma"`
1977
1978 - `NoiseReduction RealtimeSessionCreateResponseAudioInputNoiseReduction`
1979
1980 Configuration for input audio noise reduction. This can be set to `null` to turn off.
1981 Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.
1982 Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
1983
1984 - `Type NoiseReductionType`
1985
1986 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.
1987
1988 - `const NoiseReductionTypeNearField NoiseReductionType = "near_field"`
1989
1990 - `const NoiseReductionTypeFarField NoiseReductionType = "far_field"`
1991
1992 - `Transcription AudioTranscription`
1993
1994 - `Delay AudioTranscriptionDelay`
1995
1996 Controls how long the model waits before emitting transcription text.
1997 Higher values can improve transcription accuracy at the cost of latency.
1998 Only supported with `gpt-realtime-whisper` in GA Realtime sessions.
1999
2000 - `const AudioTranscriptionDelayMinimal AudioTranscriptionDelay = "minimal"`
2001
2002 - `const AudioTranscriptionDelayLow AudioTranscriptionDelay = "low"`
2003
2004 - `const AudioTranscriptionDelayMedium AudioTranscriptionDelay = "medium"`
2005
2006 - `const AudioTranscriptionDelayHigh AudioTranscriptionDelay = "high"`
2007
2008 - `const AudioTranscriptionDelayXhigh AudioTranscriptionDelay = "xhigh"`
2009
2010 - `Language string`
2011
2012 The language of the input audio. Supplying the input language in
2013 [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format
2014 will improve accuracy and latency.
2015
2016 - `Model AudioTranscriptionModel`
2017
2018 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
2019
2020 - `string`
2021
2022 - `type AudioTranscriptionModel string`
2023
2024 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
2025
2026 - `const AudioTranscriptionModelWhisper1 AudioTranscriptionModel = "whisper-1"`
2027
2028 - `const AudioTranscriptionModelGPT4oMiniTranscribe AudioTranscriptionModel = "gpt-4o-mini-transcribe"`
2029
2030 - `const AudioTranscriptionModelGPT4oMiniTranscribe2025_12_15 AudioTranscriptionModel = "gpt-4o-mini-transcribe-2025-12-15"`
2031
2032 - `const AudioTranscriptionModelGPT4oTranscribe AudioTranscriptionModel = "gpt-4o-transcribe"`
2033
2034 - `const AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize"`
2035
2036 - `const AudioTranscriptionModelGPTRealtimeWhisper AudioTranscriptionModel = "gpt-realtime-whisper"`
2037
2038 - `Prompt string`
2039
2040 An optional text to guide the model's style or continue a previous audio
2041 segment.
2042 For `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
2043 For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example "expect words related to technology".
2044 Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.
2045
2046 - `TurnDetection RealtimeSessionCreateResponseAudioInputTurnDetectionUnion`
2047
2048 Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.
2049
2050 Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.
2051
2052 Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.
2053
2054 For `gpt-realtime-whisper` transcription sessions, turn detection must be
2055 set to `null`; VAD is not supported.
2056
2057 - `type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad struct{…}`
2058
2059 Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
2060
2061 - `Type ServerVad`
2062
2063 Type of turn detection, `server_vad` to turn on simple Server VAD.
2064
2065 - `const ServerVadServerVad ServerVad = "server_vad"`
2066
2067 - `CreateResponse bool`
2068
2069 Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.
2070
2071 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
2072
2073 - `IdleTimeoutMs int64`
2074
2075 Optional timeout after which a model response will be triggered automatically. This is
2076 useful for situations in which a long pause from the user is unexpected, such as a phone
2077 call. The model will effectively prompt the user to continue the conversation based
2078 on the current context.
2079
2080 The timeout value will be applied after the last model response's audio has finished playing,
2081 i.e. it's set to the `response.done` time plus audio playback duration.
2082
2083 An `input_audio_buffer.timeout_triggered` event (plus events
2084 associated with the Response) will be emitted when the timeout is reached.
2085 Idle timeout is currently only supported for `server_vad` mode.
2086
2087 - `InterruptResponse bool`
2088
2089 Whether or not to automatically interrupt (cancel) any ongoing response with output to the default
2090 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.
2091
2092 If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.
2093
2094 - `PrefixPaddingMs int64`
2095
2096 Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in
2097 milliseconds). Defaults to 300ms.
2098
2099 - `SilenceDurationMs int64`
2100
2101 Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults
2102 to 500ms. With shorter values the model will respond more quickly,
2103 but may jump in on short pauses from the user.
2104
2105 - `Threshold float64`
2106
2107 Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
2108 higher threshold will require louder audio to activate the model, and
2109 thus might perform better in noisy environments.
2110
2111 - `type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad struct{…}`
2112
2113 Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
2114
2115 - `Type SemanticVad`
2116
2117 Type of turn detection, `semantic_vad` to turn on Semantic VAD.
2118
2119 - `const SemanticVadSemanticVad SemanticVad = "semantic_vad"`
2120
2121 - `CreateResponse bool`
2122
2123 Whether or not to automatically generate a response when a VAD stop event occurs.
2124
2125 - `Eagerness string`
2126
2127 Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.
2128
2129 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessLow RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "low"`
2130
2131 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessMedium RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "medium"`
2132
2133 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessHigh RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "high"`
2134
2135 - `const RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagernessAuto RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVadEagerness = "auto"`
2136
2137 - `InterruptResponse bool`
2138
2139 Whether or not to automatically interrupt any ongoing response with output to the default
2140 conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.
2141
2142 - `Output RealtimeSessionCreateResponseAudioOutput`
2143
2144 - `Format RealtimeAudioFormatsUnion`
2145
2146 The format of the output audio.
2147
2148 - `Speed float64`
2149
2150 The speed of the model's spoken response as a multiple of the original speed.
2151 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.
2152
2153 This parameter is a post-processing adjustment to the audio after it is generated, it's
2154 also possible to prompt the model to speak faster or slower.
2155
2156 - `Voice string`
2157
2158 The voice the model uses to respond. Voice cannot be changed during the
2159 session once the model has responded with audio at least once. Current
2160 voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,
2161 `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for
2162 best quality.
2163
2164 - `string`
2165
2166 - `string`
2167
2168 - `const RealtimeSessionCreateResponseAudioOutputVoiceAlloy RealtimeSessionCreateResponseAudioOutputVoice = "alloy"`
2169
2170 - `const RealtimeSessionCreateResponseAudioOutputVoiceAsh RealtimeSessionCreateResponseAudioOutputVoice = "ash"`
2171
2172 - `const RealtimeSessionCreateResponseAudioOutputVoiceBallad RealtimeSessionCreateResponseAudioOutputVoice = "ballad"`
2173
2174 - `const RealtimeSessionCreateResponseAudioOutputVoiceCoral RealtimeSessionCreateResponseAudioOutputVoice = "coral"`
2175
2176 - `const RealtimeSessionCreateResponseAudioOutputVoiceEcho RealtimeSessionCreateResponseAudioOutputVoice = "echo"`
2177
2178 - `const RealtimeSessionCreateResponseAudioOutputVoiceSage RealtimeSessionCreateResponseAudioOutputVoice = "sage"`
2179
2180 - `const RealtimeSessionCreateResponseAudioOutputVoiceShimmer RealtimeSessionCreateResponseAudioOutputVoice = "shimmer"`
2181
2182 - `const RealtimeSessionCreateResponseAudioOutputVoiceVerse RealtimeSessionCreateResponseAudioOutputVoice = "verse"`
2183
2184 - `const RealtimeSessionCreateResponseAudioOutputVoiceMarin RealtimeSessionCreateResponseAudioOutputVoice = "marin"`
2185
2186 - `const RealtimeSessionCreateResponseAudioOutputVoiceCedar RealtimeSessionCreateResponseAudioOutputVoice = "cedar"`
2187
2188 - `ExpiresAt int64`
2189
2190 Expiration timestamp for the session, in seconds since epoch.
2191
2192 - `Include []string`
2193
2194 Additional fields to include in server outputs.
2195
2196 `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
2197
2198 - `const RealtimeSessionCreateResponseIncludeItemInputAudioTranscriptionLogprobs RealtimeSessionCreateResponseInclude = "item.input_audio_transcription.logprobs"`
2199
2200 - `Instructions string`
2201
2202 The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.
2203
2204 Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.
2205
2206 - `MaxOutputTokens RealtimeSessionCreateResponseMaxOutputTokensUnion`
2207
2208 Maximum number of output tokens for a single assistant response,
2209 inclusive of tool calls. Provide an integer between 1 and 4096 to
2210 limit output tokens, or `inf` for the maximum available tokens for a
2211 given model. Defaults to `inf`.
2212
2213 - `int64`
2214
2215 - `type Inf string`
2216
2217 - `const InfInf Inf = "inf"`
2218
2219 - `Model RealtimeSessionCreateResponseModel`
2220
2221 The Realtime model used for this session.
2222
2223 - `string`
2224
2225 - `type RealtimeSessionCreateResponseModel string`
2226
2227 The Realtime model used for this session.
2228
2229 - `const RealtimeSessionCreateResponseModelGPTRealtime RealtimeSessionCreateResponseModel = "gpt-realtime"`
2230
2231 - `const RealtimeSessionCreateResponseModelGPTRealtime1_5 RealtimeSessionCreateResponseModel = "gpt-realtime-1.5"`
2232
2233 - `const RealtimeSessionCreateResponseModelGPTRealtime2 RealtimeSessionCreateResponseModel = "gpt-realtime-2"`
2234
2235 - `const RealtimeSessionCreateResponseModelGPTRealtime2025_08_28 RealtimeSessionCreateResponseModel = "gpt-realtime-2025-08-28"`
2236
2237 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview"`
2238
2239 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-10-01"`
2240
2241 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-12-17"`
2242
2243 - `const RealtimeSessionCreateResponseModelGPT4oRealtimePreview2025_06_03 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2025-06-03"`
2244
2245 - `const RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview"`
2246
2247 - `const RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview-2024-12-17"`
2248
2249 - `const RealtimeSessionCreateResponseModelGPTRealtimeMini RealtimeSessionCreateResponseModel = "gpt-realtime-mini"`
2250
2251 - `const RealtimeSessionCreateResponseModelGPTRealtimeMini2025_10_06 RealtimeSessionCreateResponseModel = "gpt-realtime-mini-2025-10-06"`
2252
2253 - `const RealtimeSessionCreateResponseModelGPTRealtimeMini2025_12_15 RealtimeSessionCreateResponseModel = "gpt-realtime-mini-2025-12-15"`
2254
2255 - `const RealtimeSessionCreateResponseModelGPTAudio1_5 RealtimeSessionCreateResponseModel = "gpt-audio-1.5"`
2256
2257 - `const RealtimeSessionCreateResponseModelGPTAudioMini RealtimeSessionCreateResponseModel = "gpt-audio-mini"`
2258
2259 - `const RealtimeSessionCreateResponseModelGPTAudioMini2025_10_06 RealtimeSessionCreateResponseModel = "gpt-audio-mini-2025-10-06"`
2260
2261 - `const RealtimeSessionCreateResponseModelGPTAudioMini2025_12_15 RealtimeSessionCreateResponseModel = "gpt-audio-mini-2025-12-15"`
2262
2263 - `OutputModalities []string`
2264
2265 The set of modalities the model can respond with. It defaults to `["audio"]`, indicating
2266 that the model will respond with audio plus a transcript. `["text"]` can be used to make
2267 the model respond with text only. It is not possible to request both `text` and `audio` at the same time.
2268
2269 - `const RealtimeSessionCreateResponseOutputModalityText RealtimeSessionCreateResponseOutputModality = "text"`
2270
2271 - `const RealtimeSessionCreateResponseOutputModalityAudio RealtimeSessionCreateResponseOutputModality = "audio"`
2272
2273 - `Prompt ResponsePrompt`
2274
2275 Reference to a prompt template and its variables.
2276 [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
2277
2278 - `ID string`
2279
2280 The unique identifier of the prompt template to use.
2281
2282 - `Variables map[string, ResponsePromptVariableUnion]`
2283
2284 Optional map of values to substitute in for variables in your
2285 prompt. The substitution values can either be strings, or other
2286 Response input types like images or files.
2287
2288 - `string`
2289
2290 - `type ResponseInputText struct{…}`
2291
2292 A text input to the model.
2293
2294 - `Text string`
2295
2296 The text input to the model.
2297
2298 - `Type InputText`
2299
2300 The type of the input item. Always `input_text`.
2301
2302 - `const InputTextInputText InputText = "input_text"`
2303
2304 - `type ResponseInputImage struct{…}`
2305
2306 An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
2307
2308 - `Detail ResponseInputImageDetail`
2309
2310 The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.
2311
2312 - `const ResponseInputImageDetailLow ResponseInputImageDetail = "low"`
2313
2314 - `const ResponseInputImageDetailHigh ResponseInputImageDetail = "high"`
2315
2316 - `const ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"`
2317
2318 - `const ResponseInputImageDetailOriginal ResponseInputImageDetail = "original"`
2319
2320 - `Type InputImage`
2321
2322 The type of the input item. Always `input_image`.
2323
2324 - `const InputImageInputImage InputImage = "input_image"`
2325
2326 - `FileID string`
2327
2328 The ID of the file to be sent to the model.
2329
2330 - `ImageURL string`
2331
2332 The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.
2333
2334 - `type ResponseInputFile struct{…}`
2335
2336 A file input to the model.
2337
2338 - `Type InputFile`
2339
2340 The type of the input item. Always `input_file`.
2341
2342 - `const InputFileInputFile InputFile = "input_file"`
2343
2344 - `Detail ResponseInputFileDetail`
2345
2346 The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`.
2347
2348 - `const ResponseInputFileDetailLow ResponseInputFileDetail = "low"`
2349
2350 - `const ResponseInputFileDetailHigh ResponseInputFileDetail = "high"`
2351
2352 - `FileData string`
2353
2354 The content of the file to be sent to the model.
2355
2356 - `FileID string`
2357
2358 The ID of the file to be sent to the model.
2359
2360 - `FileURL string`
2361
2362 The URL of the file to be sent to the model.
2363
2364 - `Filename string`
2365
2366 The name of the file to be sent to the model.
2367
2368 - `Version string`
2369
2370 Optional version of the prompt template.
2371
2372 - `Reasoning RealtimeReasoning`
2373
2374 Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
2375
2376 - `Effort RealtimeReasoningEffort`
2377
2378 Constrains effort on reasoning for reasoning-capable Realtime models such as
2379 `gpt-realtime-2`.
2380
2381 - `const RealtimeReasoningEffortMinimal RealtimeReasoningEffort = "minimal"`
2382
2383 - `const RealtimeReasoningEffortLow RealtimeReasoningEffort = "low"`
2384
2385 - `const RealtimeReasoningEffortMedium RealtimeReasoningEffort = "medium"`
2386
2387 - `const RealtimeReasoningEffortHigh RealtimeReasoningEffort = "high"`
2388
2389 - `const RealtimeReasoningEffortXhigh RealtimeReasoningEffort = "xhigh"`
2390
2391 - `ToolChoice RealtimeSessionCreateResponseToolChoiceUnion`
2392
2393 How the model chooses tools. Provide one of the string modes or force a specific
2394 function/MCP tool.
2395
2396 - `type ToolChoiceOptions string`
2397
2398 Controls which (if any) tool is called by the model.
2399
2400 `none` means the model will not call any tool and instead generates a message.
2401
2402 `auto` means the model can pick between generating a message or calling one or
2403 more tools.
2404
2405 `required` means the model must call one or more tools.
2406
2407 - `const ToolChoiceOptionsNone ToolChoiceOptions = "none"`
2408
2409 - `const ToolChoiceOptionsAuto ToolChoiceOptions = "auto"`
2410
2411 - `const ToolChoiceOptionsRequired ToolChoiceOptions = "required"`
2412
2413 - `type ToolChoiceFunction struct{…}`
2414
2415 Use this option to force the model to call a specific function.
2416
2417 - `Name string`
2418
2419 The name of the function to call.
2420
2421 - `Type Function`
2422
2423 For function calling, the type is always `function`.
2424
2425 - `const FunctionFunction Function = "function"`
2426
2427 - `type ToolChoiceMcp struct{…}`
2428
2429 Use this option to force the model to call a specific tool on a remote MCP server.
2430
2431 - `ServerLabel string`
2432
2433 The label of the MCP server to use.
2434
2435 - `Type Mcp`
2436
2437 For MCP tools, the type is always `mcp`.
2438
2439 - `const McpMcp Mcp = "mcp"`
2440
2441 - `Name string`
2442
2443 The name of the tool to call on the server.
2444
2445 - `Tools []RealtimeSessionCreateResponseToolUnion`
2446
2447 Tools available to the model.
2448
2449 - `type RealtimeFunctionTool struct{…}`
2450
2451 - `Description string`
2452
2453 The description of the function, including guidance on when and how
2454 to call it, and guidance about what to tell the user when calling
2455 (if anything).
2456
2457 - `Name string`
2458
2459 The name of the function.
2460
2461 - `Parameters any`
2462
2463 Parameters of the function in JSON Schema.
2464
2465 - `Type RealtimeFunctionToolType`
2466
2467 The type of the tool, i.e. `function`.
2468
2469 - `const RealtimeFunctionToolTypeFunction RealtimeFunctionToolType = "function"`
2470
2471 - `type RealtimeSessionCreateResponseToolMcpTool struct{…}`
2472
2473 Give the model access to additional tools via remote Model Context Protocol
2474 (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
2475
2476 - `ServerLabel string`
2477
2478 A label for this MCP server, used to identify it in tool calls.
2479
2480 - `Type Mcp`
2481
2482 The type of the MCP tool. Always `mcp`.
2483
2484 - `const McpMcp Mcp = "mcp"`
2485
2486 - `AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion`
2487
2488 List of allowed tool names or a filter object.
2489
2490 - `type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpAllowedTools []string`
2491
2492 A string array of allowed tool names
2493
2494 - `type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter struct{…}`
2495
2496 A filter object to specify which tools are allowed.
2497
2498 - `ReadOnly bool`
2499
2500 Indicates whether or not a tool modifies data or is read-only. If an
2501 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
2502 it will match this filter.
2503
2504 - `ToolNames []string`
2505
2506 List of allowed tool names.
2507
2508 - `Authorization string`
2509
2510 An OAuth access token that can be used with a remote MCP server, either
2511 with a custom MCP server URL or a service connector. Your application
2512 must handle the OAuth authorization flow and provide the token here.
2513
2514 - `ConnectorID string`
2515
2516 Identifier for service connectors, like those available in ChatGPT. One of
2517 `server_url` or `connector_id` must be provided. Learn more about service
2518 connectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
2519
2520 Currently supported `connector_id` values are:
2521
2522 - Dropbox: `connector_dropbox`
2523 - Gmail: `connector_gmail`
2524 - Google Calendar: `connector_googlecalendar`
2525 - Google Drive: `connector_googledrive`
2526 - Microsoft Teams: `connector_microsoftteams`
2527 - Outlook Calendar: `connector_outlookcalendar`
2528 - Outlook Email: `connector_outlookemail`
2529 - SharePoint: `connector_sharepoint`
2530
2531 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorDropbox RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_dropbox"`
2532
2533 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorGmail RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_gmail"`
2534
2535 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorGooglecalendar RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_googlecalendar"`
2536
2537 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorGoogledrive RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_googledrive"`
2538
2539 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorMicrosoftteams RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_microsoftteams"`
2540
2541 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorOutlookcalendar RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_outlookcalendar"`
2542
2543 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorOutlookemail RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_outlookemail"`
2544
2545 - `const RealtimeSessionCreateResponseToolMcpToolConnectorIDConnectorSharepoint RealtimeSessionCreateResponseToolMcpToolConnectorID = "connector_sharepoint"`
2546
2547 - `DeferLoading bool`
2548
2549 Whether this MCP tool is deferred and discovered via tool search.
2550
2551 - `Headers map[string, string]`
2552
2553 Optional HTTP headers to send to the MCP server. Use for authentication
2554 or other purposes.
2555
2556 - `RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion`
2557
2558 Specify which of the MCP server's tools require approval.
2559
2560 - `type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter struct{…}`
2561
2562 Specify which of the MCP server's tools require approval. Can be
2563 `always`, `never`, or a filter object associated with tools
2564 that require approval.
2565
2566 - `Always RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways`
2567
2568 A filter object to specify which tools are allowed.
2569
2570 - `ReadOnly bool`
2571
2572 Indicates whether or not a tool modifies data or is read-only. If an
2573 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
2574 it will match this filter.
2575
2576 - `ToolNames []string`
2577
2578 List of allowed tool names.
2579
2580 - `Never RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever`
2581
2582 A filter object to specify which tools are allowed.
2583
2584 - `ReadOnly bool`
2585
2586 Indicates whether or not a tool modifies data or is read-only. If an
2587 MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
2588 it will match this filter.
2589
2590 - `ToolNames []string`
2591
2592 List of allowed tool names.
2593
2594 - `type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting string`
2595
2596 Specify a single approval policy for all tools. One of `always` or
2597 `never`. When set to `always`, all tools will require approval. When
2598 set to `never`, all tools will not require approval.
2599
2600 - `const RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingAlways RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "always"`
2601
2602 - `const RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingNever RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "never"`
2603
2604 - `ServerDescription string`
2605
2606 Optional description of the MCP server, used to provide more context.
2607
2608 - `ServerURL string`
2609
2610 The URL for the MCP server. One of `server_url` or `connector_id` must be
2611 provided.
2612
2613 - `Tracing RealtimeSessionCreateResponseTracingUnion`
2614
2615 Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once
2616 tracing is enabled for a session, the configuration cannot be modified.
2617
2618 `auto` will create a trace for the session with default values for the
2619 workflow name, group id, and metadata.
2620
2621 - `type Auto string`
2622
2623 Enables tracing and sets default values for tracing configuration options. Always `auto`.
2624
2625 - `const AutoAuto Auto = "auto"`
2626
2627 - `type RealtimeSessionCreateResponseTracingTracingConfiguration struct{…}`
2628
2629 Granular configuration for tracing.
2630
2631 - `GroupID string`
2632
2633 The group id to attach to this trace to enable filtering and
2634 grouping in the Traces Dashboard.
2635
2636 - `Metadata any`
2637
2638 The arbitrary metadata to attach to this trace to enable
2639 filtering in the Traces Dashboard.
2640
2641 - `WorkflowName string`
2642
2643 The name of the workflow to attach to this trace. This is used to
2644 name the trace in the Traces Dashboard.
2645
2646 - `Truncation RealtimeTruncationUnion`
2647
2648 When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.
2649
2650 Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.
2651
2652 Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.
2653
2654 Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.
2655
2656 - `type RealtimeTruncationRealtimeTruncationStrategy string`
2657
2658 The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.
2659
2660 - `const RealtimeTruncationRealtimeTruncationStrategyAuto RealtimeTruncationRealtimeTruncationStrategy = "auto"`
2661
2662 - `const RealtimeTruncationRealtimeTruncationStrategyDisabled RealtimeTruncationRealtimeTruncationStrategy = "disabled"`
2663
2664 - `type RealtimeTruncationRetentionRatio struct{…}`
2665
2666 Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.
2667
2668 - `RetentionRatio float64`
2669
2670 Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.
2671
2672 - `Type RetentionRatio`
2673
2674 Use retention ratio truncation.
2675
2676 - `const RetentionRatioRetentionRatio RetentionRatio = "retention_ratio"`
2677
2678 - `TokenLimits RealtimeTruncationRetentionRatioTokenLimits`
2679
2680 Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used.
2681
2682 - `PostInstructions int64`
2683
2684 Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens.
2685
2686### Realtime Transcription Session Create Response
2687
2688- `type RealtimeTranscriptionSessionCreateResponse struct{…}`
2689
2690 A Realtime transcription session configuration object.
2691
2692 - `ID string`
2693
2694 Unique identifier for the session that looks like `sess_1234567890abcdef`.
2695
2696 - `Object string`
2697
2698 The object type. Always `realtime.transcription_session`.
2699
2700 - `Type Transcription`
2701
2702 The type of session. Always `transcription` for transcription sessions.
2703
2704 - `const TranscriptionTranscription Transcription = "transcription"`
2705
2706 - `Audio RealtimeTranscriptionSessionCreateResponseAudio`
2707
2708 Configuration for input audio for the session.
2709
2710 - `Input RealtimeTranscriptionSessionCreateResponseAudioInput`
2711
2712 - `Format RealtimeAudioFormatsUnion`
2713
2714 The PCM audio format. Only a 24kHz sample rate is supported.
2715
2716 - `type RealtimeAudioFormatsAudioPCM struct{…}`
2717
2718 The PCM audio format. Only a 24kHz sample rate is supported.
2719
2720 - `Rate int64`
2721
2722 The sample rate of the audio. Always `24000`.
2723
2724 - `const RealtimeAudioFormatsAudioPCMRate24000 RealtimeAudioFormatsAudioPCMRate = 24000`
2725
2726 - `Type string`
2727
2728 The audio format. Always `audio/pcm`.
2729
2730 - `const RealtimeAudioFormatsAudioPCMTypeAudioPCM RealtimeAudioFormatsAudioPCMType = "audio/pcm"`
2731
2732 - `type RealtimeAudioFormatsAudioPCMU struct{…}`
2733
2734 The G.711 μ-law format.
2735
2736 - `Type string`
2737
2738 The audio format. Always `audio/pcmu`.
2739
2740 - `const RealtimeAudioFormatsAudioPCMUTypeAudioPCMU RealtimeAudioFormatsAudioPCMUType = "audio/pcmu"`
2741
2742 - `type RealtimeAudioFormatsAudioPCMA struct{…}`
2743
2744 The G.711 A-law format.
2745
2746 - `Type string`
2747
2748 The audio format. Always `audio/pcma`.
2749
2750 - `const RealtimeAudioFormatsAudioPCMATypeAudioPCMA RealtimeAudioFormatsAudioPCMAType = "audio/pcma"`
2751
2752 - `NoiseReduction RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction`
2753
2754 Configuration for input audio noise reduction.
2755
2756 - `Type NoiseReductionType`
2757
2758 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.
2759
2760 - `const NoiseReductionTypeNearField NoiseReductionType = "near_field"`
2761
2762 - `const NoiseReductionTypeFarField NoiseReductionType = "far_field"`
2763
2764 - `Transcription AudioTranscription`
2765
2766 - `Delay AudioTranscriptionDelay`
2767
2768 Controls how long the model waits before emitting transcription text.
2769 Higher values can improve transcription accuracy at the cost of latency.
2770 Only supported with `gpt-realtime-whisper` in GA Realtime sessions.
2771
2772 - `const AudioTranscriptionDelayMinimal AudioTranscriptionDelay = "minimal"`
2773
2774 - `const AudioTranscriptionDelayLow AudioTranscriptionDelay = "low"`
2775
2776 - `const AudioTranscriptionDelayMedium AudioTranscriptionDelay = "medium"`
2777
2778 - `const AudioTranscriptionDelayHigh AudioTranscriptionDelay = "high"`
2779
2780 - `const AudioTranscriptionDelayXhigh AudioTranscriptionDelay = "xhigh"`
2781
2782 - `Language string`
2783
2784 The language of the input audio. Supplying the input language in
2785 [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format
2786 will improve accuracy and latency.
2787
2788 - `Model AudioTranscriptionModel`
2789
2790 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
2791
2792 - `string`
2793
2794 - `type AudioTranscriptionModel string`
2795
2796 The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
2797
2798 - `const AudioTranscriptionModelWhisper1 AudioTranscriptionModel = "whisper-1"`
2799
2800 - `const AudioTranscriptionModelGPT4oMiniTranscribe AudioTranscriptionModel = "gpt-4o-mini-transcribe"`
2801
2802 - `const AudioTranscriptionModelGPT4oMiniTranscribe2025_12_15 AudioTranscriptionModel = "gpt-4o-mini-transcribe-2025-12-15"`
2803
2804 - `const AudioTranscriptionModelGPT4oTranscribe AudioTranscriptionModel = "gpt-4o-transcribe"`
2805
2806 - `const AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize"`
2807
2808 - `const AudioTranscriptionModelGPTRealtimeWhisper AudioTranscriptionModel = "gpt-realtime-whisper"`
2809
2810 - `Prompt string`
2811
2812 An optional text to guide the model's style or continue a previous audio
2813 segment.
2814 For `whisper-1`, the [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
2815 For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example "expect words related to technology".
2816 Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.
2817
2818 - `TurnDetection RealtimeTranscriptionSessionTurnDetection`
2819
2820 Configuration for turn detection. Can be set to `null` to turn off. Server
2821 VAD means that the model will detect the start and end of speech based on
2822 audio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.
2823
2824 - `PrefixPaddingMs int64`
2825
2826 Amount of audio to include before the VAD detected speech (in
2827 milliseconds). Defaults to 300ms.
2828
2829 - `SilenceDurationMs int64`
2830
2831 Duration of silence to detect speech stop (in milliseconds). Defaults
2832 to 500ms. With shorter values the model will respond more quickly,
2833 but may jump in on short pauses from the user.
2834
2835 - `Threshold float64`
2836
2837 Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
2838 higher threshold will require louder audio to activate the model, and
2839 thus might perform better in noisy environments.
2840
2841 - `Type string`
2842
2843 Type of turn detection, only `server_vad` is currently supported.
2844
2845 - `ExpiresAt int64`
2846
2847 Expiration timestamp for the session, in seconds since epoch.
2848
2849 - `Include []string`
2850
2851 Additional fields to include in server outputs.
2852
2853 - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.
2854
2855 - `const RealtimeTranscriptionSessionCreateResponseIncludeItemInputAudioTranscriptionLogprobs RealtimeTranscriptionSessionCreateResponseInclude = "item.input_audio_transcription.logprobs"`
2856
2857### Realtime Transcription Session Turn Detection
2858
2859- `type RealtimeTranscriptionSessionTurnDetection struct{…}`
2860
2861 Configuration for turn detection. Can be set to `null` to turn off. Server
2862 VAD means that the model will detect the start and end of speech based on
2863 audio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.
2864
2865 - `PrefixPaddingMs int64`
2866
2867 Amount of audio to include before the VAD detected speech (in
2868 milliseconds). Defaults to 300ms.
2869
2870 - `SilenceDurationMs int64`
2871
2872 Duration of silence to detect speech stop (in milliseconds). Defaults
2873 to 500ms. With shorter values the model will respond more quickly,
2874 but may jump in on short pauses from the user.
2875
2876 - `Threshold float64`
2877
2878 Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
2879 higher threshold will require louder audio to activate the model, and
2880 thus might perform better in noisy environments.
2881
2882 - `Type string`
2883
2884 Type of turn detection, only `server_vad` is currently supported.