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

# Mistral

> Text-to-speech service using Mistral's Voxtral TTS API

## Overview

`MistralTTSService` provides text-to-speech synthesis using Mistral's Voxtral TTS API. It uses HTTP streaming with Server-Sent Events to generate PCM-encoded audio at 24kHz.

Key features include:

* Streaming TTS with real-time audio generation
* Automatic resampling to pipeline sample rate
* Built-in metrics support
* Multiple voice options

<CardGroup cols={2}>
  <Card title="Mistral TTS API Reference" icon="code" href="https://reference-server.pipecat.ai/en/latest/api/pipecat.services.mistral.tts.html">
    Pipecat's API methods for Mistral TTS
  </Card>

  <Card title="Example Implementation" icon="play" href="https://github.com/pipecat-ai/pipecat/blob/main/examples/voice/voice-mistral.py">
    Complete example with Mistral STT and TTS
  </Card>

  <Card title="Mistral Documentation" icon="book" href="https://docs.mistral.ai/">
    Official Mistral API documentation
  </Card>
</CardGroup>

## Installation

To use Mistral TTS service, install the required dependencies:

```bash theme={null}
uv add "pipecat-ai[mistral]"
```

## Prerequisites

Before using `MistralTTSService`, you need:

1. **Mistral Account**: Sign up at [Mistral AI](https://mistral.ai/)
2. **API Key**: Generate an API key from your account dashboard
3. **Model Access**: Ensure you have access to the Voxtral TTS API

### Required Environment Variables

* `MISTRAL_API_KEY`: Your Mistral API key for authentication

## Configuration

<ParamField path="api_key" type="str">
  Mistral API key for authentication.
</ParamField>

<ParamField path="sample_rate" type="int" default="None">
  Output audio sample rate in Hz. Audio is resampled from Mistral's native 24kHz
  when a different rate is requested. When `None`, uses the pipeline's
  configured sample rate.
</ParamField>

<ParamField path="settings" type="MistralTTSService.Settings" default="None">
  Runtime-configurable settings for the TTS service. See [Settings](#settings)
  below.
</ParamField>

### Settings

Runtime-configurable settings passed via the `settings` constructor argument using `MistralTTSService.Settings(...)`. These can be updated mid-conversation with `TTSUpdateSettingsFrame`. See [Service Settings](/pipecat/fundamentals/service-settings) for details.

| Parameter  | Type              | Default                   | Description                              |
| ---------- | ----------------- | ------------------------- | ---------------------------------------- |
| `model`    | `str`             | `"voxtral-mini-tts-2603"` | Mistral TTS model to use. *(Inherited.)* |
| `voice`    | `str`             | `None`                    | Voice identifier. *(Inherited.)*         |
| `language` | `Language \| str` | `None`                    | Language for synthesis. *(Inherited.)*   |

## Usage

### Basic Setup

```python theme={null}
import os
from pipecat.services.mistral import MistralTTSService

tts = MistralTTSService(
    api_key=os.getenv("MISTRAL_API_KEY"),
)
```

### With Custom Settings

```python theme={null}
import os
from pipecat.services.mistral import MistralTTSService

tts = MistralTTSService(
    api_key=os.getenv("MISTRAL_API_KEY"),
    settings=MistralTTSService.Settings(
        model="voxtral-mini-tts-2603",
        voice="your-voice-id",
        language="en",
    ),
)
```

### With Custom Sample Rate

```python theme={null}
import os
from pipecat.services.mistral import MistralTTSService

tts = MistralTTSService(
    api_key=os.getenv("MISTRAL_API_KEY"),
    sample_rate=16000,  # Resample from 24kHz to 16kHz
)
```

## Notes

* **Audio format conversion**: The Mistral API returns base64-encoded float32 PCM chunks via Server-Sent Events. The service automatically converts these to int16 PCM for the Pipecat pipeline.
* **Native sample rate**: Mistral's TTS API outputs audio at 24kHz. When a different sample rate is specified, the service automatically resamples the audio.
* **Streaming**: The service uses HTTP streaming with Server-Sent Events for real-time audio generation, allowing for low-latency synthesis.

## Event Handlers

This service does not currently expose connection event handlers, as it uses HTTP streaming rather than persistent WebSocket connections.
