Self-Host Your Own TTS Server with an OpenAI-Compatible API
If you've ever tried to build a voice feature into an app, you know the drill. You either pay per token for a cloud TTS API, or you wrestle with local models that feel like they were built in 2015. I've been there. The whole point of TTS is to make things feel natural, but the setup process often feels anything but.
That's why I was happy to stumble on Chatterbox TTS Server. It gives you a self-hosted TTS engine with an OpenAI-compatible API and a web UI. No cloud dependency, no rate limits, and it works with the tools you already use.
What It Does
Chatterbox TTS Server wraps a local text-to-speech model behind a simple HTTP server. It exposes an endpoint that mimics the OpenAI audio API, so if you've already got code that calls GET /v1/audio/speech, you can point it at your own server and get audio back.
Beyond the API, it also ships with a small web interface. You type text, pick a voice, hit generate, and you get an audio file you can listen to right in the browser. It's a nice way to test voices and settings without touching code.
The heavy lifting is done by Chatterbox TTS under the hood, which is a powerful neural TTS model. The server package just makes it easy to use over HTTP.
Why It's Cool
The OpenAI-compatible part is the real win here. If you're building an app that already uses OpenAI's TTS, you literally just swap the base URL to your self-hosted instance. No SDK changes, no custom clients. That's it.
Here are a few things that stand out:
- Privacy first. Your text never leaves your machine. Great for internal tools or projects with sensitive data.
- No token costs. Once it's running, you can generate as much audio as you want, forever.
- Multiple voices out of the box. You're not stuck with one robotic voice. You can pick from several presets.
- Web UI for quick tests. I usually hate admin panels, but this one is minimal and gets out of the way. You paste text, get audio.
Use cases are broad: automate narration for videos, generate customer service prompts, create voice notifications for your IoT project, or just mess around with making your terminal speak.
How to Try It
Getting started is straightforward. The repo has a Docker setup which is my preferred path because it avoids polluting your local Python environment.
git clone https://github.com/devnen/Chatterbox-TTS-Server
cd Chatterbox-TTS-Server
docker compose up --build
Once the container is up, the web UI should be available at http://localhost:8000. The API endpoint will be at http://localhost:8000/v1/audio/speech.
If you've got a Python script already using OpenAI's TTS, just change the base URL:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")
response = client.audio.speech.create(
model="chattebox",
voice="default",
input="Hello from my self-hosted TTS server!"
)
response.write_to_file("output.mp3")
That's it. No API keys, no cloud signup.
Final Thoughts
This project scratches a real itch. It's not trying to be a massive production platform. It's a focused tool that does one thing well: gives you a modern TTS backend you control entirely.
For devs who are tired of paying per character or who need offline capability, this is a solid pick. The OpenAI-compatible API is the kind of pragmatic design choice that makes adoption painless. I can see this being useful for a lot of side projects and even small internal tools.
If you're into self-hosting or just want to play with TTS without the subscription fatigue, give it a spin.
Found this useful? Follow @githubprojects for more developer tools and project highlights.