Skip to content

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.

WSS
https://api.dgrid.ai
WSSwss://api.dgrid.ai/v1/realtime?model={model}
Authorization
Authorization: Bearer <DGRID_API_KEY>; OpenAI-Beta: realtime=v1
Request
websocket
Response
websocket events

Query Parameters

ParameterTypeRequiredDescription
modelstringYesRealtime model ID, such as gpt-4o-realtime-preview.

Client Events

Event TypeDescription
session.updateUpdate session-level options.
input_audio_buffer.appendStream audio chunks to the server.
input_audio_buffer.commitCommit the current buffered audio.
response.createTrigger a new assistant response.
conversation.item.createInsert a conversation item.

Server Events

Event TypeDescription
session.createdSession was successfully created.
session.updatedSession settings were updated.
response.text.deltaStreamed text token delta.
response.audio.deltaStreamed audio chunk delta.
response.doneResponse has completed.
errorError payload.

Create Realtime Session Token

Use the realtime endpoint example shown below when you need an authenticated GET request against the realtime HTTP entrypoint.

GET
https://api.dgrid.ai
GET/v1/realtime
Authorization
Authorization: Bearer <DGRID_API_KEY>
Request
none
Response
101 · application/json

Request Headers

FieldTypeRequiredDescription
AuthorizationstringYesBearer token used to authenticate the realtime request.

Response Body

FieldTypeDescription
101textSuccessful upgrade response with no JSON body.
errorobjectError 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.

WSS
https://api.dgrid.ai
WSSwss://api.dgrid.ai/v1/realtime?model={model}
Authorization
Authorization: Bearer <DGRID_API_KEY>; OpenAI-Beta: realtime=v1
Request
websocket
Response
event stream

Core Client Events

Event TypeDescription
session.updateUpdate modalities, voice, or other session preferences.
input_audio_buffer.appendSend encoded audio fragments.
input_audio_buffer.commitMark the buffered audio as ready.
response.createAsk the server to begin generating a response.
conversation.item.createAdd a conversation turn or tool result.

Core Server Events

Event TypeDescription
session.createdInitial confirmation that the websocket session exists.
session.updatedConfirmation that session settings changed.
response.text.deltaIncremental text output.
response.audio.deltaIncremental audio output.
response.doneFinal event for a completed response.
errorRecoverable or fatal error payload.

Integration Guidance

  1. Buffer client-side audio in small chunks and use input_audio_buffer.commit to signal turn boundaries.
  2. Listen for both response.text.delta and response.audio.delta if the session supports multimodal output.
  3. Use the HTTP session token endpoint for browser clients so the long-lived API key never reaches the client.