All Products
Search
Document Center

Platform For AI:Deploy a CosyVoice 2.0 WebUI service

Last Updated:Apr 14, 2026

Deploy CosyVoice 2.0 on PAI-EAS as a WebUI service and use it to generate speech with voice cloning.

Background information

CosyVoice 2.0 is a speech synthesis model developed by Alibaba DAMO Academy. Trained on large-scale speech corpora with fine-grained prosody modeling, CosyVoice 2.0 generates natural, expressive speech. It clones a target voice from a prompt audio clip of less than 30 seconds and supports cross-lingual cloning.

Advantages:

  • Natural voice: Simulates human rhythm, emotion, and prosody.

  • Multiple use cases: Customer service conversations, audiobook narration, short video voiceovers, and e-commerce voice recommendations.

  • Low latency: Cloud deployment generates smooth speech rapidly.

  • Controllable: Intonation tuning, emotion control, and role customization for a signature brand voice.

The WebUI service is for trial purposes only. For production workloads that require high concurrency, see Deploy a high-performance decoupled service.

Limitations

The Pre-trained Voice inference mode is not supported.

Billing

Deploying the CosyVoice 2.0 service incurs charges for computing resources and the system disk only. To avoid unnecessary charges, go to the Actions column and click Stop when the service is no longer needed. For more information, see Billing of Elastic Algorithm Service (EAS).

Deploy the service

Scenario-based (recommended)

  1. Log on to the PAI console. Select a region on the top of the page. Then, select the desired workspace and click Elastic Algorithm Service (EAS).

  2. On the Inference Service tab, click Deploy Service. In the Scenario-based Model Deployment section, click Deploy CosyVoice for AI Speech Generation.

  3. Configure the following parameters:

    Parameter

    Description

    Basic Information

    Version selection

    Select Standard Edition.

    Environment Information

    Image Version

    Select the image that matches your resource type. Example: cosyvoice-webui:0.2.0-pytorch2.3.1-gpu-py310-cu128-ubuntu22.04.

    Note

    New versions are released frequently. Select the latest image version during deployment.

    Command

    After you select an image version, the system automatically sets the command to /bin/bash /tmp/entry.sh --action=start_webui --port=9000 --data_dir=/mnt/data/ --model_dir=/nasmnt/models/pretrained_models/CosyVoice2-0.5B/ --ttsfrd_dir=/nasmnt/models/pretrained_models/CosyVoice-ttsfrd/ --workers 1, where:

    • --port: Service port number. Must match the port configured for the EAS service.

    • --data_dir: Mount directory for reference audio and models. Default: /mnt/data. If a storage mount is configured, this value must match the mount path in Storage Mount.

    • --model_dir: Model loading directory.

    The following parameter is also supported:

    • --gpu_memory_utilization: Upper limit for GPU memory utilization.

    Port Number

    After you select the image version, the system automatically configures port number 9000. You do not need to modify it.

    Resource Information

    Resource Type

    This solution uses Public Resources. You can select another resource type based on your needs.

    Instances

    Set this parameter to 1.

    Deployment Resources

    You must select a GPU-accelerated instance type, such as ecs.gn8is.4xlarge or ml.gu8is.c16m128.1-gu60.

    Configure a system disk

    The image file is large. To prevent deployment failures from insufficient disk space, we recommend setting the system disk to at least 100 GiB.

    If you do not set this parameter manually, the EAS backend allocates 100 GiB of storage space by default for the CosyVoice 2.0 scenario.

    Network Information

    VPC

    Optional. Configure this parameter if you need to access the service over a high-speed VPC connection, or if you want to configure public access for the service. From the drop-down lists, select a VPC, vSwitch, and security group. For more information, see Create and manage a VPC and Manage security groups.

  4. After you finish the configuration, click Deploy.

    Deployment typically takes 5 to 10 minutes because pulling the image can be slow. The service is ready when its Service Status changes to Running.

Custom

  1. Log on to the PAI console. Select a region on the top of the page. Then, select the desired workspace and click Elastic Algorithm Service (EAS).

  2. Click Deploy Service. In the Custom Model Deployment section, click Custom Deployment.

  3. On the Custom Deployment page, configure the following parameters. For information about other parameters, see Custom deployment.

    Parameter

    Description

    Environment Information

    Deployment Method

    Select Image-based Deployment and select the Enable Web App check box.

    Image Configuration

    In the Alibaba Cloud Image list, select cosyvoice-webui:0.2.0-pytorch2.3.1-gpu-py310-cu128-ubuntu22.04.

    Note

    New versions are released frequently. We recommend selecting the latest image version during deployment.

    Command

    After you select an image, the system automatically sets the command to /bin/bash /tmp/entry.sh --action=start_webui --port=9000 --data_dir=/mnt/data/ --model_dir=/nasmnt/models/pretrained_models/CosyVoice2-0.5B/ --ttsfrd_dir=/nasmnt/models/pretrained_models/CosyVoice-ttsfrd/ --workers 1, where:

    • --port: Service port number. Must match the port configured for the EAS service.

    • --data_dir: Mount directory for reference audio and models. Default: /mnt/data. If a storage mount is configured, this value must match the mount path in Storage Mount.

    • --model_dir: Model loading directory.

    • --workers: Number of workers for the built-in frontend service. If not specified, the system sets the value based on the resource specification. To access the web application from a browser, set --workers 1.

    The following parameter is also supported:

    • --gpu_memory_utilization: Upper limit for GPU memory utilization.

    Port Number

    After you select an image, the system automatically configures the port number to 9000. No modification is required.

    Resource Information

    Resource Type

    This solution uses Public Resources. You can select another resource type based on your needs.

    Instances

    Set this parameter to 1.

    Deployment Resources

    You must select a GPU-accelerated instance type, such as ecs.gn8is.4xlarge or ml.gu8is.c16m128.1-gu60.

    Configure a system disk

    The image file is large. To prevent deployment failures from insufficient disk space, we recommend setting the system disk to at least 100 GiB.

    If you do not set this parameter manually, the EAS backend allocates 100 GiB of storage space by default for the CosyVoice 2.0 scenario.

    Network Information

    VPC

    Optional. Configure this parameter if you need to access the service over a high-speed VPC connection, or if you want to configure public access for the service. From the drop-down lists, select a VPC, vSwitch, and security group. For more information, see Create and manage a VPC and Manage security groups.

  4. After you finish the configuration, click Deploy.

    Deployment typically takes 5 to 10 minutes because pulling the image can be slow. The service is ready when its Service Status changes to Running.

Generate audio

Use API operations

To generate audio programmatically, call the inference service API. For details, see API Reference.