Skip to main content
視頻產生

視頻產生-部署模型

將訓練好的模型發布為線上 API 服務。

適用範圍

  • 適用地區:當前模型部署 API 僅在新加坡地區開放。如您使用其他地區,請通過該地區的百鍊控制台完成模型部署操作。
  • 開通帳號許可權:若使用阿里雲子帳號RAM使用者),需要為子帳號授予模型調用、訓練和部署許可權
  • 配置環境變數:已成功擷取 API Key,並配置到環境變數
  • 前提條件:已完成模型微調訓練。請先調用查詢調優任務介面,確認任務狀態 statusSUCCEEDED 後再進行部署。

部署模型

  • 新加坡
POST https://dashscope-intl.aliyuncs.com/api/v1/deployments
Windows CMD 請將$DASHSCOPE_API_KEY替換為%DASHSCOPE_API_KEY%,PowerShell請替換為 $env:DASHSCOPE_API_KEY

請求參數

要求標頭(Headers)
Content-Type string (必選)固定值:application/jsonAuthorization string (必選)API Key鑒權,格式為Bearer sk-xxxx
請求體(Request Body)
model_name string (必選)待部署的模型ID(非基本模型名稱,而是微調或匯出後產生的模型標識)。擷取方式:
  • 微調產出的模型:使用建立調優任務響應中 output.finetuned_output 的值,格式如 wan2.5-i2v-preview-ft-202511111122-xxxx
  • 匯出的模型:使用查詢匯出的模型詳情響應中 output[].model_name 的值。
capacity integer (必選)部署的模型執行個體數量。推薦設定為1。plan string (必選)部署方式。LoRA高效微調推薦為loraaigc_config object (必選)提示詞配置。

aigc_config 屬性

use_input_prompt boolean (必選)控制調用已部署模型產生視頻時的提示詞來源。
  • false(預設值):自動產生模式。調用視頻產生介面時,系統忽略傳入的 prompt,強制使用 aigc_config.promptaigc_config.lora_prompt_default 配置的模板自動產生提示詞。
  • true:手動傳入模式。調用視頻產生介面時,系統直接使用傳入的 prompt,上述兩個參數將全部失效。
prompt string (必選)預設的Prompt模板。僅在use_input_prompt=false時生效。調用已部署模型產生視頻時,系統會分析輸入映像,將畫面內容填入該模板,自動產生帶特效指令的完整描述。注意:此參數會覆蓋視頻產生介面中傳入的 prompt 參數。lora_prompt_default string (必選)備用Prompt模板。僅在use_input_prompt=false時生效。當使用aigc_config.prompt產生失敗時,系統將使用此參數作為兜底提示詞來產生視頻。
  • 圖生視頻-基於首幀
  • 圖生視頻-基於首尾幀
以下樣本以金錢雨特效為例,上傳一張人物圖片,系統自動產生帶有特效的視頻。
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/deployments' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model_name": "<替換為模型名稱model_name>",
    "aigc_config": {
        "use_input_prompt": false,
        "prompt": "Provide a video description based on the image content. The description must include the phrase "Then the s86b5p money rain effect begins, countless huge-sized US dollar bills (beige background/dark green patterns) pour down like a torrential rain, densely hitting and surrounding her. The bills continue to fall, she/he stretches her/his arms upward, neck slightly tilted back, expression surprised, completely immersed in this wild money rain."\nOutput Template:\nThe video begins with a shot of [subject description]. [Environment description]. Then the s86b5p money rain effect begins, countless huge-sized US dollar bills (beige background/dark green patterns) pour down like a torrential rain, densely hitting and surrounding her. The bills continue to fall, she/he stretches her/his arms upward, neck slightly tilted back, expression surprised, completely immersed in this wild money rain.\nExample:\nThe video begins showing a young woman standing in front of a brick wall covered with ivy. She has long, smooth reddish-brown hair, wearing a white sleeveless dress, a shiny silver necklace, and a smile on her face. The brick wall in the background is covered with green vines, appearing rustic and natural. Then the s86b5p money rain effect begins, countless huge-sized US dollar bills (beige background/dark green patterns) pour down like a torrential rain, densely hitting and surrounding her. The bills continue to fall, she stretches her arms upward, neck slightly tilted back, expression surprised, completely immersed in this wild money rain.",
        "lora_prompt_default": "Then the s86b5p money rain effect begins, countless huge-sized US dollar bills (beige background/dark green patterns) pour down like a torrential rain, densely hitting and surrounding her. The bills continue to fall, she/he stretches her/his arms upward, neck slightly tilted back, expression surprised, completely immersed in this wild money rain."
    },
    "capacity": 1,
    "plan": "lora"
}'

響應參數

request_id string請求的唯一識別碼。output object任務詳情。

屬性

deployed_model string部署模型的唯一標識。用於查詢模型部署狀態和調用模型。model_name string模型標識名。status string部署狀態:
  • PENDING:部署中。
  • RUNNING:運行中。
  • FAILED:部署失敗。
base_model string使用的基準模型。gmt_create string部署任務建立時間。gmt_modified string部署任務更新時間。workspace_id string阿里雲百鍊API Key所屬的業務空間ID。請參見擷取Workspace IDcharge_type string付費模式。post_paid表示後付費。creator string建立人的阿里雲帳號ID。modifier string修改人的阿里雲帳號ID。plan string部署方式。
code string錯誤碼。調用失敗時返回。請參見下方錯誤碼錶。message string錯誤詳情描述。調用失敗時返回。
  • 成功響應樣本
  • 錯誤響應樣本
重點關註:output.deployed_model(部署模型的唯一標識)、output.status(部署狀態)。
{
    "request_id": "96020b2e-9072-4c8a-9981-xxxxxxxxx",
    "output": {
        "deployed_model": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "gmt_create": "2025-11-11T17:46:53.294",
        "gmt_modified": "2025-11-11T17:46:53.294",
        "status": "PENDING",
        "model_name": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "base_model": "wan2.5-i2v-preview",
        "workspace_id": "llm-xxxxxxxxx",
        "charge_type": "post_paid",
        "creator": "12xxxxxxx",
        "modifier": "12xxxxxxx",
        "plan": "lora"
    }
}

Prompt 模板配置

以下說明如何配置 aigc_config.prompt 參數。
  • 為什麼要設定這個參數 如果不設定此參數,每次調用已部署模型都需要手動編寫完整 Prompt;設定後,調用微調模型產生視頻時,只需上傳圖片,系統會根據此參數自動補全特效指令,無需手動輸入 Prompt。
  • 如何設定? Prompt = 任務指令(告訴模型要做什麼)+ 輸出模板(規範輸出格式)+ 樣本(讓模型學習樣本結構)。
根據映像內容提供視頻描述,描述必須包含"然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞她(他)。鈔票持續落下,同時鏡頭緩緩拉進,她(他)雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中"。
輸出模版:
視頻開頭展示了[主體描述]。[環境描述]。然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞她(他)。鈔票持續落下,同時鏡頭緩緩拉進,她(他)雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中。
樣本:
視頻開頭展示了一位年輕女性在海灘上的情境。她的頭髮濕漉漉的,呈現出深棕色,捲曲且略顯淩亂。她的臉上帶著燦爛的笑容。背景是波濤洶湧的海浪和遠處的山脈。然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞她。鈔票持續落下,同時鏡頭緩緩拉進,她雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中。
關於"輸出模板"描述,請參見視頻標註:為視頻編寫Prompt

下一步

部署為非同步作業,調用本介面後可通過查詢和管理部署介面查詢部署狀態。