Build a Voice Agent
HandshakeTry it
Authentication
Use Authorization: Token <API_KEY>
Example: Authorization: Token 12345abcdef
Use Authorization: Bearer <JWT>
Example: Authorization: Bearer eyJhbGciOiJ...
Headers
Use your API key or a temporary token for authentication via the Authorization header. In client-side environments where custom headers are not supported, use the Sec-WebSocket-Protocol header instead.
Example: Authorization: Token %DEEPGRAM_API_KEY% or Authorization: Bearer %DEEPGRAM_TOKEN%
Send
Send a message to update the Listen configuration on the fly during a conversation. The payload uses the same shape as agent.listen in the Settings message — model, language, and the other tunable fields live under listen.provider.
Change the Think Live model configuration in the middle of a conversation. Replaces the entire think_live.provider block, so include every parameter you want in effect; omitted parameters revert to their defaults. Does not affect the reasoning LLM (use UpdateThink for that). The server confirms with ThinkLiveUpdated
Requires agent.think_live. Ask the Think Live model to generate a short filler line instead of speaking a fixed message. Each request produces one filler; another request during the same wait escalates the wording. If filler cannot be generated, nothing is spoken and the server sends a DYNAMIC_FILLER_UNAVAILABLE warning
Send a function call response from the client to the server after
executing a client-side function call. This is used when the server
requests execution of a function marked with client_side: true.
End the current user turn immediately, without waiting for end-of-turn detection. Requires a Deepgram V2 (Flux) listen provider; with any other listen provider the server sends a FORCE_END_TURN_UNSUPPORTED warning and the turn does not end.
Experimental. Send an arbitrary JSON payload to your custom think provider. Deepgram does not validate the content and forwards it to the provider unchanged. Requires a wss:// custom Think endpoint in agent.think.endpoint.url. The provider’s response arrives as a __customFromThinkProvider message.
Receive
Confirms that an UpdateThink_Live message from the client has been applied
Sent when the Think Live model detects frustration in a user turn (negative valence, high arousal, or frustrated intent). Treat escalated: true as the trigger for your own escalation workflow; Deepgram does not transfer the call. Not sent when agent.think_live.provider.frustration_max_count is 0
Receive a function call response from the server after the server
has executed a server-side function call internally. This occurs
when functions are marked with client_side: false.
Facilitate real-time communication by relaying spoken statements from both the user and the assistant
Client-side or server-side function call request sent by the server
Sent when a client-side function call the server already sent you is cancelled because the user started speaking again, either inside the speculative window (the turn resumed) or after the turn was confirmed (barge-in). Only calls the client already received are announced
Experimental. Receive the response body from your custom think provider after sending a __customToThinkProvider message. Deepgram passes the response through unchanged. Requires a wss:// custom Think endpoint in agent.think.endpoint.url.
Notifies the client of non-fatal errors or warnings
Conversation history message emitted by the server during a session. Each message is either a conversation text message or a function call message. These messages can be supplied in settings of a subsequent Voice Agent session (via the agent.context.messages field) to allow the agent to maintain awareness of prior interactions.