How It Works
Use these parameters in your/transcribe request. Supplying known speaker names helps the model map voices to real people.
boolean
Set this to
true to enable speaker diarization. The transcript will be returned with speaker labels (e.g., [SPEAKER_00], [SPEAKER_01]).string
Provide a short sentence listing the speakers (e.g., “The two speakers are Marv Esserman and the host, Ally Holt”). When
diarize is enabled, the AI uses this text plus voice cues to replace generic labels like [SPEAKER_00] with the actual names.Formatting & Performance: Enabling diarization increases processing time and cost. The
formatting parameter is ignored when diarize is true because diarization dictates the output format.How to Use It
Addingdiarize and (optionally) speaker_recognition_context is all you need.
Python SDK Example
quickstart_sdk.py
Example Result
Without diarization, a conversation is a wall of text. With diarization and speaker context, it becomes a readable script.Before Diarization
Transcript:
After Diarization (diarize=true)
Transcript:
After Diarization with Speaker Context
Context Provided:
The two speakers are Marv Esserman, the guest, and the host, Ally Holt.Transcript:Code Samples
Code Samples
Add the parameters to your request — include
diarize and speaker_recognition_context in the form/body.quickstart_diarize.py
URL Example
URL Example
quickstart_diarize_url.py
Tips for Writing Effective Speaker Context
- Be specific: Provide full names and roles if possible. For example,
The interviewer is Dr. Anya Sharma, and the patient's name is Ben Carter. - List all speakers: Try to list all known speakers to give the AI the best chance of correctly identifying everyone.
- Clarity is key: The AI uses this text to make an intelligent assignment. The clearer and more descriptive your context, the more accurate the final named speaker labels will be.