{"id":43138438,"url":"https://github.com/neosun100/cosyvoice-docker","last_synced_at":"2026-01-31T22:10:52.050Z","repository":{"id":329254270,"uuid":"1118779146","full_name":"neosun100/cosyvoice-docker","owner":"neosun100","description":"🎙️ CosyVoice All-in-One Docker - Production-ready TTS with Web UI, REST API \u0026 Voice Cloning","archived":false,"fork":false,"pushed_at":"2026-01-18T15:37:08.000Z","size":2898,"stargazers_count":20,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-18T23:20:02.533Z","etag":null,"topics":["alibaba","chinese-tts","cosyvoice","docker","openai-api","speech-synthesis","streaming","text-to-speech","tts","voice-cloning"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neosun100.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-18T09:10:45.000Z","updated_at":"2026-01-18T23:05:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/neosun100/cosyvoice-docker","commit_stats":null,"previous_names":["neosun100/cosyvoice-docker"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/neosun100/cosyvoice-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosun100%2Fcosyvoice-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosun100%2Fcosyvoice-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosun100%2Fcosyvoice-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosun100%2Fcosyvoice-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neosun100","download_url":"https://codeload.github.com/neosun100/cosyvoice-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosun100%2Fcosyvoice-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28957186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alibaba","chinese-tts","cosyvoice","docker","openai-api","speech-synthesis","streaming","text-to-speech","tts","voice-cloning"],"created_at":"2026-01-31T22:10:51.509Z","updated_at":"2026-01-31T22:10:52.044Z","avatar_url":"https://github.com/neosun100.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[English](README.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md)\n\n\u003cdiv align=\"center\"\u003e\n\n# 🎙️ CosyVoice All-in-One Docker\n\n[![Docker Pulls](https://img.shields.io/docker/pulls/neosun/cosyvoice?style=flat-square\u0026logo=docker)](https://hub.docker.com/r/neosun/cosyvoice)\n[![Docker Image Version](https://img.shields.io/docker/v/neosun/cosyvoice?style=flat-square\u0026logo=docker\u0026sort=semver)](https://hub.docker.com/r/neosun/cosyvoice)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](LICENSE)\n[![GitHub Stars](https://img.shields.io/github/stars/neosun100/cosyvoice-docker?style=flat-square\u0026logo=github)](https://github.com/neosun100/cosyvoice-docker)\n\n**Production-ready Text-to-Speech service based on Fun-CosyVoice3-0.5B**\n\nOne Docker command to get Web UI + REST API + Voice Cloning\n\n[Quick Start](#-quick-start) • [Features](#-features) • [API Docs](#-api-reference) • [Performance](#-performance-benchmarks)\n\n\u003c/div\u003e\n\n---\n\n## 📸 Screenshot\n\n![Web UI](assets/ui-screenshot.png)\n\n## ✨ Features\n\n| Feature | Description |\n|---------|-------------|\n| 🎯 **Fun-CosyVoice3-0.5B** | Latest \u0026 best TTS model from Alibaba |\n| 🎤 **Fun-ASR-Nano** | Auto speech recognition (replaces Whisper) |\n| 🔌 **OpenAI Compatible API** | Drop-in replacement for `/v1/audio/speech` |\n| 👤 **Custom Voice Management** | Upload once, use by voice_id |\n| ⚡ **Real Streaming Output** | PCM chunk-by-chunk, ~1.2s TTFB |\n| 🚀 **Embedding Cache** | 53% faster after first use |\n| 🌐 **Web UI** | Beautiful interface with download button |\n| 🌍 **Multi-language** | Chinese, English, Japanese, Korean + 18 dialects |\n\n## 🚀 Quick Start\n\n```bash\ndocker run -d \\\n  --name cosyvoice \\\n  --gpus '\"device=0\"' \\\n  -p 8188:8188 \\\n  -v cosyvoice-data:/data/voices \\\n  neosun/cosyvoice:latest\n```\n\nThen open http://localhost:8188 🎉\n\n## 📦 Installation\n\n### Prerequisites\n\n- Docker 20.10+\n- Docker Compose v2.0+ (optional)\n- NVIDIA GPU with 8GB+ VRAM\n- NVIDIA Container Toolkit\n\n### Docker Run\n\n```bash\n# Pull the image\ndocker pull neosun/cosyvoice:v3.4.0\n\n# Run with GPU\ndocker run -d \\\n  --name cosyvoice \\\n  --gpus '\"device=0\"' \\\n  -p 8188:8188 \\\n  -v /path/to/voices:/data/voices \\\n  --restart unless-stopped \\\n  neosun/cosyvoice:v3.4.0\n```\n\n### Docker Compose\n\n```yaml\n# docker-compose.yml\nservices:\n  cosyvoice:\n    image: neosun/cosyvoice:v3.4.0\n    container_name: cosyvoice\n    restart: unless-stopped\n    ports:\n      - \"8188:8188\"\n    volumes:\n      - ./voices:/data/voices\n    deploy:\n      resources:\n        reservations:\n          devices:\n            - driver: nvidia\n              device_ids: [\"0\"]\n              capabilities: [gpu]\n```\n\n```bash\ndocker compose up -d\n```\n\n### Health Check\n\n```bash\ncurl http://localhost:8188/health\n# {\"status\":\"healthy\",\"gpu\":{\"model_loaded\":true,...}}\n```\n\n## ⚙️ Configuration\n\n### Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `PORT` | `8188` | Service port |\n| `MODEL_DIR` | `pretrained_models/Fun-CosyVoice3-0.5B` | TTS model path |\n\n### Volume Mounts\n\n| Path | Description |\n|------|-------------|\n| `/data/voices` | Custom voice storage (persistent) |\n\n## 📡 API Reference\n\n### Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/v1/audio/speech` | POST | Text-to-Speech (OpenAI compatible) |\n| `/v1/voices/create` | POST | Create custom voice |\n| `/v1/voices/custom` | GET | List custom voices |\n| `/v1/voices/{id}` | GET/DELETE | Get/Delete voice |\n| `/v1/models` | GET | List models |\n| `/health` | GET | Health check |\n| `/docs` | GET | Swagger UI |\n\n### Create Custom Voice\n\n```bash\n# With text\ncurl -X POST http://localhost:8188/v1/voices/create \\\n  -F \"audio=@voice.wav\" \\\n  -F \"name=MyVoice\" \\\n  -F \"text=Reference text content\"\n\n# Auto transcribe (using Fun-ASR-Nano)\ncurl -X POST http://localhost:8188/v1/voices/create \\\n  -F \"audio=@voice.wav\" \\\n  -F \"name=MyVoice\"\n\n# Response: {\"voice_id\": \"abc123\", \"text\": \"auto transcribed text\", ...}\n```\n\n### Text-to-Speech\n\n```bash\n# WAV format\ncurl http://localhost:8188/v1/audio/speech \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"input\": \"Hello world\", \"voice\": \"abc123\"}' \\\n  -o output.wav\n\n# PCM streaming (lowest latency)\ncurl http://localhost:8188/v1/audio/speech \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"input\": \"Hello world\", \"voice\": \"abc123\", \"response_format\": \"pcm\"}' \\\n  -o output.pcm\n\n# Convert PCM to WAV\nffmpeg -f s16le -ar 24000 -ac 1 -i output.pcm output.wav\n```\n\n### Python Example\n\n```python\nimport requests\n\n# Create voice\nwith open(\"voice.wav\", \"rb\") as f:\n    resp = requests.post(\n        \"http://localhost:8188/v1/voices/create\",\n        files={\"audio\": f},\n        data={\"name\": \"MyVoice\"}\n    )\n    voice_id = resp.json()[\"voice_id\"]\n\n# Generate speech\nresp = requests.post(\n    \"http://localhost:8188/v1/audio/speech\",\n    json={\"input\": \"Hello world\", \"voice\": voice_id}\n)\nwith open(\"output.wav\", \"wb\") as f:\n    f.write(resp.content)\n```\n\n## 📊 Performance Benchmarks\n\n**Test Environment:** NVIDIA L40S GPU\n\n### First Token Latency (TTFB)\n\n| Text Length | TTFB | Total Time | Audio Duration | RTF |\n|-------------|------|------------|----------------|-----|\n| Short (4 chars) | **1.20s** | 1.55s | 1.88s | 0.82x |\n| Short (10 chars) | **1.34s** | 1.75s | 2.28s | 0.77x |\n| Medium (30 chars) | **1.24s** | 4.98s | 6.88s | 0.72x |\n| Medium (50 chars) | **1.27s** | 12.52s | 17.12s | 0.73x |\n| Long (80 chars) | **1.24s** | 17.91s | 23.68s | 0.76x |\n| Long (120 chars) | **1.35s** | 19.08s | 25.32s | 0.75x |\n\n\u003e RTF (Real-Time Factor) \u003c 1.0 means generation is faster than playback\n\n### Embedding Cache Effect\n\n| Scenario | TTFB | Note |\n|----------|------|------|\n| First use (no cache) | ~3.5s | Extract + cache to GPU |\n| Cached | **~1.2s** | Direct from cache |\n| **Improvement** | **-53%** | |\n\n### ASR (Fun-ASR-Nano) Benchmark\n\n| Audio | Language | Duration | Recognition Time | Result |\n|-------|----------|----------|------------------|--------|\n| Voice sample | Chinese | ~7s | **0.40s** | 希望你以后能够做的比我还好哟。 |\n| Voice sample | Chinese | ~7s | **0.83s** | 对，这就是我万人敬仰的太乙真人... |\n| zh.mp3 | Chinese | ~3s | **0.40s** | 开放时间早上九点至下午五点。 |\n| en.mp3 | English | ~5s | **0.70s** | The tribal chieftain called for the boy... |\n| ja.mp3 | Japanese | ~5s | **0.84s** | うちの中学は弁当制で... |\n\n\u003e Average recognition time: **0.4-0.8s** per audio file\n\n## 🗣️ Supported Languages\n\n### TTS (Fun-CosyVoice3)\n- **Main:** Chinese, English, Japanese, Korean\n- **European:** German, Spanish, French, Italian, Russian\n- **Chinese Dialects:** Cantonese, Sichuan, Dongbei, Shanghai, Minnan + 18 more\n\n### ASR (Fun-ASR-Nano)\n- **Languages:** Chinese, English, Japanese + auto detection\n- **Dialects:** 7 major Chinese dialects + 26 regional accents\n- **Features:** High-noise recognition, lyric recognition\n\n## 🛠️ Tech Stack\n\n- **TTS Model:** [Fun-CosyVoice3-0.5B](https://huggingface.co/FunAudioLLM/Fun-CosyVoice3-0.5B-2512)\n- **ASR Model:** [Fun-ASR-Nano-2512](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512)\n- **Framework:** FastAPI + Gradio\n- **Runtime:** PyTorch + CUDA\n- **Container:** Docker + NVIDIA Container Toolkit\n\n## 📋 Changelog\n\n| Version | Date | Changes |\n|---------|------|---------|\n| v3.4.0 | 2024-12-18 | Fun-ASR-Nano replaces Whisper |\n| v3.3.0 | 2024-12-18 | UI: streaming default, download button, timer |\n| v3.2.1 | 2024-12-18 | Auto preload all voices on startup |\n| v3.2.0 | 2024-12-18 | Embedding cache (-53% TTFB) |\n| v3.1.0 | 2024-12-18 | Polling optimization + model preload |\n| v3.0.0 | 2024-12-18 | All-in-One Docker base version |\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- [FunAudioLLM/CosyVoice](https://github.com/FunAudioLLM/CosyVoice) - Original CosyVoice project\n- [FunAudioLLM/Fun-ASR](https://github.com/FunAudioLLM/Fun-ASR) - Fun-ASR-Nano model\n\n---\n\n## ⭐ Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=neosun100/cosyvoice-docker\u0026type=Date)](https://star-history.com/#neosun100/cosyvoice-docker)\n\n## 📱 Follow Us\n\n![WeChat](https://img.aws.xin/uPic/扫码_搜索联合传播样式-标准色版.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneosun100%2Fcosyvoice-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneosun100%2Fcosyvoice-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneosun100%2Fcosyvoice-docker/lists"}