language string Option: multi
The Multilingual Codeswitching feature in Deepgram’s API allows you to transcribe conversations where speakers switch between multiple languages. This guide will walk you through enabling this feature, how to use it with cURL, and how to analyze and interpret the response.
Multilingual Code Switching is available on Nova-2, Nova-3, and Flux Multilingual (flux-general-multi). See the list of supported languages for each multilingual model.
To enable Multilingual Codeswitching on Nova-2 or Nova-3, use the following language parameter in the query string when you call Deepgram’s /listen endpoint:
language=multi
To transcribe audio from a file on your computer that contains multiple languages, run the following cURL command in a terminal or your favorite API client.
Replace YOUR_DEEPGRAM_API_KEY with your Deepgram API Key.
To transcribe an audio stream, initiate a websocket connection, including the parameter language=multi. For instance:
We recommend using an endpointing value of 100 ms for code-switching, endpointing=100.
Flux Multilingual handles code-switching natively. Instead of language=multi, use model=flux-general-multi with optional language_hint parameters to bias toward expected languages.
Flux returns detected languages in every TurnInfo event via the languages field. See the Language Prompting guide for full details on usage scenarios and response format.
When the file is finished processing, you’ll receive a JSON response that has the following basic structure:
In this response, we see that each channel contains:
alternatives object, which contains:
When streaming audio, a Results JSON message has the following structure: