- Studio
- Voice
- Speech to Text
- Speech to Text quickstarts
Quickstart: transcribe an audio file
Quickstart: transcribe an audio file
This tutorial will show you how to transcribe audio from a file. To transcribe prerecorded audio from other sources, see File transcription. To transcribe streaming audio in real time, see the realtime quickstart.
Get an API key
First, you'll need a Mistral API key. If you don't have one, then go to Studio. Navigate to the API keys section and create a new API key.
Store your API key in the MISTRAL_API_KEY environment variable:
export MISTRAL_API_KEY="your-api-key"
Install the SDK
To use Python or TypeScript, install the Mistral SDK. The curl example needs no install.
pip install mistralai
Transcribe your audio
To follow along without a file of your own, download the sample recording, a 3-minute speech in English:
0:00 / 0:00
curl -O https://docs.mistral.ai/audio/obama.mp3
Use this code to transcribe speech from an audio file to text. The speech can be in multiple languages.
curl https://api.mistral.ai/v1/audio/transcriptions \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-F model=voxtral-mini-transcribe-3 \
-F file=@obama.mp3
You should see
The curl example returns the full JSON response, and the SDK examples print its text field. The transcript of the sample recording is shortened here with [...]:
{
"model": "voxtral-mini-transcribe-3",
"text": "This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. [...] Thanks, everybody. God bless you, and God bless the United States of America.",
"language": null,
"segments": [],
"usage": {
"prompt_audio_seconds": 203,
"prompt_tokens": 3,
"total_tokens": 3262,
"completion_tokens": 634,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 2625
},
"service_tier": "standard"
},
"finish_reason": null
}
Going further
Separate speakers
Label who speaks in a recorded file or a live session, read the speaker labels, and name known speakers with reference clips.
Improve accuracy on your vocabulary
Fix jargon, product names, and domain terms with keyphrases and free-form text.
File transcription in depth
Transcribe recorded audio: send a file, a URL, or an uploaded file, pin the language, get segment timestamps, and stream the response.