# CosyVoice

> Multilingual LLM-based text-to-speech with zero-shot voice cloning and streaming output

- Category: Multimodal Generation / Audio, Music & Voice
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/QwenAudio/CosyVoice
- Website: https://funaudiollm.github.io/cosyvoice3
- Canonical page: https://ai-tldr.dev/tools/cosyvoice/

## In short

CosyVoice is an open-source text-to-speech (TTS) system built on a large language model. From the FunAudioLLM team, it turns written text into natural-sounding speech and can clone a voice from a short reference clip without any per-speaker fine-tuning (zero-shot cloning). It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

CosyVoice is an open-source text-to-speech (TTS) system built on a large language model. From the FunAudioLLM team, it turns written text into natural-sounding speech and can clone a voice from a short reference clip without any per-speaker fine-tuning (zero-shot cloning). The project ships pretrained models, plus full inference, training, and deployment code.

It is designed for multilingual use. Fun-CosyVoice 3.0 covers 9 common languages (Chinese, English, Japanese, Korean, German, Spanish, French, Italian, and Russian) along with 18+ Chinese dialects and accents, and supports cross-lingual voice cloning. It also accepts instructions to control language, dialect, emotion, speed, and volume.

CosyVoice supports bi-directional streaming: text can stream in while audio streams out, with latency reported as low as 150ms. It includes built-in text normalization (reading numbers and special symbols) and pronunciation inpainting for Chinese Pinyin and English CMU phonemes, giving finer control for production use. You can run it from a script, a Gradio web demo, or as a deployed gRPC/FastAPI service.

## What it does

- Zero-shot voice cloning: copy a target voice from a short reference sample, including cross-lingual cloning, with no per-speaker training
- Multilingual coverage: 9 common languages plus 18+ Chinese dialects and accents in the Fun-CosyVoice 3.0 model
- Bi-directional streaming: text-in and audio-out streaming with latency reported as low as 150ms
- Instruction control: adjust language, dialect, emotion, speed, and volume via instructions
- Built-in text normalization for numbers and symbols, plus pronunciation inpainting for Pinyin and CMU phonemes
- Multiple run modes: Python script, Gradio web demo, and gRPC/FastAPI deployment, with optional vLLM and TensorRT-LLM acceleration

## Getting started

CosyVoice runs in a Conda environment. You clone the repo with its submodules, install the Python requirements, download a pretrained model, then run the example script. The team recommends the Fun-CosyVoice3-0.5B model for best quality.

1. Clone the repository with submodules

   Clone the repo recursively so the bundled submodules come along. If the submodule clone fails due to network issues, re-run the update command until it succeeds.

```bash
git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git
cd CosyVoice
git submodule update --init --recursive
```

2. Create the Conda environment and install

   Create a Python 3.10 Conda environment, activate it, and install the requirements.

```bash
conda create -n cosyvoice -y python=3.10
conda activate cosyvoice
pip install -r requirements.txt
```

3. Download a pretrained model

   Download a pretrained model into the pretrained_models folder. You can use ModelScope or, for users outside China, the Hugging Face Hub.

```python
from modelscope import snapshot_download
snapshot_download('FunAudioLLM/Fun-CosyVoice3-0.5B-2512', local_dir='pretrained_models/Fun-CosyVoice3-0.5B')
```

4. Run the example or web demo

   Run example.py to generate speech, or launch the Gradio web demo to try it interactively in the browser.

```bash
python example.py
# or launch the web demo
python3 webui.py --port 50000 --model_dir pretrained_models/CosyVoice-300M
```

## When to use it

- Cloning a specific voice from a short audio sample to narrate text in the same voice, including across languages
- Building multilingual voice assistants or readers that speak Chinese, English, Japanese, Korean, and other supported languages
- Adding low-latency streaming speech output to real-time apps where text is generated and spoken on the fly
- Generating expressive speech with controlled emotion, speed, dialect, or volume for media, dubbing, or accessibility tools
- Deploying a self-hosted TTS service via gRPC or FastAPI, with optional vLLM or TensorRT-LLM acceleration for throughput
