Skip to main content

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.

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

Mistral TTS API Reference

Pipecat’s API methods for Mistral TTS

Example Implementation

Complete example with Mistral STT and TTS

Mistral Documentation

Official Mistral API documentation

Installation

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

Prerequisites

Before using MistralTTSService, you need:
  1. Mistral Account: Sign up at 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

api_key
str
Mistral API key for authentication.
sample_rate
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.
settings
MistralTTSService.Settings
default:"None"
Runtime-configurable settings for the TTS service. 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
modelstr"voxtral-mini-tts-2603"Mistral TTS model to use. (Inherited.)
voicestrNoneVoice identifier. (Inherited.)
languageLanguage | strNoneLanguage for synthesis. (Inherited.)

Usage

Basic Setup

import os
from pipecat.services.mistral import MistralTTSService

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

With Custom Settings

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

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.