Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openai/openai-python/llms.txt
Use this file to discover all available pages before exploring further.
Create translation
Translates audio into English.Parameters
The audio file object (not file name) to translate, in one of these formats:
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.ID of the model to use. Only
whisper-1 (which is powered by OpenAI’s open source Whisper V2 model) is currently available.An optional text to guide the model’s style or continue a previous audio segment. The prompt should be in English.
The format of the output, in one of these options:
json, text, srt, verbose_json, or vtt.The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
Response
The translated text in English.
Examples
Basic translation
Get translation as SRT subtitles
Get translation as VTT
Translation with verbose JSON
Translation with prompt
Batch translate multiple files
Async usage
Supported audio formats
The translation endpoint supports the following audio formats:flac- Free Lossless Audio Codecmp3- MPEG audio formatmp4- MPEG-4 Part 14mpeg- MPEG audiompga- MPEG audiom4a- MPEG-4 audioogg- Ogg Vorbiswav- Waveform audiowebm- WebM audio
File uploads
Files are uploaded using multipart/form-data. The file object should be opened in binary mode:Translation vs Transcription
The key difference between the/audio/translations and /audio/transcriptions endpoints:
- Translations - Always outputs English text, regardless of input language
- Transcriptions - Outputs text in the same language as the audio input
When to use translations
Use the translations endpoint when you need to:- Convert non-English audio into English text
- Create English subtitles for foreign language videos
- Translate podcasts or audio content into English
- Build multilingual applications that standardize on English output
When to use transcriptions
Use the transcriptions endpoint when you need to:- Convert audio to text in the same language
- Create subtitles in the original language
- Preserve the original language of the content
Example: Multi-language processing
For more information on audio processing and best practices, see the Speech to text guide.