Skip to main content

Docker XTTS (Local)

The XTTSService integrates with a locally running Coqui XTTS streaming server. It is ideal for applications requiring local voice cloning and absolute data privacy.

Installation​

  1. Run the XTTS Docker container:
    docker run --gpus=all -e COQUI_TOS_AGREED=1 --rm -p 8000:80 ghcr.io/coqui-ai/xtts-streaming-server:latest-cuda121
  2. Install the SDK:
    pip install piopiy-ai

Configuration​

XTTSService Parameters​

ParameterTypeDefaultDescription
voice_idstrRequiredID of the speaker to use.
base_urlstrRequiredURL of the local XTTS server.
languageLanguageLanguage.ENLanguage for synthesis.

Usage​

Basic Setup​

import aiohttp
from piopiy.services.xtts.tts import XTTSService

async with aiohttp.ClientSession() as session:
tts = XTTSService(
voice_id="female_voice",
base_url="http://localhost:8000",
aiohttp_session=session
)

Notes​

  • Voice Cloning: You can load different speakers by passing their IDs retrieved from the /studio_speakers endpoint.
  • Performance: XTTS generates audio at 24kHz; the SDK automatically resamples it to your desired rate.
  • Privacy: Since it runs locally in Docker, no audio data or text is sent to an external service.