Skip to content

Realtime

Use the OpenAI Realtime–compatible WebSocket route for real-time interaction.

http
GET /v1/realtime

Realtime uses a WebSocket connection and suits low-latency voice chat, real-time event streams, and bidirectional interaction. Connections go through authentication, model rate limiting, and channel routing.

The default example model is .

Available models

ModelDescription
Realtime voice / event streaming
Realtime preview model

The debugger can edit illustrative session.update session fields. For actual integration, use the WebSocket connection example below (browser-native WebSocket usually cannot set custom headers; use gateway injection or a client that supports custom headers).

Endpoint

Replace https with wss (or http with ws) in the API Base URL, then append the path:

text
wss://<API_HOST>/v1/realtime

Example (placeholders are replaced at build time):

text
https://octopusx.ai/v1/realtime

You can also specify the model via a query parameter, for example: /v1/realtime?model=gpt-realtime.

Headers

NameTypeRequiredDescription
stringYesRequest authentication. Use a Bearer token, for example: . If the client cannot set WebSocket headers, use a temporary token per gateway config or inject headers at a proxy layer

Connection example

js
const base = "https://octopusx.ai".replace(/^http/, "ws")
const ws = new WebSocket(`${base}/v1/realtime`)

// If the runtime supports custom headers, include Authorization
// headers: { Authorization: "Bearer YOUR_API_KEY" }

ws.onopen = () => {
  ws.send(
    JSON.stringify({
      type: "session.update",
      session: {
        model: "gpt-realtime",
        modalities: ["text"],
        instructions: "You are a real-time voice assistant."
      }
    })
  )
}

ws.onmessage = (event) => {
  console.log(JSON.parse(event.data))
}

Session configuration (session.update)

After the connection is established, the client may send at any time to update the session; the server returns the effective full configuration via . Only fields present in the message are updated. To clear , send an empty string; to clear , send an empty array; to disable , send .

NameTypeRequiredDescription
arrayNoResponse modalities, default ; set to disable audio output
stringNoRealtime model; see Available models above. Can also be set via the URL model query parameter
stringNoDefault system instructions; guides reply content, format, and audio behavior
stringNoReply voice, default . Built-in: / / / / / / / / / . Cannot be changed after audio has been output
stringNoInput audio format, default (24kHz PCM); options ,
stringNoOutput audio format, default ; options ,
objectNoInput audio transcription settings; off by default
objectNoServer turn detection; pass to disable and trigger responses manually
objectNoInput audio noise reduction; pass to disable
numberNoSampling temperature, range , default
integer | stringNoMaximum output tokens per response (including tool calls); or (default)
arrayNoList of callable tools; function tools are supported
string | objectNoTool selection: (default) / / , or a specific function object

input_audio_transcription

NameTypeRequiredDescription
stringNoTranscription model, e.g. , ,
stringNoInput language (ISO-639-1), e.g. ,
stringNoOptional prompt to guide transcription style or supply proper nouns

turn_detection

NameTypeRequiredDescription
stringNoDetection type, default ; optional
numberNo only. VAD activation threshold, default , range
integerNo only. Audio to keep before speech start (ms), default
integerNo only. Silence required to decide the speaker finished (ms), default
stringNo only. How eager to respond: / / / (default, same as )
booleanNoWhether to auto-create a response when speech ends, default
booleanNoWhether to interrupt an in-progress response when new speech starts, default

input_audio_noise_reduction

NameTypeRequiredDescription
stringNoNoise reduction type: (near-talk) or (far-field)

Common events

Client events

EventDescription
Update session configuration
Append Base64-encoded input audio
Commit the input audio buffer (manual commit when VAD is off)
Clear the input audio buffer
Create a conversation item
Delete a conversation item
Trigger a model response
Cancel an in-progress response

Server events

EventDescription
/ Session created / configuration updated
/ VAD detected speech start / end
Input audio transcription completed
/ Response started / completed
Text delta
/ Audio delta / audio output completed
/ Output audio transcript delta / completed
Function call arguments finished
Error event
Rate limits updated

Response example (session.updated)

json
{
  "type": "session.updated",
  "event_id": "event_abc123",
  "session": {
    "id": "sess_abc123",
    "object": "realtime.session",
    "model": "gpt-realtime",
    "modalities": ["text"],
    "instructions": "You are a real-time voice assistant.",
    "voice": "alloy"
  }
}