← Back to guides

Installing Thorsten-Voice with CosyVoice (Docker)

The current LLM-based model with the most natural sound. It runs on the CPU, but only really shows its strength with an NVIDIA GPU — roughly 16 times faster there than pure CPU computation. Just like with Kokoro, a single docker run command is all you need.

Choose voice:
1

Install Docker

Install Docker Desktop for Windows/Mac or Docker Engine for Linux, if you don't have it yet.

Download Docker ↗
2

Start the container (quickstart)

A single docker run command. On the very first start, the container automatically downloads the models (around 8.5 GB) — depending on your connection, this takes 5 to 15 minutes. Thanks to the volume, later starts are done in about 30 seconds.

docker run -p 8000:8000 \
  -v cosyvoice_models:/app/CosyVoice/pretrained_models \
  thorstenvoice/cosyvoice-tts:cosyvoice3

As soon as the log shows "Uvicorn running on http://0.0.0.0:8000", the server is ready.

Alternatively with docker-compose (recommended)

For continuous operation, create a docker-compose.yml:

services:
  cosyvoice-tts:
    image: thorstenvoice/cosyvoice-tts:cosyvoice3
    ports:
      - "8000:8000"
    volumes:
      - cosyvoice_models:/app/CosyVoice/pretrained_models
    restart: unless-stopped

volumes:
  cosyvoice_models:

and then start it with:

docker compose up

With an NVIDIA GPU (Linux only)

With an NVIDIA graphics card and the NVIDIA Container Toolkit installed, add the deploy section:

services:
  cosyvoice-tts:
    image: thorstenvoice/cosyvoice-tts:cosyvoice3
    ports:
      - "8000:8000"
    volumes:
      - cosyvoice_models:/app/CosyVoice/pretrained_models
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

volumes:
  cosyvoice_models:

Standard German and Hessian dialect are two separate Docker images — to run both at the same time, simply use different volume names and host ports. They will then run side by side without sharing the model cache volume.

Once the container is running, you can simply talk to it via HTTP — no SDK, no installation needed on your side. The voice speaks German, so send German text.

Generate speech

Send text via HTTP POST (as a form field, not JSON), get a WAV file back.

curl -X POST http://localhost:8000/tts \
     -F "text=Hallo, ich bin Thorsten. Schön, dass du da bist." \
     --output thorsten.wav

Adjust speaking rate

The speed value ranges from 0.5 (slow) to 2.0 (fast), the default is 1.0.

curl -X POST http://localhost:8000/tts \
     -F "text=Das hier wird etwas langsamer gesprochen." \
     -F "speed=0.85" \
     --output output.wav

Several sentences in one file

The tts_batch endpoint combines several sentences (separated by line breaks) into a single audio file.

curl -X POST http://localhost:8000/tts_batch \
     -F $'texts=Erster Satz.\nZweiter Satz.\nDritter Satz.' \
     --output batch.wav

Check status

Shows whether the server is running and which model is active (the model value differs depending on which of the two images is running).

curl http://localhost:8000/health

Measured with a short test sentence (~8 words) and a long test sentence (~80 words).

Hardware Short text Long text
MacBook Air M1 (CPU) 47 s 4:30 min
QNAP NAS Intel (CPU) 50 s —
RunPod RTX 4090 (GPU) 2.9 s 12.9 s
The GPU is not detected / it runs on the CPU despite --gpus all ⌄

GPU support only works on Linux with an NVIDIA card and requires the NVIDIA Container Toolkit (nvidia-container-toolkit). Without this toolkit, Docker silently ignores the deploy section in docker-compose.yml and keeps computing on the CPU.

The first start takes forever or seems to hang ⌄

On the very first start, around 8.5 GB of model data is downloaded — realistically 5 to 15 minutes, depending on your internet connection. The terminal often looks as if nothing is happening. Just wait until "Uvicorn running on …" appears in the log; after that, the cache is stored in the volume and the next start only takes seconds.

Speech output is very slow on my computer ⌄

CosyVoice is the most compute-hungry of the Thorsten-Voice models and benefits enormously from an NVIDIA GPU (roughly 16 times faster than pure CPU computation). Without a GPU, several seconds to minutes per sentence are normal. On weaker hardware or without a GPU, Kokoro or Piper are the more practical choice.

I want to use a port other than 8000 ⌄

Change the container-internal and host port together via the PORT environment variable, e.g. -p 9000:9000 -e PORT=9000. Only changing the host port in -p is not enough here, because the server would otherwise keep listening on 8000 internally.

"docker: permission denied" on Linux ⌄

Usually your user lacks permission to talk to the Docker daemon. Either run the command with sudo, or add your user to the docker group once (sudo usermod -aG docker $USER, then log in again).

No GPU at hand?

CosyVoice is the top tier. Without a dedicated graphics card, Kokoro or Piper run noticeably more smoothly.

See all guides