> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mistral AI

> Use the Mistral AI speech-to-text plugin in a Zero Runtime pipeline. Setup and usage in Python and JavaScript.

Mistral AI is a **speech-to-text** plugin. It transcribes the caller's audio with Mistral's Voxtral realtime model, which detects the language automatically or can be pinned to one.

## Setup

Set your Mistral AI API key in the worker environment. Generate a key from the [Mistral console](https://console.mistral.ai/api-keys):

```bash theme={null}
export MISTRALAI_API_KEY=<key>
```

> [!NOTE]
>
> The variable is `MISTRALAI_API_KEY`, not the `MISTRAL_API_KEY` that Mistral's own SDK reads.

## Usage

Import the plugin and pass it to the pipeline's `stt` slot.

```python Python theme={null}
from zeroruntime.plugins import MistralAISTT

stt = MistralAISTT(
    language="en",
)

# Pipeline(stt=stt, ...)
```

```typescript Node JS theme={null}
import { MistralAISTT } from '@zeroruntime/js-sdk/plugins';

const stt = MistralAISTT({
  language: 'en',
});

// Pipeline({ stt, ... })
```

> [!WARNING]
>
> Mistral settles a transcript only when the session ends. Include a [VAD](https://docs.zeroruntime.ai/runtime-sdk/plugins/vad/silero.md) in the pipeline so it ends at the end of speech, or set `turn_detection` to let Mistral end turns itself.

## Parameters

*Constructor parameters for `MistralAISTT`. The Python and Node JS SDKs share these field names.*

| Parameter | Type | Default | Description |
| - | - | - | - |
| `api_key` | `str` | `None` | Mistral AI API key. Falls back to the `MISTRALAI_API_KEY` environment variable when unset. |
| `model` | `str` | `"voxtral-mini-transcribe-realtime-3-0"` | Voxtral realtime transcription model. |
| `language` | `str` | `None` | Two-letter language code, e.g. "en" or "ar". Leave unset to detect the language automatically. |
| `target_streaming_delay_ms` | `int` | `480` | How long the model may wait for context, 80 to 1200 or 2400 milliseconds. Lower is faster but less accurate. |
| `context_bias` | `list[str]` | `None` | Names and terms to spell correctly, e.g. product or place names. |
| `turn_detection` | `dict \| None` | `None` | Mistral's own end-of-turn detection, e.g. `{"min_silence_ms": 300}`. Use it when the pipeline has no VAD; leave unset to finalize on the VAD alone. |
| `interim_results` | `bool` | `True` | Emit partial transcripts while the user is still speaking. |
| `base_url` | `str` | `"wss://api.mistral.ai/v1/audio/transcriptions/realtime"` | WebSocket address of the realtime endpoint. Change it only when routing through a proxy. |

### `turn_detection` keys

`turn_detection` takes a `MistralAITurnDetectionConfig` or a plain dict with the same keys.

| Field | Type | Default | Description |
| - | - | - | - |
| `start_threshold` | `float` | `None` | Score, 0 to 1, that opens or resumes a turn; must be at least `eager_end_threshold`. |
| `eager_end_threshold` | `float` | `None` | Score, 0 to 1, that signals the user may have stopped; must be above `end_threshold`. |
| `end_threshold` | `float` | `None` | Score, 0 to 1, that ends the turn once the pause is long enough. |
| `min_silence_ms` | `int` | `300` | Shortest pause, in milliseconds, that can end a turn. Lower ends turns sooner but can split a sentence at a pause. |
| `end_timeout_ms` | `int` | `None` | Longest pause, in milliseconds, before the turn ends anyway; must be at least `min_silence_ms`. |

## Import paths

| SDK | Import | Constructor |
| - | - | - |
| Python | `from zeroruntime.plugins import MistralAISTT` | `MistralAISTT()` |
| Node JS | `import { MistralAISTT } from '@zeroruntime/js-sdk/plugins'` | `MistralAISTT()` |

Transcribed text passes to the [LLM](https://docs.zeroruntime.ai/runtime-sdk/plugins/overview.md) once [turn detection](https://docs.zeroruntime.ai/runtime-sdk/plugins/turn-detection.md) decides the caller has finished speaking.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.