Publish a trained image generation model as an online API service.
Prerequisites
- Supported regions: The model deployment API is currently available only in the China (Beijing) region. If you use other regions, please deploy models through the Model Studio console in that region.
- Account permissions: If you use Alibaba Cloud sub-accounts (RAM users), 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 has been completed. Please first call the Query Fine-tuning Job API to confirm the job status
status is SUCCEEDED before proceeding with deployment.
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 with $env:DASHSCOPE_API_KEY
Request Parameters Headers Content-Type string (Required) Fixed value: application/json Authorization string (Required) API Key authentication, in the 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
output.finetuned_output value from the Create Fine-tuning Job response.
- Exported model: Use the
output[].model_name value from the Query Exported Model Details response.
capacity integer (Required) The number of deployed model instances. Recommended value: 1. plan string (Required) Deployment method. Recommended value for LoRA efficient fine-tuning: lora. | Deploy Modelcurl --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>",
"capacity": 1,
"plan": "lora"
}'
|
Response Parameters request_id string Unique identifier of the request. output object Task details. Properties deployed_model string 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 task creation time. gmt_modified string Deployment task 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 Alibaba Cloud account ID of the creator. modifier string 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 ExampleKey fields: output.deployed_model (unique identifier of the deployed model), output.status (deployment status). {
"request_id": "96020b2e-9072-4c8a-9981-xxxxxxxxx",
"output": {
"deployed_model": "wan2.7-image-pro-ft-202507011122-xxxx",
"gmt_create": "2025-07-01T10:30:00.000",
"gmt_modified": "2025-07-01T10:30:00.000",
"status": "PENDING",
"model_name": "wan2.7-image-pro-ft-202507011122-xxxx",
"base_model": "wan2.7-image-pro",
"workspace_id": "llm-xxxxxxxxx",
"charge_type": "post_paid",
"creator": "12xxxxxxx",
"modifier": "12xxxxxxx",
"plan": "lora"
}
}
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 query the deployment status through the Query and Manage Deployments API.