WebSocket Connection
Open a realtime websocket session directly when your backend can securely hold the DGrid API key.| Authorization | Authorization: Bearer <DGRID_API_KEY>; OpenAI-Beta: realtime=v1 |
| Request | websocket |
| Response | websocket events |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Realtime model ID, such as gpt-4o-realtime-preview. |
Client Events
| Event Type | Description |
|---|---|
session.update | Update session-level options. |
input_audio_buffer.append | Stream audio chunks to the server. |
input_audio_buffer.commit | Commit the current buffered audio. |
response.create | Trigger a new assistant response. |
conversation.item.create | Insert a conversation item. |
Server Events
| Event Type | Description |
|---|---|
session.created | Session was successfully created. |
session.updated | Session settings were updated. |
response.text.delta | Streamed text token delta. |
response.audio.delta | Streamed audio chunk delta. |
response.done | Response has completed. |
error | Error payload. |
Create Realtime Session Token
Use the realtime endpoint example shown below when you need an authenticated GET request against the realtime HTTP entrypoint.| Authorization | Authorization: Bearer <DGRID_API_KEY> |
| Request | none |
| Response | 101 · application/json |
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token used to authenticate the realtime request. |
Response Body
| Field | Type | Description |
|---|---|---|
101 | text | Successful upgrade response with no JSON body. |
error | object | Error payload returned when the request fails. |
WebSocket Events
Plan your client around a small set of request and response event types for low-latency conversational streaming.| Authorization | Authorization: Bearer <DGRID_API_KEY>; OpenAI-Beta: realtime=v1 |
| Request | websocket |
| Response | event stream |
Core Client Events
| Event Type | Description |
|---|---|
session.update | Update modalities, voice, or other session preferences. |
input_audio_buffer.append | Send encoded audio fragments. |
input_audio_buffer.commit | Mark the buffered audio as ready. |
response.create | Ask the server to begin generating a response. |
conversation.item.create | Add a conversation turn or tool result. |
Core Server Events
| Event Type | Description |
|---|---|
session.created | Initial confirmation that the websocket session exists. |
session.updated | Confirmation that session settings changed. |
response.text.delta | Incremental text output. |
response.audio.delta | Incremental audio output. |
response.done | Final event for a completed response. |
error | Recoverable or fatal error payload. |
Integration Guidance
- Buffer client-side audio in small chunks and use
input_audio_buffer.committo signal turn boundaries. - Listen for both
response.text.deltaandresponse.audio.deltaif the session supports multimodal output. - Use the HTTP session token endpoint for browser clients so the long-lived API key never reaches the client.

