Realtime
The Realtime API exposes OpenAI-compatible low-latency text and audio conversations through websocket sessions plus an HTTP endpoint for short-lived client tokens.
WebSocket Connection
Open a realtime websocket session directly when your backend can securely hold the DGrid API key.
https://api.dgrid.ai
WSS
wss://api.dgrid.ai/v1/realtime?model={model}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.
https://api.dgrid.ai
GET
/v1/realtimeWebSocket Events
Plan your client around a small set of request and response event types for low-latency conversational streaming.
https://api.dgrid.ai
WSS
wss://api.dgrid.ai/v1/realtime?model={model}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.
