Speaker Diarization
Deepgram API Playground
Try this feature out in our API Playground.
Pre-recorded Streaming:NovaStreaming: Flux All available languages
Diarization Models
Section titled “Diarization Models”Deepgram offers versioned diarization models. Use the diarize_model parameter to select a specific version:
| Value | Batch | Streaming |
|---|---|---|
latest |
Resolves to the latest GA batch diarizer (currently v2) | Resolves to the latest GA streaming diarizer (currently v1) |
v2 |
Pins to the v2 diarizer | Not supported — returns a validation error |
v1 |
Pins to the v1 diarizer | Pins to the v1 streaming diarizer |
Choosing a Model
Section titled “Choosing a Model”- New integrations: Use
diarize_model=latestto always get the newest available diarizer. - Pin a specific version: Use
diarize_model=v1ordiarize_model=v2(batch only). - Streaming: Use
diarize_model=latestordiarize_model=v1. The v2 diarizer is not available for streaming and returns a validation error.
Enable Feature
Section titled “Enable Feature”Using diarize_model (recommended)
Section titled “Using diarize_model (recommended)”Use the diarize_model parameter to enable diarization and select the model version in a single parameter:
Using diarize (deprecated)
Section titled “Using diarize (deprecated)”The boolean diarize parameter continues to work and always routes to the v1 diarizer:
diarize=true
Versioning Behavior
Section titled “Versioning Behavior”Switch your diarize=true requests to diarize_model (use latest for most cases). Don’t set both diarize and diarize_model — requests that set both are rejected.
Model Compatibility
Section titled “Model Compatibility”Diarization is compatible with all Nova batch models (Nova-1, Nova-2, Nova-3) as well as enhanced and base. Whisper is not supported.
Streaming
Section titled “Streaming”diarize_model is accepted on streaming requests with the following values:
diarize_model=v1— uses the v1 streaming diarizer.diarize_model=latest— resolves to the latest streaming diarizer (currently v1).diarize_model=v2— not supported on streaming. Returns a validation error.
The deprecated diarize=true parameter also continues to work for streaming and routes to the v1 diarizer.
Analyze Response
Section titled “Analyze Response”When the file is finished processing, you’ll receive a JSON response. Let’s look more closely at the words object within the alternatives object within this response.
Pre-Recorded
Section titled “Pre-Recorded”When using diarization for pre-recorded audio, both speaker and speaker_confidence values will be returned:
...
"alternatives":[
{
...
"words": [
{
"word":"hello",
"start":15.259043,
"end":15.338787,
"confidence":0.9721591,
"speaker":0,
"speaker_confidence":0.5853265
},
...
]
}
]Live Streaming
Section titled “Live Streaming”When using diarization for live streaming audio, only the speaker value will be returned:
...
"alternatives":[
{
...
"words": [
{
"word":"hello",
"start":15.259043,
"end":15.338787,
"confidence":0.9721591,
"speaker":0
},
...
]
}
]Diarizer Model Metadata
Section titled “Diarizer Model Metadata”When a diarizer runs, the response metadata includes a diarize_info object that identifies the diarizer build that produced the speaker labels. It appears alongside model_info in both pre-recorded and streaming responses, which makes the resolved model visible when diarize_model=latest resolves to different versions across batch and streaming:
"metadata": {
"models": ["30089e05-99d1-4376-b32e-c263170674af"],
"model_info": {
"30089e05-99d1-4376-b32e-c263170674af": {
"name": "2-general-nova",
"version": "2024-01-09.29447",
"arch": "nova-2"
}
},
"diarize_info": {
"model_uuid": "9a1c8b3e-2f44-4c8a-b1d0-example0000",
"arch": "v2"
}
}model_uuid— the UUID of the diarizer build that ran.arch— the diarizer architecture family (v1orv2) thatdiarize_modelresolved to, which makesdiarize_model=latestresolution visible. Legacydiarize=truerequests reportv1.
diarize_info is present only when a diarizer actually ran:
| Request | diarize_info |
|---|---|
diarize_model=v1, v2 (batch only), or latest |
Present; arch shows the resolved family |
diarize=true (deprecated) |
Present; arch: "v1" |
| No diarization requested | Absent |
Diarization requested but no diarizer model available (for example, self-hosted v2-only with diarize=true) |
Absent |
Format Response
Section titled “Format Response”To improve readability, you can use a JSON processor to parse the JSON. In this example, we use JQ and further improve readability by turning on Deepgram’s punctuation and utterances features:
When the file is finished processing, you’ll receive the following response:
[Speaker:0] Hello, and thank you for calling premier phone service. Please be aware that this call may be recorded for quality and training purposes.
[Speaker:0] My name is Beth, and I will be assisting you today. How are you doing?
[Speaker:1] Not too bad. How are you today?
[Speaker:0] I'm doing well. Thank you. May I please have your name?
[Speaker:1] My name is Blake...What’s Next