Publish a trained image generation model as an online API service.
Prerequisites
- Supported regions: The model deployment API is currently available only in the Singapore 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
statusis SUCCEEDED before proceeding with deployment.
Deploy Model
- Singapore
POST https://dashscope-intl.aliyuncs.com/api/v1/deploymentsFor Windows CMD, replace$DASHSCOPE_API_KEYwith%DASHSCOPE_API_KEY%. For PowerShell, replace with$env:DASHSCOPE_API_KEY
Request ParametersHeadersContent-Typestring (Required)Fixed value: application/jsonAuthorization string (Required)API Key authentication, in the 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:
integer (Required)The number of deployed model instances. Recommended value: 1.plan string (Required)Deployment method. Recommended value for LoRA efficient fine-tuning: lora. |
|
Response Parametersrequest_idstringUnique identifier of the request.output objectTask details.
Properties deployed_model stringUnique 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 task creation time.gmt_modified stringDeployment task 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 stringAlibaba Cloud account ID of the creator.modifier stringAlibaba 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). |