Turn-based Audio (Flux)

Real-time conversational speech recognition with contextual turn detection for natural voice conversations

HandshakeTry it

WSS
/v2/listen

Headers

AuthorizationstringRequired

Use your API key for authentication, or alternatively generate a temporary token and pass it via the token query parameter.

Example: token %DEEPGRAM_API_KEY% or bearer %DEEPGRAM_TOKEN%

Query parameters

modelenumRequired
Defines the AI model used to process submitted audio.
Allowed values:
encodingenumOptional

Encoding of the audio stream. Required if sending non-containerized/raw audio. If sending containerized audio, this parameter should be omitted.

sample_rateanyOptional

Sample rate of the audio stream in Hz. Required if sending non-containerized/raw audio. If sending containerized audio, this parameter should be omitted.

eager_eot_thresholdanyOptional

End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.

eot_thresholdanyOptional

End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.

eot_timeout_msanyOptional
A turn will be finished when this much time has passed after speech, regardless of EOT confidence.
keytermstring or list of stringsOptional
Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.
mip_opt_outanyOptional
Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip
taganyOptional
Label your requests for the purpose of identification during usage reporting

Send

ListenV2MediastringRequiredformat: "binary"
Send audio or video data to be transcribed
OR
ListenV2CloseStreamobjectRequired
Send a CloseStream message to close the WebSocket stream

Receive

ListenV2ConnectedobjectRequired
Receive a connected message
OR
ListenV2TurnInfoobjectRequired
Receive a turn info message
OR
ListenV2FatalErrorobjectRequired
Receive a fatal error message