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
statusis SUCCEEDED before deploying.
Deploy model
- China (Beijing)
POST https://dashscope.aliyuncs.com/api/v1/deploymentsFor Windows CMD, replace$DASHSCOPE_API_KEYwith%DASHSCOPE_API_KEY%. For PowerShell, replace it with$env:DASHSCOPE_API_KEY
Request parametersHeadersContent-Typestring (Required)Fixed value: application/jsonAuthorization string (Required)API Key authentication. Format: Bearer sk-xxxx.Request Bodymodel_namestring (Required)The model ID to deploy (not the base model name, but the model identifier generated after fine-tuning or export). How to obtain:
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:
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. |
|
Response parametersrequest_idstringThe unique identifier of the request.output objectJob details.
Properties deployed_model stringThe unique identifier of the deployed model. Used to query model deployment status and invoke the model.model_name stringModel identifier name.status stringDeployment status:
stringThe base model used.gmt_create stringDeployment job creation time.gmt_modified stringDeployment job update time.workspace_id stringThe workspace ID associated with the Alibaba Cloud Model Studio API Key. See Get the Workspace ID.charge_type stringBilling mode. post_paid indicates pay-as-you-go.creator stringThe Alibaba Cloud account ID of the creator.modifier stringThe Alibaba Cloud account ID of the modifier.plan stringDeployment method.stringError code. Returned when the call fails.message stringDetailed error description. Returned when the call fails. |
Key fields: output.deployed_model (unique identifier of the deployed model), output.status (deployment status). |