Code Switching
Supported models
universal-3-prouniversal-2Transcribe audio containing multiple languages with code switching detection. This feature enables accurate transcription of conversations where speakers naturally switch between languages during conversations.
Built-in code switching
Universal-3 Pro (Recommended)
Universal-3 Pro has built-in code switching capabilities across English, Spanish, Portuguese, French, German, and Italian. Set language_detection to True to automatically detect the spoken language, and use a prompt to preserve the original language mix in your transcript.
Here is an example of how Universal-3 Pro handles spoken audio in English and French.
Example output:
Python
JavaScript
Language support
Universal-3 Pro supports English, Spanish, Portuguese, French, German, and Italian. To access all 99 languages, use "speech_models": ["universal-3-pro", "universal-2"] as shown in the code example. Read more here.
Universal-2
Supports code switching between 99 languages, with best performing code switching languages being en, es, de.
To enable code switching for Universal-2 only, set speech_models to universal-2, set language_detection as True, and set code_switching as True as shown in the example below.
If your use case involves code-switching between English, Spanish, Portuguese, French, German, or Italian, we recommend upgrading to Universal-3 Pro. It delivers significantly improved accuracy when speakers alternate between these languages mid-speech — outperforming Universal-2 across all supported language pairs.
Example API Response
When enabling code switching with automatic language detection, the two detected language codes with the highest confidence and their confidence will be included in the transcript JSON.
99 languages coverage
To get the best performing transcription while extending code switching across all 99 supported languages, specify both “Universal-3 Pro” and “Universal-2” using the speech_models parameter, allowing our system to automatically route your audio based on language support.
Model routing behavior: The system attempts to use the models in priority order falling back to the next model when needed. For example, with ["universal-3-pro", "universal-2"], the system will try to use universal-3-pro for languages it supports (English, Spanish, Portuguese, French, German, and Italian), and automatically fall back to Universal-2 for all other languages. This ensures you get the best performing transcription where available while maintaining the widest language coverage.
Other supported languages
While additional languages are supported for code switching, optimal results typically require the non-English language to be dominant in the audio. For English-dominant content with other languages, standard single-language transcription may be more appropriate.
We highly recommend testing sample code switching files with your specific audio to assess performance and evaluate outputs. We also recommend using an LLM to correct and fine-tune our model’s outputs.
Manually Setting Language Codes
To manually set the language codes, you can use the language_codes parameter. A max of two language codes can be set and one code must be "en". For example, if your file contains both English and Spanish, it would be "language_codes": ["en", "es"].
Code Switching Confidence Threshold
The code_switching_confidence_threshold parameter controls how the model routes transcription when multiple languages are detected.
When code switching is enabled, the model detects up to two languages per audio file and assigns each a confidence score.
Code Switching Routing Behavior
This parameter controls routing, not rejection. Audio is always transcribed, even if confidence scores do not meet this threshold. To return an error instead of a low-confidence transcription, you can use language_confidence_threshold alongside this parameter.
The threshold determines which language is used for transcription using the following logic:
- If the non-English language’s confidence score meets or exceeds the threshold, the audio is routed to that non-English language model.
- If the non-English language’s confidence score falls below the threshold, the audio is routed to whichever language has the highest overall confidence, which may be English or non-English.
- If both detected languages are non-English, the audio is always routed to whichever has the higher confidence score, regardless of the threshold.
Code Switching Default
By default, the code_switching_confidence_threshold parameter is set to 0.3. If you would like to disable this, make sure to set this parameter to 0.
Setting code_switching_confidence_threshold to 0 means the non-English language is always used for routing, even with very low confidence.
Troubleshooting
If your audio contains primarily one language with only occasional words from another language, standard single-language transcription may be more appropriate than code-switching mode.
Related features
- Supported Languages - View all available language options
- Speaker Diarization - Identify different speakers in multi-speaker conversations
- Keyterms Prompting - Boost transcription accuracy