Documentation Index
Fetch the complete documentation index at: https://assemblyai.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Supported models
Supported models
Built-in code switching
Universal-3 Pro (Recommended)
Universal-3 Pro has code switching capabilities across English, Spanish, Portuguese, French, German, and Italian. To enable code switching, set the following parameter:"prompt": "The spoken language may change throughout the audio, transcribe in the original language mix (code-switching), preserving the words in the language they are spoken."
Here is an example of how Universal-3 Pro handles spoken audio in English and French.
Example output:
wordWrap
- Python
- JavaScript
Language supportUniversal-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 beingen, es, de.
To enable code switching for Universal-2 only, set speech_models to universal-2, set language_detection to True, and set code_switching to True inside the language_detection_options parameter 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 thespeech_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 thelanguage_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
Thecode_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 BehaviorThis 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.
- 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 DefaultBy 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