Skip to main content
The Opal WebSocket Protocol uses Protocol Buffers for message encoding. All messages are wrapped in either ServiceBoundMessage (client to server) or ClientBoundMessage (server to client).
Messages are binary-encoded protobuf. JSON examples below are shown for readability. Download the proto file.
Need VAD-only without LLM inference? See the VAD WebSocket Protocol for a dedicated VAD API that streams voice activity events.

Connection

Authentication via Bearer token in the connection headers.

Client Messages

Messages sent from client to server, wrapped in ServiceBoundMessage.

InitializeSessionRequest

Must be the first message sent. Configures the session parameters.
Reconfigure an ongoing session. Useful for changing audio input settings or the system prompt on the fly. You can update either field or both.
Reconfiguration may not be seamless. There may be glitches or dropped audio during the transition.
User input data (audio or text).
Define or update available tools. Replaces all existing definitions.Each ToolDefinition contains:
Response to a tool call request from the server.
Every ToolCallRequest must receive a corresponding ToolCallResponse, even if execution fails.
Manually trigger inference processing immediately, instead of waiting for natural pauses or end-of-input signals.
Primary use case is generating an initial greeting. Model behavior may be unpredictable if used directly after a model response.
Request the full conversation history. The server responds with a ChatHistory message.
Reports how many audio bytes the client has played. Only sent when the client declares supports_playback_reporting: true in InitializeSessionRequest.The server uses this data to accurately truncate the LLM context to exactly what the user heard when they interrupt. Without this, the server falls back to elapsed-time estimation.
Instructs the service to speak the given text via TTS immediately, bypassing the LLM. Any active inference is cancelled and the audio buffer is cleared before the text is spoken.
Runs a one-shot LLM inference over the current conversation history without modifying it. Useful for side tasks like summarization or classification. The server responds with a ConversationQueryResult.At least one of prompt or instructions must be provided.

Server Messages

Messages sent from server to client, wrapped in ClientBoundMessage.

ModelTextFragment

Streamed text output as tokens arrive.
ModelTextFragment is only sent in text-only mode - when no tts_configuration is present in InitializeSessionRequest. If TTS is configured, the server sends ModelAudioChunk messages instead and ModelTextFragment is never emitted.
TTS audio output when a TTS provider is configured.
The transcript field is optional — it may be absent from a given chunk entirely.
  • Deepslate hosted TTS does not populate transcript.
  • Third-party TTS providers (e.g., ElevenLabs) may populate it to supply word-level alignment data alongside the audio.
Model requests to execute a tool.
Notification to clear the audio playback buffer. Sent proactively when the user starts speaking, regardless of whether there is ongoing TTS playback.When received, immediately discard any buffered audio that hasn’t been played yet. This message may be sent multiple times if the user interrupts multiple times.
Notification that the model has begun its response.
Notification that the model has finished its response.
The full conversation history, returned in response to ExportChatHistoryRequest.
Structured error notification sent before the server closes the connection.
Async transcription result for a completed user audio turn. Sent after the transcription worker finishes processing.
Result of a ConversationQuery request.

Type Definitions

AudioLineConfiguration

SampleFormat

VadConfiguration

Voice Activity Detection settings.

InferenceConfiguration

TtsConfiguration

Optional text-to-speech configuration. If omitted, raw text fragments are sent.

ElevenLabsVoiceSettings

Fine-tuning settings for ElevenLabs voices.

ElevenLabsLocation

Controls which ElevenLabs regional endpoint is used. See ElevenLabs data residency docs for details.

HostedVoiceRef

Reference a Deepslate-hosted voice that is already available on the server.

HostedVoiceCloneV1

Provide an inline custom voice clone for hosted TTS using reference audio and its exact transcript.

HostedTtsMode

Controls the quality/latency trade-off for hosted TTS generation.

Duration

InferenceTriggerMode

Controls how this input interacts with ongoing inference.

TextData

Text input wrapper.

ChatMessage

A single message in the conversation history.

ChatMessageRole

ChatDeliveryStatus

ChatMessageContent

A single content block within a chat message. Contains one of:

ChatTextContent

Text content from a conversation turn, with optional TTS audio. When TTS is active, each synthesized sentence becomes a ChatTextContent with both fields populated.

ChatAudioData

Self-describing audio data including format metadata so consumers can decode without out-of-band knowledge.
If you reconfigure the audio pipeline mid-conversation, the format may change. Always inspect the format field rather than assuming it matches the initial configuration.

SessionErrorCategory

Broad error categories for programmatic handling of SessionErrorNotification.