This topic uses the Qwen model as an example to walk you through the full lifecycle of model deployment on Alibaba Cloud Model Studio by using API (HTTP) calls, including deploying, querying, inference, deletion, and permission troubleshooting.
Prerequisites
- You have fully read Model deployment and are familiar with the models supported by Alibaba Cloud Model Studio model deployment and the basic steps.
- You have already obtained and configured an API Key and configured the API Key in environment variables. Replace
DASHSCOPE_API_KEYin the sample code with your own Model Studio API Key; if you use the dashscope CLI, also replaceDASHSCOPE_HTTP_BASE_URLwith the API Host you obtained.
1. Deploy a model
The following commands show how to create a dedicated service. Among them, the token-based billing example uses the fine-tuned custom model qwen3-8b-ft-202511132025-0260 to create a dedicated service qwen3-8b-ft-202511132025-0260; the model unit example uses a preset model.
To obtain a custom model ID: Go to Model Studio console - Model fine-tuning, click Task Name -> Output -> click the model name in blue to enter the My Models page, where you can view the model ID in the model basic information area.
Use the Model IDas the input for the model_name parameter to deploy the model by using the API.
- Model unit
- Billed by model token usage
- dashscope CLI
- After you run the deployment command, billing starts as soon as the service is successfully deployed, even if you do not use it. Before proceeding, we recommend you review the service billing rules.
- Computing resources for the post-paid model unit plan are allocated on a first-come, first-served basis. If the purchase is unsuccessful, a full refund will be issued.
Configuration item | Configuration details |
|---|---|
Service name | Custom name for the deployment service. |
Select model | Select the model to deploy, including platform built-in models and fine-tuned models. |
Model unit type | Select the deployment specification. Different specifications correspond to different compute power and performance. |
Model Units per Replica | The number of model units required per replica is jointly determined by the deployment template and model unit type, and cannot be modified. For example, qwen3-32b requires 16 model units per replica. Total Model Units = Deployed Replicas × Model Units per Replica, which determines how many resources the deployed service uses. Increasing the number of deployed replicas consumes more model units and delivers better model performance. |
Deployment replica count | Set the initial number of deployment replicas, which affects the concurrency capacity of the service. |
Deployment template | Select a deployment template (such as "single-node deployment"). Different templates correspond to different resource configuration schemes. Available only under the model unit billing mode. |
Configure model inference mode | For some models deployed in Model Unit mode, you can configure the inference mode, maximum context length, and more.
|
Maximum context length | The Model Unit deployment mode of some models supports this setting. The maximum context length depends on the model type. |
Service rate limiting | The Model Unit deployment mode of some models supports this setting. You can limit the RPM and TPM of model invocations. |
deployed_model is the unique ID of the dedicated service; use this deployed_model value as the identifier in the path of subsequent APIs such as query and deletion (not the name in the request parameters).
2. Query the service status
Use the following command to query the detailed information of a specified dedicated service:
RUNNING, the service deployment is complete.
3. Send inference requests
model parameter should be set to the model code obtained after a successful model 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, refer to the corresponding documentation for adjustments.
Parameter Name | Recommended value (corresponding to the vLLM default) |
|---|---|
temperature | Value range [0, 2); setting it to 1.0 is equivalent to the vLLM engine default. |
top_p | Value range (0, 1.0]; setting it to 1.0 is equivalent to the vLLM engine default. |
top_k | When the value is None or greater than 100, the top_k policy is not enabled and only top_p takes effect; setting it to 99 does not support full sampling, which is close to the vLLM default of 0 (full sampling). |
presence_penalty | Value range [-2.0, 2.0]; setting it to 0 is equivalent to the vLLM engine default. |
repetition_penalty (DashScope protocol) | Increasing this value reduces repetition in generation; 1.0 means no penalty; the value range is greater than 0, and setting it to 1.0 is equivalent to the vLLM engine default. |
4. Delete the dedicated service
You can delete dedicated services that are 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, make sure your account has the Model Deployment-Actions permission on the permission management page of the workspace. If you cannot perform operations, contact your organization or IT administrator to add the required permissions or check the permission issues for you.
-
If the error "Workspace xx does not have permission to deploy model xx" is reported 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 you are prompted about insufficient permissions, contact your organization or IT administrator to add the relevant permissions or perform the operation on your behalf.
API deployment
When deploying models via API, you need to 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 an insufficient-permission message appears, contact your organization or IT administrator to add the required permissions or perform the operations for you.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, switch to the corresponding workspace, and then click
Check the model deployment permission settings of the corresponding workspace.
API call error:
In the left-side navigation pane, click Permission Management and confirm that the user list includes the API Key's owner account (with type primary account). If you are prompted about insufficient permissions, contact your organization or IT administrator to add the relevant permissions or perform the operation on your behalf.Workspace access denied.