This document uses Qwen model deployment as an example to demonstrate the full workflow of deploying models in Alibaba Cloud Model Studio via API (HTTP), including deployment, status query, inference, deletion, and permission troubleshooting.
Prerequisites
- Read Model deployment to understand the supported models and basic steps for model deployment in Alibaba Cloud Model Studio.
- Obtain an API key and export the API key as an environment variable. Replace
DASHSCOPE_API_KEYin the sample code with your own Bailian API key; if you use the dashscope CLI, also setDASHSCOPE_HTTP_BASE_URLto your obtained API Host.
1. Deploy a model
The following commands show how to create a dedicated service. Among them, the example billed by Token uses the fine-tuned custom model qwen3-8b-ft-202511132025-0260 to create a dedicated service qwen3-8b-ft-202511132025-0260; the example billed by model unit uses a preset model.
To obtain a custom model ID, go to the Model Studio console – Model fine-tuning, click the Task Name you want to deploy → Outputs → click the blue model name to open the My Models page. The model ID appears in the basic model information section.
Use the model ID as the value for the model_name parameter to deploy the model via API.
- Billing by model unit usage duration
- Billing by token usage
- dashscope CLI
- After running the deployment command below, billing starts immediately upon successful deployment—even if you have not yet called the model. Confirm the billing rules before deploying.
- Model unit pay-as-you-go computing resources are allocated on a first-come, first-served basis. If purchase fails, you receive a full refund.
Configuration item | Configuration details |
|---|---|
Service name | A custom name for the deployment service. |
Model | Select the model to deploy, including platform preset models and fine-tuned models. |
Model unit type | Select the deployment specification. Different specifications correspond to different computing power and performance. |
Model units per replica | The number of model units required for a single replica, determined jointly by the deployment template and the model unit type, and cannot be modified. For example, qwen3-32b requires 16 model units per replica. Total model units = replica count × model units per replica, which determines how many resources the deployment service uses. Increasing the replica count uses more model units and delivers better model performance. |
Replica count | Set the initial number of deployment replicas, which affects the concurrent processing capability of the service. |
Deployment template | Select a deployment template (for example, "single-node deployment"). Different templates correspond to different resource configuration schemes. Available only in the model unit billing mode. |
Model inference mode | For some models, when deployed in model unit mode, you can configure the inference mode, maximum context, and more.
|
Maximum context | The model unit deployment mode of some models supports this setting. The maximum context length depends on the model type. |
Service throttling | The model unit deployment mode of some models supports this setting, which can limit the RPM and TPM of model calls. |
deployed_model field is the unique ID of the dedicated service. In subsequent query and delete API paths, use this deployed_model value (not the name request parameter).
2. Check service status
Use the following command to query details for a specific dedicated service:
RUNNING, deployment is complete.
3. Make an inference request
model should be the model code generated after successful deployment. Go to the Dedicated Deployment console (Beijing) to obtain it.
Inference parameter alignment
The default parameter values of the Model Studio inference engine may differ from those of local inference frameworks. To align with vLLM defaults, refer to the table below when setting parameters; if you use other frameworks such as SGLang, see the corresponding documentation for adjustments.
Parameter name | Recommended value (matches vLLM defaults) |
|---|---|
temperature | Range: [0, 2). Set to 1.0 to match vLLM's default. |
top_p | Range: (0, 1.0]. Set to 1.0 to match vLLM's default. |
top_k | Set to None or a value greater than 100 to disable top_k sampling (only top_p applies). Setting to 99 approximates vLLM's default value of 0 (full sampling). |
presence_penalty | Range: [-2.0, 2.0]. Set to 0 to match vLLM's default. |
repetition_penalty (DashScope protocol) | Increasing repetition_penalty reduces repetition in generated text. A value of 1.0 means no penalty. Range: greater than 0. Set to 1.0 to match vLLM's default. |
4. Delete a dedicated service
You can delete a dedicated service that is no longer in use with the following command:
Troubleshooting insufficient permissions
If you encounter insufficient permission errors during model deployment, there are two troubleshooting paths depending on the deployment method:
Console deployment
- If "Lack permissions for this module" is displayed, ensure that your account has the Model Deployment-Actions permission on the permission management page of the workspace. If you cannot perform operations properly, contact your organization or IT administrator to add the required permissions or check permission issues on your behalf.
-
If the error "workspace xx does not have permission to deploy model xx" occurs during deployment, go to the Workspaces page in Bailian, and add the deployment permission for the corresponding model to the corresponding workspace.
API call error:
Workspace xxx does not have deployment privilege for model xxxx.
If insufficient permissions are prompted, please contact your organization or IT administrator to add the relevant permissions or operate on your behalf.
API deployment
When deploying models through the API, make sure that:
-
The Workspace that the API Key belongs to has permission to manage the model. Go to the Workspaces page in Bailian, and check the model deployment permission settings of the corresponding workspace.
API call error:
In the Actions column of the corresponding workspace, click Authorization & Throttling Settings. Find the target model in the Models list, and check the authorization status in the Model Deployment column. If Unauthorized is displayed, click Modify in the Actions column to grant authorization. If a message indicating insufficient permissions appears, contact your organization or IT administrator to add the required permissions or perform operations on your behalf.Workspace xxx does not have deployment privilege for model xxxx. -
The Owner Account of the API Key has operation permissions in the Workspace it belongs to. Go to the Bailian console, click the workspace in the lower-left corner to switch to the corresponding workspace, and then click
Check the model deployment permission settings of the corresponding workspace.
API call error:
In the navigation pane on the left, click Permission Management and confirm that the user list includes the API key’s associated account (type: Alibaba Cloud account). If insufficient permissions are prompted, please contact your organization or IT administrator to add the relevant permissions or operate on your behalf.Workspace access denied.