This repository provides an OpenAI-compatible Text-to-Speech (TTS) API for the MOSS-TTS 1.7B Local Transformer model. It includes optimizations for Windows and NVIDIA GPUs, featuring Flash Attention 2 support.
The following benchmarks were conducted on a high-end laptop to establish a baseline for real-world usage.
MOSS-TTS originally uses PyTorch's SDPA (Scaled Dot-Product Attention). By upgrading to Flash Attention 2, we achieved significant throughput improvements, especially on longer text strings.
| Metric | SDPA (Default) | Flash Attention 2.8.3 | Improvement |
|---|---|---|---|
| 3 Words (Warm) | 11.54s | 10.26s | ~11% |
| 151 Characters | 65.59s | 43.50s | ~34% |
| 90s Rendering Budget | ~210 chars | ~310 chars | ~47% |
[!TIP] 90-Second Budget: For real-time applications, we recommend keeping individual requests under 300 characters to stay within a 90-second response window.
This implementation uses the MossTTSLocal architecture for the 1.7B model. It is significantly faster than the 8B "Delay" architecture while maintaining high emotional range.
To achieve the performance metrics above, we utilized a specific pre-compiled wheel for Windows/Python 3.13:
flash_attn-2.8.3+cu130torch2.9.1cxx11abiTRUE-cp313-cp313-win_amd64.whl# Install dependencies
pip install -r requirements.txt
# Run the server
python server.py --port 8090
The server adheres to the OpenAI /v1/audio/speech specification.
$body = @{
model = "moss-tts"
input = "Hello, I am a demon of the Fifth Circle."
voice = "default"
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8090/v1/audio/speech" -Method Post -Body $body -ContentType "application/json" -OutFile "output.ogg"
voice parameter mapping.Maintained by OpenMOSS community contributors.
Python
100.0%
This repository provides an OpenAI-compatible Text-to-Speech (TTS) API for the MOSS-TTS 1.7B Local Transformer model. It includes optimizations for Windows and NVIDIA GPUs, featuring Flash Attention 2 support.
The following benchmarks were conducted on a high-end laptop to establish a baseline for real-world usage.
MOSS-TTS originally uses PyTorch's SDPA (Scaled Dot-Product Attention). By upgrading to Flash Attention 2, we achieved significant throughput improvements, especially on longer text strings.
| Metric | SDPA (Default) | Flash Attention 2.8.3 | Improvement |
|---|---|---|---|
| 3 Words (Warm) | 11.54s | 10.26s | ~11% |
| 151 Characters | 65.59s | 43.50s | ~34% |
| 90s Rendering Budget | ~210 chars | ~310 chars | ~47% |
[!TIP] 90-Second Budget: For real-time applications, we recommend keeping individual requests under 300 characters to stay within a 90-second response window.
This implementation uses the MossTTSLocal architecture for the 1.7B model. It is significantly faster than the 8B "Delay" architecture while maintaining high emotional range.
To achieve the performance metrics above, we utilized a specific pre-compiled wheel for Windows/Python 3.13:
flash_attn-2.8.3+cu130torch2.9.1cxx11abiTRUE-cp313-cp313-win_amd64.whl# Install dependencies
pip install -r requirements.txt
# Run the server
python server.py --port 8090
The server adheres to the OpenAI /v1/audio/speech specification.
$body = @{
model = "moss-tts"
input = "Hello, I am a demon of the Fifth Circle."
voice = "default"
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8090/v1/audio/speech" -Method Post -Body $body -ContentType "application/json" -OutFile "output.ogg"
voice parameter mapping.Maintained by OpenMOSS community contributors.
Python
100.0%