Realtime

Create an ephemeral API token for use in client-side applications with the Realtime API. Can be configured with the same session parameters as the `session.update` client event. It responds with a session object, plus a `client_secret` key which contains a usable ephemeral API token that can be used to authenticate browser clients for the Realtime API.

post/realtime/sessions

Request body

modalitiesstring[]

The set of modalities the model can respond with. To disable audio, set this to ["text"].

model'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-realtime-preview-2024-12-17' | 'gpt-4o-mini-realtime-preview' | 'gpt-4o-mini-realtime-preview-2024-12-17'

The Realtime model used for this session.

instructionsstring

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.

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.

voice'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'

The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are alloy, ash, ballad, coral, echo sage, shimmer and verse.

input_audio_format'pcm16' | 'g711_ulaw' | 'g711_alaw'

The format of input audio. Options are pcm16, g711_ulaw, or g711_alaw. For pcm16, input audio must be 16-bit PCM at a 24kHz sample rate, single channel (mono), and little-endian byte order.

output_audio_format'pcm16' | 'g711_ulaw' | 'g711_alaw'

The format of output audio. Options are pcm16, g711_ulaw, or g711_alaw. For pcm16, output audio is sampled at a rate of 24kHz.

tool_choicestring

How the model chooses tools. Options are auto, none, required, or specify a function.

temperaturenumber

Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.

Response

Session created successfully.

modalitiesstring[]

The set of modalities the model can respond with. To disable audio, set this to ["text"].

instructionsstring

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.

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.

voice'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'

The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are alloy, ash, ballad, coral, echo sage, shimmer and verse.

input_audio_formatstring

The format of input audio. Options are pcm16, g711_ulaw, or g711_alaw.

output_audio_formatstring

The format of output audio. Options are pcm16, g711_ulaw, or g711_alaw.

tool_choicestring

How the model chooses tools. Options are auto, none, required, or specify a function.

temperaturenumber

Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.

Changes