Speech Synthesis - Deploy Model

Updated at:

Deploy a trained speech synthesis model as an online API service.

Prerequisites

  • Supported region: The features described in this document are only available in the China (Beijing) region, and you must use the API Key from that region.
  • Account permissions: If you use an Alibaba Cloud sub-account (RAM user), you need to grant the sub-account model invocation, training, and deployment permissions.
  • Configure environment variables: You have successfully obtained an API Key and configured it as an environment variable.
  • Prerequisite: Model fine-tuning training is complete. Please first call the Query Tuning Job API to confirm that the job status status is SUCCEEDED before deploying.

Deploy model

China (Beijing)

POST https://dashscope.aliyuncs.com/api/v1/deployments

For Windows CMD, replace $DASHSCOPE_API_KEY with %DASHSCOPE_API_KEY%. For PowerShell, replace it with $env:DASHSCOPE_API_KEY

Request parameters

Headers

Content-Type string (Required)

Fixed value: application/json

Authorization string (Required)

API Key authentication. Format: Bearer sk-xxxx.

Request Body

model_name string (Required)

The model ID to deploy (not the base model name, but the model identifier generated after fine-tuning or export). How to obtain:

  • Fine-tuned model: Use the value of Create a Tuning Job response field output.finetuned_output.
  • Exported model: Use the value of Query Exported Model Details response field output[].model_name.

plan string (Required)

Deployment method. CosyVoice series tuned models only support mu (Model Unit deployment).

deploy_spec string (Required)

Deployment template specification. Can be obtained from the Query Deployable Models API response field template_id. CosyVoice currently supports:

  • MU5: Single-machine deployment, capacity must be a multiple of 1.
  • MU2: Single-machine deployment - flagship complex inference edition, capacity must be a multiple of 8.

capacity integer (Required)

The number of resource units for deployment, must be a multiple of base_capacity. The value constraint depends on deploy_spec, see the description above.

billing_method string (Required)

Billing method. Currently supports POST_PAY (pay-as-you-go).

name string (Optional)

The display name of the model in the console. If not provided, the value of model_name is used automatically.

Deploy model

curl --location 'https://dashscope.aliyuncs.com/api/v1/deployments' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model_name": "<Replace with model_name>",
    "plan": "mu",
    "deploy_spec": "MU5",
    "capacity": 1,
    "billing_method": "POST_PAY"
}'

Response parameters

request_id string

The unique identifier of the request.

output object

Job details.

Properties

deployed_model string

The unique identifier of the deployed model. Used to query model deployment status and invoke the model.

model_name string

Model identifier name.

status string

Deployment status:

  • PENDING: Deploying.
  • RUNNING: Running.
  • FAILED: Deployment failed.

base_model string

The base model used.

gmt_create string

Deployment job creation time.

gmt_modified string

Deployment job update time.

workspace_id string

The workspace ID associated with the Alibaba Cloud Model Studio API Key. See Get the Workspace ID.

charge_type string

Billing mode. post_paid indicates pay-as-you-go.

creator string

The Alibaba Cloud account ID of the creator.

modifier string

The Alibaba Cloud account ID of the modifier.

plan string

Deployment method.

code string

Error code. Returned when the call fails.

message string

Detailed error description. Returned when the call fails.

Success response example

Key fields: output.deployed_model (unique identifier of the deployed model), output.status (deployment status).

{
    "request_id": "96020b2e-9072-4c8a-9981-xxxxxxxxx",
    "output": {
        "deployed_model": "cosyvoice-v3-flash-ft-202507011122-xxxx",
        "gmt_create": "2025-07-01T10:30:00.000",
        "gmt_modified": "2025-07-01T10:30:00.000",
        "status": "PENDING",
        "model_name": "cosyvoice-v3-flash-ft-202507011122-xxxx",
        "base_model": "cosyvoice-v3-flash",
        "workspace_id": "llm-xxxxxxxxx",
        "charge_type": "post_paid",
        "creator": "12xxxxxxx",
        "modifier": "12xxxxxxx",
        "plan": "mu"
    }
}

Error response example

{
    "code": "InvalidParameter",
    "request_id": "BE213CDD-8A5C-59EE-9A67-055EAB0CB59B",
    "message": "The model xxx does not exist or is not deployable"
}

Next step

Deployment is an asynchronous operation. After calling this API, you can use the Query and Manage Deployments API to check the deployment status.