> ## Documentation Index
> Fetch the complete documentation index at: https://daily-docs-source-analytics-user-turn-strategies.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Voice.ai

> Text-to-speech service implementation using Voice.ai's streaming WebSocket API

export const CommunityMaintained = ({maintainer, maintainerUrl, repo}) => <Note>
    <strong>Community-maintained integration.</strong> This service is built and
    maintained by{" "}
    <a href={maintainerUrl} target="_blank" rel="noreferrer">
      {maintainer}
    </a>
    . Pipecat does not test or officially support it. Please report issues and
    request changes on the{" "}
    <a href={repo} target="_blank" rel="noreferrer">
      source repository
    </a>
    . Learn more about{" "}
    <a href="/api-reference/server/services/community-integrations">
      community integrations
    </a>
    .
  </Note>;

<CommunityMaintained maintainer="voice-ai" maintainerUrl="https://github.com/voice-ai" repo="https://github.com/voice-ai/voice-ai-pipecat-tts" />

## Overview

`VoiceAiTTSService` converts text to speech using [Voice.ai](https://voice.ai/)'s
Multi-Context WebSocket API. It maintains a persistent WebSocket connection that
streams raw PCM audio (32kHz mono), with support for multiple languages, custom
voice selection, and temperature/top\_p generation controls.

<CardGroup cols={2}>
  <Card title="Source Repository" icon="github" href="https://github.com/voice-ai/voice-ai-pipecat-tts">
    Source code, examples, and issues for the Voice.ai integration
  </Card>

  <Card title="Voice.ai Website" icon="book" href="https://voice.ai/">
    Sign up and get a Voice.ai API key
  </Card>

  <Card title="API Documentation" icon="book" href="https://voice.ai/docs/api-reference/text-to-speech/multi-context-websocket">
    Voice.ai Multi-Context WebSocket TTS API reference
  </Card>
</CardGroup>

## Installation

This is a community-maintained package distributed separately from `pipecat-ai`.
It is not published to PyPI; install it from source:

```bash theme={null}
git clone https://github.com/voice-ai/voice-ai-pipecat-tts.git
cd voice-ai-pipecat-tts
pip install -e .
```

## Prerequisites

### Voice.ai Account Setup

Before using the Voice.ai TTS service, you need:

1. **Voice.ai Account**: Sign up at [Voice.ai](https://voice.ai/)
2. **API Key**: Obtain an API key (format: `vk_*`) from Voice.ai

### Required Environment Variables

* `VOICEAI_API_KEY`: Your Voice.ai API key for authentication

## Configuration

<ParamField path="api_key" type="str" required>
  Voice.ai API key for authentication (format: `vk_*`).
</ParamField>

<ParamField path="voice_id" type="str" default="None">
  Voice identifier for synthesis. If not provided, uses the default built-in
  voice.
</ParamField>

<ParamField path="url" type="str" default="wss://dev.voice.ai/api/v1/tts/multi-stream">
  WebSocket URL for the Voice.ai multi-context TTS API.
</ParamField>

<ParamField path="sample_rate" type="int" default="None">
  Output audio sample rate. Defaults to 32000 Hz (Voice.ai's native rate) when
  not set.
</ParamField>

<ParamField path="params" type="VoiceAiTTSService.InputParams" default="None">
  Voice synthesis settings. See [Input Parameters](#input-parameters) below.
</ParamField>

<ParamField path="aggregate_sentences" type="bool" default="True">
  Whether to aggregate text by sentences before TTS. When `True`, each sentence
  is sent separately for lower latency; when `False`, larger text chunks are
  batched for more natural flow at the cost of higher latency.
</ParamField>

### Input Parameters

Synthesis settings passed via the `params` constructor argument using
`VoiceAiTTSService.InputParams(...)`.

| Parameter      | Type       | Default       | Description                                                                                 |
| -------------- | ---------- | ------------- | ------------------------------------------------------------------------------------------- |
| `language`     | `Language` | `Language.EN` | Target language. Supports `en`, `ca`, `sv`, `es`, `fr`, `de`, `it`, `pt`, `pl`, `ru`, `nl`. |
| `model`        | `str`      | `None`        | TTS model. Auto-selected based on language when not provided.                               |
| `audio_format` | `str`      | `"pcm"`       | Audio output format (raw PCM).                                                              |
| `temperature`  | `float`    | `1.0`         | Generation temperature (0.0–2.0). Higher values are more random.                            |
| `top_p`        | `float`    | `0.8`         | Top-p sampling (0.0–1.0). Controls output diversity.                                        |

<Note>
  Available parameters and defaults are defined by the integration and the
  Voice.ai API. See the [source
  repository](https://github.com/voice-ai/voice-ai-pipecat-tts) for the
  authoritative, up-to-date list.
</Note>

## Usage

```python theme={null}
from pipecat_voice_ai import VoiceAiTTSService
from pipecat.transcriptions.language import Language

tts = VoiceAiTTSService(
    api_key="vk_your-api-key",
    voice_id="your-voice-id",  # Optional: uses default if not provided
    params=VoiceAiTTSService.InputParams(
        language=Language.EN,
        temperature=1.0,
        top_p=0.8,
    ),
)

# Add tts to your pipeline:
from pipecat.pipeline.pipeline import Pipeline

pipeline = Pipeline([
    # ... other processors ...
    tts,
    transport.output(),
])
```

## Compatibility

Tested with Pipecat v0.0.100+. Check the [source
repository](https://github.com/voice-ai/voice-ai-pipecat-tts) for the latest
tested version and changelog.
