PocketTTS.cpp in Docker for OpenClaw
April 18, 2026 ยท View on GitHub
Overview
You want to add good Text to speech support to OpenClaw, but you don't want to pay for third party services? This is the place for you!
Since PocketTTS.cpp already exposes an OpenAI endpoint, this repo helps you easily set it up in a Docker container and walks you through the process of configuring it in OpenClaw. You do not need to install any other OpenClaw plugins, as the OpenAI TTS Plugin is available by default and we're going to emulate that endpoint.
- Run PocketTTS.cpp, a super fast Text To Speech engine, locally on system for your OpenClaw deployment.
- No GPU required, CPU only - saves your expensive GPU and memory for your Agent.
- Runs in a Docker container.
- Exposes the OpenAI compatible Create Speech endpoint. No subscriptions or API keys required.
What's in the repo
This repository contains a standalone Dockerized build of PocketTTS.cpp.
It is a multi-stage image that:
- builds
PocketTTS.cppfrom source - exports/converts PocketTTS models to ONNX
- expects voice samples in the local
voices/folder (bind-mounted into the container at runtime) - runs the PocketTTS.cpp HTTP server at container startup
Build the container
Before we can start the container and configure OpenClaw, we need to build the Docker container. This should take a few minutes. Note that it will download the required model and convert it to ONNX format. Voice files are supplied from your local voices/ folder when you run the container.
docker build -t pockettts-cpp:local .
Make sure your local voices/ folder contains at least one voice sample before starting the container. The default configuration expects a voice named alba (for example voices/alba).
There are two scenarios for your next step and this depends on how you installed OpenClaw. If you're running it directly on the host machine, read the next section, otherwise skip to OpenClaw in Docker.
OpenClaw on Host
Start the container
If you have installed OpenClaw on your host machine (as opposed to in Docker), run the following command to start the container. In this mode, the container is bound to localhost on port 8711.
docker compose up -d
You should be able to browse to the health check endpoint: http://127.0.0.1:8711/health
Verify the audio generation is working with the following command. It will write the audio to a file called output.wav in the current directory.
curl http://localhost:8711/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{
"input": "Hello from the native OpenClaw test",
"voice": "alba",
"response_format": "wav"
}' \
--output output.wav
Configure OpenClaw
openclaw config set --batch-json '[
{ "path": "messages.tts.provider", "value": "openai" },
{ "path": "messages.tts.auto", "value": "always" },
{ "path": "messages.tts.providers.openai.apiKey", "value": "ignored" },
{ "path": "messages.tts.providers.openai.baseUrl", "value": "http://localhost:8711/v1" },
{ "path": "messages.tts.providers.openai.model", "value": "ignored" },
{ "path": "messages.tts.providers.openai.voice", "value": "alba" },
{ "path": "messages.tts.providers.openai.responseFormat", "value": "wav" }
]'
Restart the gateway to apply it:
openclaw gateway restart
Skip to Testing it in OpenClaw.
OpenClaw in Docker
Start the container
If you have installed OpenClaw in a Docker container, run the following command to start the container. In this mode, the container is bound exposed to the OpenClaw Docker network on port 8000.
docker compose -f docker-compose.openclaw-network.yml up -d
This will create the container, alias it as pockettts-cpp and bind it to the default OpenClaw docker network openclaw_default. This is relevant to understand, since when we configure our TTS in OpenClaw, we address it by the service name pockettts-cpp.
It's a bit more difficult to test this configuration, since we're keeping the TTS container on the private Docker network between OpenClaw and pockettts-cpp.
We're going to temporarily create a proxy: Using a Socat (Socket Cat) container acts as a network bridge. It sits on the internal Docker network and tunnels traffic from a port on your host machine directly to the TTS container inside the private network.
In one terminal run this:
docker run --rm -it \
--name openclaw-proxy \
--network openclaw_default \
-p 8711:8000 \
alpine/socat \
tcp-listen:8000,fork,reuseaddr tcp:pockettts-cpp:8000
In another terminal, you can now test the TTS server:
curl -X POST http://localhost:8711/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{
"input": "Hello from the native OpenClaw test",
"voice": "alba",
"response_format": "wav"
}' \
--output output.wav
You can Ctrl+C in the first terminal (running openclaw-proxy) to stop the proxy container.
Configure OpenClaw
This section assumes you've installed ClawDock. To configure OpenClaw to use the OpenAI TTS endpoint, use the following command:
clawdock-cli config set --batch-json '[
{ "path": "messages.tts.provider", "value": "openai" },
{ "path": "messages.tts.auto", "value": "always" },
{ "path": "messages.tts.providers.openai.apiKey", "value": "ignored" },
{ "path": "messages.tts.providers.openai.baseUrl", "value": "http://pockettts-cpp:8000/v1" },
{ "path": "messages.tts.providers.openai.model", "value": "ignored" },
{ "path": "messages.tts.providers.openai.voice", "value": "alba" },
{ "path": "messages.tts.providers.openai.responseFormat", "value": "wav" }
]'
Restart the gateway to apply it:
clawdock-cli gateway restart
Test it in OpenClaw
- In your Agent chat session, use the command
/ttsto view available commands - While it should already be set, you can use
/tts provider openaito configure it to use the OpenAI provider we added /tts audio This is a testshould respond with a wav file corresponding to "This is a test"/tts onwill configure it to always respond with an audio version of the Agent's response
API exposed by PocketTTS.cpp
POST /v1/audio/speech(OpenAI-compatible)POST /tts(JSON streaming endpoint)GET /health
Notes
- Voice files are stored in the local
./voicesfolder, bind-mounted to/app/voices. - If PocketTTS.cpp generates cache files alongside the voices, they will also appear in that local folder.
- Image defaults to HTTP server mode (
--server --port 8000).