Skip to navigation

Turn-based Audio (Flux)

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

HandshakeTry it

WSS
wss://api.deepgram.com/v2/listen

Authentication

AuthorizationToken

Use Authorization: Token <API_KEY> Example: Authorization: Token 12345abcdef

OR
AuthorizationBearer

Use Authorization: Bearer <JWT> Example: Authorization: Bearer eyJhbGciOiJ...

Headers

AuthorizationstringRequired

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%

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_thresholdanyOptionalDefaults to 0.7

End-of-turn confidence required to finish a turn. Valid Values 0.5 - 1.0. Set to 1.0 to suppress confidence-based end-of-turn detection. eot_timeout_ms still ends idle turns; increase it when using ForceEndTurn for full manual turn control.

eot_timeout_msanyOptionalDefaults to 5000

A turn will be finished when this much time has passed after speech, regardless of EOT confidence. Valid Values 500 - 60000.

keytermstring or list of stringsOptional

Keyterm prompting improves recognition of specialized terminology.

keyterm accepts plain terms only. Unlike the legacy keywords feature, it does not support weights or intensifiers. Appending one (for example, keyterm=term:0.15) is not rejected—the weight is silently ignored and the entire value is treated as a literal keyterm.

To boost multiple separate keyterms, repeat the keyterm parameter (for example, keyterm=term1&keyterm=term2). To boost one multi-word phrase as a single keyterm, join the words with %20 or + (for example, keyterm=customer%20service). Do not separate keyterms with commas, semicolons, or line breaks.

language_hintstring or list of stringsOptional

Language hints constrain and prioritize language detection for the flux-general-multi model. Pass multiple language_hint query parameters to specify multiple language codes. Empty values are rejected. Only valid when model is flux-general-multi.

profanity_filterenumOptionalDefaults to false

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.

Allowed values:
numeralsenumOptionalDefaults to false
Numerals converts numbers from written format to numerical format
Allowed values:
redactenumOptional

Redaction removes sensitive information from your transcripts. On Flux, only numbers and aggressive_numbers are supported.

Allowed values:
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
OR
ListenV2ForceEndTurnobjectRequired
Send a ForceEndTurn message to immediately end the current turn
OR
ListenV2ConfigureobjectRequired
Send a Configure message to update Flux settings

Receive

ListenV2ConnectedobjectRequired
Receive a connected message
OR
ListenV2TurnInfoobjectRequired
Receive a turn info message
OR
ListenV2ConfigureSuccessobjectRequired
Sent when a `Configure` message was successfully applied. Returns the current, up-to-date values that were applied.
OR
ListenV2ConfigureFailureobjectRequired
Indicates that a Configure message was rejected
OR
ListenV2WarningobjectRequired
Receive a warning; the server keeps the connection open
OR
ListenV2FatalErrorobjectRequired
Receive a fatal error message