Skip to main content

Mistral STT plugin guide

How to use the Mistral STT plugin for LiveKit Agents.

Available inPython
|
Node.js

Overview

This plugin allows you to use Voxtral  as an STT provider for your voice agents.

Installation

Install the LiveKit Mistral AI plugin from PyPI or npm:

uv add "livekit-agents[mistralai]~=1.8"
pnpm add @livekit/agents-plugin-mistralai

Authentication

The Mistral AI integration requires a Mistral AI API key .

Set the MISTRAL_API_KEY in your .env file.

Usage

Use Mistral AI STT in your AgentSession or as a standalone transcription service. For example, you can use this STT in the Voice AI quickstart.

from livekit.plugins import mistralai
session = AgentSession(
stt=mistralai.STT(
model="voxtral-mini-transcribe-realtime-3",
language="en",
),
# ... llm, tts, etc.
)
import * as mistralai from '@livekit/agents-plugin-mistralai';
const session = new voice.AgentSession({
stt: new mistralai.STT({
model: "voxtral-mini-latest"
}),
// ... llm, tts, etc.
});

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.

modelSTTModels | stringDefault: voxtral-mini-transcribe-realtime-3

Name of the Voxtral STT model to use. Models with realtime in their name stream interim transcripts over a websocket connection. The others are batch models that transcribe each utterance after it ends. The Voxtral 3 models are:

  • voxtral-mini-transcribe-realtime-3: Realtime model with server-side turn detection.
  • voxtral-mini-transcribe-3: Batch model.
  • voxtral-small-transcribe-3: Larger batch model.
languagestring

The language code to use for better transcription accuracy if already known (for example, "fr"). Used with batch models and the Voxtral 3 realtime model.

context_biaslist[str]

Words or phrases to guide the model toward good spelling or names or domain-specific vocabulary. Up to 100 items can be provided. Used with batch models and the Voxtral 3 realtime model.

target_streaming_delay_msint

Target streaming delay in milliseconds for realtime mode. Only used with realtime models.

turn_detectionTurnDetection | None
Only Available inPython

Server-side turn detection settings for the Voxtral 3 realtime model. It's on by default with the server defaults, unless you set diarize or vad. Pass a TurnDetection dict to tune it, or None to turn it off. To learn more, see Turn detection.

diarizeboolDefault: False
Only Available inPython

Labels each piece of text with its speaker. The batch models and the Voxtral 3 realtime model support diarization. To learn more, see Speaker diarization.

vadvad.VAD

Voice activity detector the plugin runs on realtime models. Its end of speech flushes the audio to get the final transcript, and the plugin emits its start and end of speech as speech events. It takes precedence over Voxtral 3 server-side turn detection. You can't use both. Only used with realtime models.

Turn detection

Available inPython

The Voxtral 3 realtime model (voxtral-mini-transcribe-realtime-3) detects when the user starts and stops speaking on the server, and the plugin finalizes the transcript of each turn. It's enabled by default. To use the end of each detected turn as the end of the user's turn in the session, set turn_detection="stt". To learn more, see STT endpointing.

from livekit.plugins import mistralai
session = AgentSession(
stt=mistralai.STT(
model="voxtral-mini-transcribe-realtime-3",
turn_detection={"min_silence_ms": 400, "end_timeout_ms": 1500},
),
turn_handling={
"turn_detection": "stt",
},
# ... llm, tts, etc.
)

All TurnDetection fields are optional, and the server applies its defaults to the ones you leave out:

  • The start_threshold, eager_end_threshold, and end_threshold fields set the detection thresholds. They must satisfy start_threshold >= eager_end_threshold > end_threshold.
  • The min_silence_ms field sets the minimum silence before the end of a turn.
  • The end_timeout_ms field sets the maximum wait before the turn ends. It must be at least min_silence_ms.

To let the voice pipeline decide when a turn ends instead, pass turn_detection=None. Earlier realtime models, such as voxtral-mini-transcribe-realtime-2602, have no server-side endpointing either. In both cases, AgentSession flushes the audio based on its own VAD and turn detection to get the final transcript. If you use the STT on its own, outside of an AgentSession, call stream.flush() when the user stops speaking, or pass a VAD in the vad parameter to let the plugin flush for you.

Speaker diarization

Available inPython

Set diarize=True to label each piece of text with its speaker. Transcripts and their segments include the speaker in the speaker_id field. The batch models and the Voxtral 3 realtime model support diarization. Earlier realtime models don't.

On the Voxtral 3 realtime model, diarization and server-side turn detection can't run together. Setting diarize turns off turn detection by default, and setting both raises a ValueError. Without server-side turn detection, the plugin emits no start and end of speech events. To use turn_detection="stt", pass a VAD in the vad parameter to provide them:

from livekit.plugins import mistralai, silero
session = AgentSession(
stt=mistralai.STT(
model="voxtral-mini-transcribe-realtime-3",
diarize=True,
vad=silero.VAD.load(),
),
turn_handling={
"turn_detection": "stt",
},
# ... llm, tts, etc.
)

The realtime model numbers speakers within a single transcript only. The numbering restarts after each flush. You can't compare speaker IDs across transcripts.

Updating options

Available inPython

Use stt.update_options() to change model, language, context_bias, target_streaming_delay_ms, diarize, or turn_detection. Batch models apply the change to the next transcription. Realtime session settings can't change once audio starts. Changing one reconnects active streams and discards any transcript that isn't final yet. You can only switch to a model of the same kind (batch or realtime).

Additional resources

The following resources provide more information about using Mistral AI with LiveKit Agents.