--- title: indextts2-api emoji: 🗣️ colorFrom: purple colorTo: blue sdk: docker app_port: 7860 pinned: false --- # IndexTTS-2 FastAPI Space (GPU) FastAPI wrapper around [IndexTeam/IndexTTS-2](https://huggingface.co/IndexTeam/IndexTTS-2) (zero-shot voice cloning TTS, zh/en). ## API 所有接口(除 `/`)都需要 header `X-API-Key: `(在 Space secrets 里配置)。 - `POST /generate` — body: `{"text": "...", "speaker_wav": "", "language": "zh"}` 返回 `202 {"job_id", "status_url", "result_url"}`(异步任务) - `GET /status/{job_id}` — 查询任务状态 - `GET /result/{job_id}` — 下载生成的 wav(成功后任务即销毁,只能取一次) - `GET|POST /health` — 健康检查 ## 按需使用(省钱) ```bash uv run hf spaces pause talfaf/indextts2-api # 不用时暂停,不计 GPU 费 uv run hf spaces restart talfaf/indextts2-api # 要用时恢复 uv run hf spaces logs talfaf/indextts2-api # 看日志 ``` 模型权重已烘进镜像,冷启动无需下载 6GB 权重。