Model or dataset
devnen/Dia-TTS-Server avatar
devnen/Dia-TTS-Server

Dia TTS Server: self-hosting Nari Labs Dia 1.6B and Dia 2 behind an OpenAI-compatible API

Self-host the powerful Dia TTS model. This server offers a user-friendly Web UI, flexible API endpoints (incl. OpenAI compatible), support for SafeTensors/BF16, voice cloning, dialogue generation, and GPU/CPU execution.

355 stars65 forksPythonMIT

At a glance

What is it?
Dia TTS Server is a FastAPI wrapper around the Nari Labs Dia models that adds a web UI, an OpenAI-compatible speech endpoint, hot-swappable switching between Dia 1.6B, Dia2-1B and Dia2-2B, 43 built-in voices and chunking for long text. It is MIT licensed and runs on CUDA with a CPU fallback, but the Dia 2 work has no corresponding published release.
Who is it for?
Run Dia TTS Server if you want dialogue-capable speech generation on your own hardware, with speaker tags and non-verbal cues, and you want to reach it through an OpenAI-compatible endpoint and a browser UI rather than a notebook. Skip it if you need a stable tagged release, since the newest tag is v1.4.0 from 2025-04-29 while the README documents Dia 2 support as a later version, or if you are on CPU only and expect interactive speeds.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 174 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 18, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What it wraps and who it is for

The Dia models from Nari Labs generate speech that sounds like dialogue rather than narration. They take speaker turns written as [S1] and [S2] tags and produce non-verbal cues such as laughter and sighs from parenthesised directions. That makes them a poor fit for reading a single block of prose and a good fit for scripted conversation.

Dia TTS Server exists to make that model usable without writing the surrounding plumbing. It is a FastAPI server with a browser UI, and the README lists what it adds: an OpenAI-compatible endpoint at /v1/audio/speech so tools built against OpenAI's structure can call it, a modern web interface for presets, reference audio and generation parameters, chunking for long inputs, 43 curated voices, an improved cloning pipeline, and seeded generation for repeatable output.

The audience is someone who already wants Dia specifically. If you just need text read aloud, a smaller model with a simpler server will be less work.

Three models, switched without a restart

The server exposes three models: the original Dia 1.6B, plus Dia2-1B, described as streaming at roughly 1B parameters, and Dia2-2B, described as higher quality at roughly 2B. Switching happens from a dropdown above the generation card in the UI, and the README says the server does not need to restart.

Loading happens in a background thread with a progress modal showing download and loading phases, and in-progress downloads can be cancelled. Supporting endpoints are documented: POST /restart_server for async model hot-swap, GET /api/model-info for the current model, GET /api/model-registry for the dropdown, GET /api/model-status for progress, POST /api/cancel-loading, and POST /api/unload to free resources. Models are described centrally in a MODEL_REGISTRY holding Hugging Face repo IDs, parameter counts, voice modes and cloning methods.

Dia 2 also changes how voices are conditioned. The README states Dia 2 uses prefix-speaker conditioning instead of Dia 1's audio_prompt method, which allows an independent voice reference per speaker. Packaging is defensive: both Dia packages are imported inside try and except blocks, so if one is not installed only that model shows as unavailable while the server keeps working.

Installing Dia TTS Server with Docker

Docker is the documented path, and the Compose file defines the service, its ports and the volumes that persist models, reference audio, output and voices:

yaml
services:
  dia-tts-server:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "${PORT:-8003}:${PORT:-8003}"
    volumes:
      - ./model_cache:/app/model_cache
      - ./reference_audio:/app/reference_audio
      - ./outputs:/app/outputs
      - ./voices:/app/voices

The default port is 8003. The Compose file passes GPU access through the devices block for newer Docker and NVIDIA setups, with a commented legacy deploy block as an alternative, sets HF_HUB_ENABLE_HF_TRANSFER=1 for faster Hugging Face downloads, and reads .env for initial config seeding. The image itself is based on nvidia/cuda:12.8.1-runtime-ubuntu22.04 and installs libsndfile1, ffmpeg and build tools before the Python dependencies, and its default command starts the server:

bash
python3 server.py

For a bare-metal install, requirements.txt pulls in fastapi, uvicorn, torch, torchaudio, soundfile, huggingface_hub, descript-audio-codec, safetensors and openai-whisper, with pydub, praat-parselmouth and librosa for post-processing. Two entries need attention: soundfile requires the libsndfile system library, and Dia 2 support is an optional package that is commented out and installed separately.

bash
pip install dia2

Configuration lives in config.yaml, which the application creates, with .env used only for initial setup or reset, so the container is told not to mount config.yaml in.

Voices, cloning and keeping output stable

Two routes produce a consistent voice. Predefined voices are 43 curated synthetic voices in the ./voices directory, selectable in the UI, with the server handling the transcripts they need. Cloning takes a reference clip instead, and the pipeline does the preparation: mono conversion, resampling and truncation of the audio, with the transcript read from a local .txt file in preference to the experimental Whisper fallback added as openai-whisper. Both modes can be combined with a fixed integer seed, and the README states that combination is what gives consistent voice output across multiple generations or chunks.

Weights default to BF16 SafeTensors, which the README says uses roughly half the VRAM and improves speed compared with the original .pth format, and .pth weights remain supported. CUDA is detected automatically with a CPU fallback.

The practical advice implied by the design: start with a predefined voice and a fixed seed. Cloning is the second step, and it depends on supplying a clean transcript, since the Whisper path is explicitly experimental.

Long text, speaker tags and chunking

Dialogue input uses [S1] and [S2] tags for speaker turns and parenthesised cues for non-verbal sounds. Long inputs are handled by splitting on sentence structure and speaker tags, processing the chunks in order, and concatenating the audio. Two parameters control it: split_text to enable the behaviour and chunk_size to set the size, both configurable through the UI and the API.

Chunking is where voice consistency stops being cosmetic. Without a predefined voice, a cloned voice or a fixed seed, each chunk is an independent generation and the joins are audible. The README makes that connection explicitly by presenting seeded generation alongside the chunking feature rather than as a separate nicety.

The v1.4.0 release notes, published on 2025-04-29, describe this feature set: chunking based on sentence structure and speaker tags, 43 predefined voices with server-handled transcripts, an improved cloning backend with automatic reference audio processing, Whisper as an experimental transcript fallback, and a generation seed. The initial v1.0.0 release was published the day before, on 2025-04-28.

Release lag, unpinned dependencies and the licence

The version picture needs care. The repository's newest tag is v1.4.0 from 2025-04-29, but the README describes Dia 2 multi-model support as a v2.0.0 feature set, including the model registry, the hot-swap endpoints and per-speaker conditioning. Anyone installing from a release artifact and anyone cloning the main branch are getting different software, and the last push was on 2026-03-28.

Dependencies are unpinned in requirements.txt, which lists fastapi, torch, torchaudio and numpy without versions. That keeps installs flexible and makes them irreproducible: a fresh install months apart can bring a different torch build, and this project depends on GPU behaviour. The Docker image pins its base instead, nvidia/cuda:12.8.1-runtime-ubuntu22.04, which is the more controlled route.

Licensing is straightforward for the server and quiet about the weights. Dia TTS Server is MIT, and the README badge claims Python 3.10 or newer. The models are pulled from Hugging Face repositories listed in the model registry, and the README does not state their licence terms, so check those separately before any commercial use. The author also points at a newer sibling project, Chatterbox TTS Server, which is worth knowing when judging where future work will go.

Editorial conclusion

Run Dia TTS Server if you want dialogue-capable speech generation on your own hardware, with speaker tags and non-verbal cues, and you want to reach it through an OpenAI-compatible endpoint and a browser UI rather than a notebook. Skip it if you need a stable tagged release, since the newest tag is v1.4.0 from 2025-04-29 while the README documents Dia 2 support as a later version, or if you are on CPU only and expect interactive speeds. Start with the Docker Compose file, confirm the server answers on port 8003, then test a two-speaker script with one of the 43 predefined voices before attempting cloning.

Frequently asked questions

Is Dia TTS Server free to use?

The server is MIT licensed and self-hosted, so there is no usage fee, but you supply the hardware. Models are downloaded from Hugging Face repositories, and the README does not state the licence terms for those weights.

Which models can Dia TTS Server run?

It supports the original Dia 1.6B plus Dia2-1B and Dia2-2B from the Dia 2 family. Models can be switched from the web UI without restarting the server, and loading happens in a background thread with cancellable downloads.

Can Dia TTS Server clone a voice?

Yes. The cloning pipeline processes reference audio automatically with mono conversion, resampling and truncation, and takes the transcript from a local .txt file in preference to the experimental Whisper fallback.

Does Dia TTS Server need a GPU?

CUDA is detected automatically with a fallback to CPU. The Dockerfile is based on nvidia/cuda:12.8.1-runtime-ubuntu22.04 and the Compose file passes GPU access into the container, and the README does not publish latency figures for the CPU path.

Official sources

  1. devnen/Dia-TTS-Server on GitHub
  2. Issues
  3. License: MIT
  4. README
  5. Releases
Community notes

Community notes