Skip to main content

Overview

Mistral provides high-quality text-to-speech synthesis through the Voxtral TTS API. The service uses HTTP streaming with Server-Sent Events to deliver PCM-encoded audio at 24kHz, with automatic resampling to any requested sample rate.

Mistral TTS API Reference

Pipecat’s API methods for Mistral TTS integration

Example Implementation

Complete example with voice conversation

Mistral Documentation

Official Mistral API documentation and features

Installation

To use Mistral TTS, install the required dependencies:
pip install "pipecat-ai[mistral]"

Prerequisites

Mistral Account Setup

Before using Mistral TTS services, you need:
  1. Mistral Account: Sign up at Mistral
  2. API Key: Generate an API key from your account dashboard
  3. Voice Selection: Choose voice IDs from the Mistral voice library

Required Environment Variables

  • MISTRAL_API_KEY: Your Mistral API key for authentication

Configuration

api_key
str
Mistral API key for authentication. If None, uses the MISTRAL_API_KEY environment variable.
sample_rate
int
default:"None"
Output audio sample rate in Hz. When None, uses the pipeline’s configured sample rate. Audio is automatically resampled from Mistral’s native 24kHz.
settings
MistralTTSService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

Settings

Runtime-configurable settings passed via the settings constructor argument using MistralTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
ParameterTypeDefaultDescription
modelstrvoxtral-mini-tts-2603TTS model identifier.
voicestrNoneVoice identifier for synthesis.
languageLanguage | strNoneLanguage for speech synthesis. (Inherited from base settings.)

Usage

Basic Setup

import os
from pipecat.services.mistral.tts import MistralTTSService

tts = MistralTTSService(
    api_key=os.getenv("MISTRAL_API_KEY"),
    settings=MistralTTSService.Settings(
        voice="c69964a6-ab8b-4f8a-9465-ec0925096ec8",
    ),
)

With Custom Model

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

With Custom Sample Rate

tts = MistralTTSService(
    api_key=os.getenv("MISTRAL_API_KEY"),
    sample_rate=16000,  # Output at 16kHz instead of default
    settings=MistralTTSService.Settings(
        voice="your-voice-id",
    ),
)

Notes

  • Streaming: The service uses Server-Sent Events for real-time audio streaming.
  • Resampling: Audio is automatically resampled from Mistral’s native 24kHz to any requested sample rate.
  • Audio format: The service receives float32 PCM audio from the API and converts it to int16 PCM for the Pipecat pipeline.
  • Metrics: The service supports metrics generation for monitoring TTS performance.