--- title: Chatterbox TTS API emoji: 🗣️ colorFrom: indigo colorTo: purple sdk: docker app_port: 7860 pinned: false --- # Chatterbox TTS API CPU-only FastAPI wrapper around [ResembleAI/chatterbox](https://huggingface.co/ResembleAI/chatterbox) multilingual TTS. ## Setup Space → Settings → Variables and secrets → add secret `API_KEY`. ## Usage ```bash curl -X POST https://-.hf.space/tts \ -H "x-api-key: $API_KEY" -H "content-type: application/json" \ -d '{"text": "Hello there", "lang": "en"}' # {"url": "https://-.hf.space/audio/.wav", "lang": "en"} ``` Then `curl -O ` — the download endpoint is public (unguessable uuid). Params: `text` (required, ≤1000 chars), `lang` (default `en`), `exaggeration` (0–2), `cfg_weight` (0–1). Output is 24kHz mono WAV and always carries Resemble's Perth watermark. Defaults suit most prompts; for more expressive reads the model card suggests `cfg_weight` ~0.3 with `exaggeration` ~0.7. Caveat: upstream `generate()` hardcodes `max_new_tokens=1000` (~40s of audio), so text beyond roughly 600-700 chars is silently truncated. Supported langs: ar, da, de, el, en, es, fi, fr, he, hi, it, ja, ko, ms, nl, no, pl, pt, ru, sv, sw, tr, zh. ## Notes - First request downloads the model (~1–2 min); CPU synthesis takes roughly 10–40s per sentence. Free Spaces sleep when idle, so the first call after a wake is slow. - Audio lives on the ephemeral container disk — links die on restart. Add S3/Blob upload if you need durable URLs.