All apps · 0 apps
MOSS-TTS-Nano-API
Docker app from hsiang's Repository
Overview
Readme
View on GitHubMOSS-TTS-Nano-API
OpenAI-compatible TTS API powered by MOSS-TTS-Nano (Fudan OpenMOSS / MOSI.AI).
100M parameters. 48kHz stereo. 20 languages. Runs on CPU or GPU. Ultra-lightweight — can coexist with other GPU services.
Features
- OpenAI-compatible
/v1/audio/speechendpoint (JSON body) - 100M parameters — smallest high-quality TTS model
- 48kHz stereo output (superior audio quality)
- 20 languages including Chinese, English, Japanese, Korean
- Voice cloning from reference audio
- CPU inference — no GPU required (set DEVICE=cpu)
- Built-in voice presets (zh_1-zh_6, en_1-en_5, jp_1-jp_5, etc.)
- Apache-2.0 license
Quick Start
docker run -d --gpus all \
-p 8080:8080 \
-v /mnt/user/appdata/moss-tts-nano-api/models:/root/.cache/huggingface \
--shm-size=2g \
--name moss-tts-nano-api \
ghcr.io/hsiang-han/moss-tts-nano-api:latest
CPU-only (no GPU needed):
docker run -d \
-p 8080:8080 \
-v /mnt/user/appdata/moss-tts-nano-api/models:/root/.cache/huggingface \
-e DEVICE=cpu \
--name moss-tts-nano-api \
ghcr.io/hsiang-han/moss-tts-nano-api:latest
First start downloads model from HuggingFace. China users: set HF_ENDPOINT=https://hf-mirror.com.
Usage Examples
# Default Chinese voice
curl -X POST http://localhost:8080/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{"input": "你好世界", "voice": "zh_1"}' \
--output output.wav
# English voice
curl -X POST http://localhost:8080/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{"input": "Hello world!", "voice": "en_1"}' \
--output english.wav
# Voice cloning
curl -X POST http://localhost:8080/v1/audio/speech/clone \
-F "input=这是克隆的声音" \
-F "ref_audio=@reference.wav" \
--output cloned.wav
# List available voices
curl http://localhost:8080/v1/voices
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/audio/speech |
POST | Text-to-speech (JSON, OpenAI-compatible) |
/v1/audio/speech/clone |
POST | Voice cloning (Form + file upload) |
/v1/voices |
GET | List available voice presets |
/v1/models |
GET | List models |
/health |
GET | Health check |
/docs |
GET | Swagger documentation |
Environment Variables
| Variable | Default | Description |
|---|---|---|
| MODEL_ID | OpenMOSS-Team/MOSS-TTS-Nano-100M | HuggingFace model ID |
| DEVICE | auto | Compute device (auto, cuda:0, cpu) |
| DTYPE | auto | Model precision |
| DEFAULT_VOICE | zh_1 | Default voice preset |
| PORT | 8080 | API server port |
| HF_ENDPOINT | https://huggingface.co | HuggingFace mirror |
Hardware Requirements
- GPU mode: Any NVIDIA GPU with 1GB+ VRAM
- CPU mode: 4+ cores recommended, 2GB+ RAM
- Docker (with NVIDIA Container Toolkit for GPU mode)
Credits
- MOSS-TTS-Nano by OpenMOSS (Fudan University NLP Lab / MOSI.AI)
License
Apache-2.0
Categories
Related apps
Explore more like this
Explore allDetails
ghcr.io/hsiang-han/moss-tts-nano-api:latestRuntime arguments
- Web UI
http://[IP]:[PORT:8080]/docs- Network
bridge- Shell
bash- Privileged
- false
- Extra Params
--gpus all --shm-size=2g
Template configuration
OpenAI-compatible TTS API port. Swagger docs at /docs
- Target
- 8080
- Default
- 8080
- Value
- 8080
Model download cache. Persists across container recreates.
- Target
- /root/.cache/huggingface
- Default
- /mnt/user/appdata/moss-tts-nano-api/models
- Value
- /mnt/user/appdata/moss-tts-nano-api/models
Compute device: auto (GPU if available, else CPU), cuda:0, or cpu.
- Target
- DEVICE
- Default
- auto
- Value
- auto
Default voice preset when none specified. Options: zh_1-zh_6, en_1-en_5, jp_1-jp_5, etc.
- Target
- DEFAULT_VOICE
- Default
- zh_1
- Value
- zh_1
HuggingFace download endpoint. China users: change to https://hf-mirror.com for faster downloads.
- Target
- HF_ENDPOINT
- Default
- https://huggingface.co
- Value
- https://huggingface.co
GPU selection (all, 0, 1, etc.)
- Target
- NVIDIA_VISIBLE_DEVICES
- Default
- all
- Value
- all
NVIDIA driver capabilities
- Target
- NVIDIA_DRIVER_CAPABILITIES
- Default
- compute,utility
- Value
- compute,utility