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
statusis SUCCEEDED before proceeding with deployment.
Deploy Model
China (Beijing)
POST https://dashscope.aliyuncs.com/api/v1/deployments
For Windows CMD, replace$DASHSCOPE_API_KEYwith%DASHSCOPE_API_KEY%. For PowerShell, replace with$env:DASHSCOPE_API_KEY
Request Parameters |
Deploy Model
|
Headers |
|
|
Content-Type Fixed value: |
|
|
Authorization API Key authentication, in the format |
|
Request Body |
|
|
model_name The model ID to deploy (not the base model name, but the model identifier generated after fine-tuning or export). How to obtain:
|
|
|
capacity The number of deployed model instances. Recommended value: 1. |
|
|
plan Deployment method. Recommended value for LoRA efficient fine-tuning: |
Response Parameters |
Success Response ExampleKey fields:
Error Response Example
|
|
request_id Unique identifier of the request. |
|
|
output Task details. |
|
|
code Error code. Returned when the call fails. |
|
|
message Detailed error description. Returned when the call fails. |
Next Step
Deployment is an asynchronous operation. After calling this API, you can query the deployment status through the Query and Manage Deployments API.