v32

latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-07-312881,4162.7 MB
Realtime

Create session

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.

Returns the created Realtime session object, plus an ephemeral key.

post/realtime/sessions

Request body

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.

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.

speednumber

The speed of the model's spoken response. 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.

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.

Example request

{
  "voice": {
    "id": "voice_1234"
  }
}

Response

Session created successfully.

idstring

Unique identifier for the session that looks like sess_1234567890abcdef.

objectstring

The object type. Always realtime.session.

expires_atinteger

Expiration timestamp for the session, in seconds since epoch.

includestring[]

Additional fields to include in server outputs.

  • item.input_audio_transcription.logprobs: Include logprobs for input audio transcription.
modelstring

The Realtime model used for this session.

output_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.

tool_choicestring

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