speakerLabels: true and every transcript segment comes back with a speaker field, so you can render the conversation by speaker or pull out everything one guest said.
This script takes a link, transcribes it with speaker labels, prints the conversation, and then collects one speaker’s lines. It works on any public interview or podcast URL (YouTube, a podcast MP3, an uploaded file) and needs no dependencies in Node, and requests in Python.
The code
What comes back
Every segment carries aspeaker ("A", "B", and so on), and a new segment starts whenever the speaker changes:
A is whoever speaks first. The labels are letters, not names, so map A and B to the host and guest in your app. Because each segment has one speaker, a quick reply that cuts in splits the sentence at that point, so a segment can be a short piece of a sentence.
Notes that save you a round trip
Speaker labels always use speech-to-text. Captions don’t say who is speaking, so the audio is transcribed at $0.01 per started minute, even when the video has captions.maxCostDollars caps that, so a long interview over the cap fails with MAX_COST_EXCEEDED instead of running over it.
speakersExpected is a ceiling, not a target. Set it when you know the count (2 for a one-on-one). A number higher than the real count doesn’t invent speakers, but a number lower than it merges people, so leave it out when you’re unsure.
Non-English interviews work the same way. Leave language out and the spoken language is detected; pass a code such as "es" when you know it. Every supported language has speaker labels.
Need the audio file as well? Add the same options to an import: send transcriptSpeakerLabels: true to POST /import and you get the media file and the speaker-labelled transcript from one job. See transcripts inside an import.
Full reference: who said what
Every speaker-label option, the response shape and the pricing.