Offline Transcription
Before You Start
Models with Audio Capabilities
Audio capable models:
- Voxtral Small (
voxtral-small-latest) with audio input for chat use cases. - Voxtral Mini (
voxtral-mini-latest) with audio input for chat use cases - And Voxtral Mini Transcribe (
voxtral-mini-latestviaaudio/transcriptions), with an efficient transcription only service.
voxtral-mini-latestfor chat points tovoxtral-mini-2507voxtral-mini-latestfor transcription points tovoxtral-mini-2602
For faster transcription time, we recommend uploading your audio files.
Chat with Audio
Use Audio with Instruction Following models
Our Voxtral models are capable of being used for chat use cases with our chat completions endpoint.
Before continuing, we recommend reading the Chat Completions documentation to learn more about the chat completions API and how to use it before proceeding.
To pass a local audio file, you can encode it in base64 and pass it as a string.
import base64
from mistralai import Mistral
api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"
client = Mistral(api_key=api_key)
# Encode the audio file in base64
with open("examples/files/bcn_weather.mp3", "rb") as f:
content = f.read()
audio_base64 = base64.b64encode(content).decode('utf-8')
chat_response = client.chat.complete(
model=model,
messages=[{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": audio_base64,
},
{
"type": "text",
"text": "What's in this file?"
},
]
}],
)Example Samples
Below you can find a few of the multiple use cases possible, by leveraging the audio capabilities of our models.
¡Meow! Click one of the tabs above to learn more.
Transcription
Transcribe any Audio
Transcription provides an optimized endpoint for transcription purposes and currently supports voxtral-mini-latest, which runs Voxtral Mini Transcribe.
Parameters
We provide different settings and parameters for transcription, such as:
timestamp_granularities: This allows you to set timestamps to track not only "what" was said but also "when". You can find more about timestamps here.diarize: This allows you to keep track of who is talking.context_bias: Provide up to 100 words or phrases to guide the model toward correct spellings of names, technical terms, or domain-specific vocabulary. Particularly useful for proper nouns or industry terminology that standard models often miss. Context biasing is optimized for English; support for other languages is experimental. You can find more about context biasing here.language: Our transcription service also works as a language detection service. However, you can manually set the language of the transcription for better accuracy if the language of the audio is already known.
Realtime: We provide a live transcription functionality. You can find more info about Realtime here.
Among the different methods to pass the audio, you can directly provide a path to a local file to upload and transcribe it as follows:
import os
from mistralai import Mistral
api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"
client = Mistral(api_key=api_key)
with open("/path/to/file/audio.mp3", "rb") as f:
transcription_response = client.audio.transcriptions.complete(
model=model,
file={
"content": f,
"file_name": "audio.mp3",
},
## language="en"
)Example Samples
Below you can find a few examples leveraging the audio transcription endpoint.
¡Meow! Click one of the tabs above to learn more.
Transcription with Timestamps
You can request timestamps for the transcription by passing the timestamp_granularities parameter, currently supporting segment and word.
It will return the start and end time of each segment in the audio file.
timestamp_granularities is currently not compatible with language, please use either one or the other.
import os
from mistralai import Mistral
api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"
client = Mistral(api_key=api_key)
transcription_response = client.audio.transcriptions.complete(
model=model,
file_url="https://docs.mistral.ai/audio/obama.mp3",
timestamp_granularities=["segment"] # or "word"
)Context biasing
Provide up to 100 words or phrases to guide the model toward correct spellings of names, technical terms, or domain-specific vocabulary. Particularly useful for proper nouns or industry terminology that standard models often miss. Context biasing is optimized for English; support for other languages is experimental.
import os
from mistralai import Mistral
api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-2602"
client = Mistral(api_key=api_key)
with open("/path/to/file/audio.mp3", "rb") as f:
transcription_response = client.audio.transcriptions.complete(
model=model,
file_url="https://docs.mistral.ai/audio/obama.mp3",
context_bias="Chicago,Joplin,Boston,Charleston,farewell_address,self-government,citizenship,democracy,American_people,cancer_survivors,affordable_health_care,wounded_warriors,refugees,elected_officials,American_spirit,work_of_citizenship,guardians_of_our_democracy"
)