全部產品
Search
文件中心

Alibaba Cloud Model Studio:視頻產生模型微調API參考

更新時間:Feb 12, 2026

本文檔提供萬相 圖生視頻模型 微調的完整 API 參考。

適用範圍

上傳資料集

API描述:將本地的資料集(.zip 格式)上傳到阿里雲百鍊平台,擷取唯一的檔案ID(id)。

說明

通過 API 上傳時,zip 壓縮包大小 ≤ 1GB

請求介面

POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/files
Content-type: multipart/form-data

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

file

Body (form-data)

file

本機資料集檔案(.zip格式)。

傳參時需使用格式 files=@"<檔案路徑>",路徑可以是相對路徑或絕對路徑。

@"./wan-i2v-training-dataset.zip"

purpose

Body (form-data)

string

微調任務固定為 fine-tune。

fine-tune

出參描述

欄位

類型

描述

樣本值

id

string

檔案ID。檔案在平台內的唯一識別碼,用於建立微調任務。

file-ft-b2416bacc4d742xxxx

object

string

上傳類型。

file

bytes

integer

上傳檔案的位元組數。

73310369

filename

string

檔案名稱。

wan-i2v-training-dataset.zip

purpose

string

任務目標。微調任務固定為 fine-tune。

fine-tune

status

string

上傳檔案的狀態。

processed表示已成功上傳。

processed

created_at

integer

建立時間。格式為Unix 時間戳記。

1766127125

請求樣本

curl --location --request POST 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1/files' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--form 'file=@"./wan-i2v-training-dataset.zip"' \
--form 'purpose="fine-tune"'

響應樣本

請複製並儲存 id,這是上傳資料集的唯一標識。

{
    "id": "file-ft-b2416bacc4d742xxxx",
    "object": "file",
    "bytes": 73310369,
    "filename": "wan-i2v-training-dataset.zip",
    "purpose": "fine-tune",
    "status": "processed",
    "created_at": 1766127125
}

建立微調任務

API描述:基於指定的基準模型和上傳的資料集,啟動模型微調訓練任務。

請求介面

POST https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes
Content-type: application/json

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

model

Body

string

指定微調所用的基準模型。

  • 圖生視頻-基於首幀:wan2.6-i2v、wan2.5-i2v-preview、wan2.2-i2v-flash

  • 圖生視頻-基於首尾幀:wan2.2-kf2v-flash

wan2.5-i2v-preview

training_file_ids

Body

array[string]

訓練集檔案ID數組,可傳入多個ID。

["file-ft-b2416bacc4d742xxxx"]

validation_file_ids

Body

array[string]

驗證集檔案ID數組,可傳入多個ID。

若不提供,系統會從訓練集中自動劃分。

-

training_type

Body

string

微調類型,當前僅支援efficient_sft(LoRA高效微調)。

efficient_sft

hyper_parameters

Body

object

超參數配置。

見下表

超參數(hyper_parameters)

初次訓練時,推薦使用預設的超參數。若模型效果不佳或訓練不收斂,可以嘗試調整 n_epochs或learning_rate等參數。

欄位

類型

必選

描述

預設值

batch_size

int

批次大小

一次性送入模型進行訓練的資料條數。

  • wan2.6-i2v:推薦使用預設值,固定為2。

  • wan2.5-i2v-preview:推薦使用預設值,固定為2。

  • wan2.2-i2v-flash:推薦使用預設值,固定為4。

  • wan2.2-kf2v-flash:推薦使用預設值,固定為4。

wan2.6: 2

wan2.5: 2

wan2.2: 4

n_epochs

int

訓練迴圈次數。

訓練總步數(steps)由訓練輪數(n_epochs)、資料集大小和批大小(batch_size)共同決定,計算公式為:steps = n_epochs × 向上取整(資料集大小 / batch_size)。

為確保模型充分訓練,建議總訓練步數不少於 800 步。推薦的最小訓練輪數可按此公式估算:n_epochs = 800 / 向上取整(資料集大小 / batch_size)

例如:資料集有5條資料,batch_size為2,則每輪訓練步數=向上取整(5/2)= 3,所需最小訓練輪數n_epochs = 800 / 3 ≈ 267。此值為推薦最小值,可適當調高。

400

learning_rate

float

學習率。控制模型權重更新的幅度。

過高可能導致模型變差,過低則變化不明顯。推薦使用預設值。

2e-5

eval_epochs

int

驗證間隔。取值需≥n_epochs/10

訓練期間每隔多少個epoch進行一次驗證評估,用於階段性評估模型訓練效果。

50

max_pixels

int

訓練視頻的最大解析度

設定訓練集中輸入視頻解析度的像素總數(寬×高)限制。系統僅對超過該值的視頻進行縮放處理,未超限的視頻將保持原樣。

  • wan2.6-i2v:預設 36864。取值範圍:16384 (128×128) ~ 36864 (192×192)。

  • wan2.5-i2v-preview:預設 36864。取值範圍:16384 (128×128) ~ 36864 (192×192)。

  • wan2.2-i2v-flash:預設 262144。取值範圍:65536 (256×256) ~ 262144 (512×512)。

  • wan2.2-kf2v-flash:預設 262144。取值範圍:65536 (256×256) ~ 262144 (512×512)。

wan2.6:36864

wan2.5:36864

wan2.2:262144

split

float

訓練集劃分比例。取值範圍為 (0, 1)。

僅在未指定validation_file_ids時生效。

此參數用於從訓練集中自動按比例拆分出驗證集。例如,0.9表示90%訓練集,10%驗證集。最終驗證集的數量還會受到max_split_val_dataset_sample的限制。

0.9

max_split_val_dataset_sample

int

從訓練集中自動劃分驗證集的最大樣本數。取值需≥1。

僅在未指定validation_file_ids時生效。

該參數為驗證集數量設定了一個上限,具體為:

驗證集數量 = min(資料集總數 × (1 − split), max_split_val_dataset_sample)

例如:資料集共100條,split為0.9 (即取10%作驗證集),max_split_val_dataset_sample為5。計算出的驗證集為10條(100×0.1),但由於上限為5,最終只會使用5條資料作為驗證集。

5

save_total_limit

int

Checkpoint 儲存數量上限。

限制最多儲存的模型數量。系統將始終只儲存訓練產生的最後 N 個 Checkpoint(N 為該參數值)。

20

lora_rank

int

LoRA 低秩矩陣的維數。推薦使用預設值。

該值決定了微調參數量的大小。數值越大,模型擬合能力越強,但訓練速度會變慢。

取值必須為2n(如 16、32、64)。

32

lora_alpha

int

LoRA 權重的縮放係數。推薦使用預設值。

用於調節微調後的參數對原模型權重的影響程度(通常與 lora_rank 配合使用)。

取值必須為2n(如 16、32、64)。

32

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

object

任務詳情。

-

output.job_id

string

模型微調任務唯一標識,用於後續查詢任務狀態。

ft-202511111122-xxxx

output.job_name

string

模型微調任務名稱。

ft-202511111122-xxxx

output.status

string

微調訓練任務的狀態:

  • PENDING:訓練待開始。

  • QUEUING:訓練正在排隊(同時只有一個訓練任務可以進行)。

  • RUNNING:訓練進行中中。

  • CANCELING:訓練正在取消中。

  • SUCCEEDED:訓練成功。

  • FAILED:訓練失敗。

  • CANCELED:訓練已經取消。

PENDING

output.finetuned_output

string

微調後產出的新模型名稱。部署和調用時需要用到。

wan2.5-i2v-preview-ft-202511111122-xxxx

output.model

string

使用的基準模型。

wan2.5-i2v-preview

output.base_model

string

使用的基準模型。

wan2.5-i2v-preview

output.training_file_ids

array

使用的訓練集檔案ID列表。

["file-ft-b2416bacc4d742xxxx"]

output.validation_file_ids

array

使用的驗證集檔案ID列表。若未上傳驗證集,為空白列表。

[]

output.hyper_parameters

object

實際使用的超參數。

{...}

output.training_type

string

模型微調的訓練方式。固定為efficient_sft。

efficient_sft

output.create_time

string

任務建立時間。

2025-11-11 11:22:22

output.workspace_id

string

阿里雲百鍊API Key所屬的業務空間ID。

請參見擷取Workspace ID

llm-xxxxxxxxx

output.user_identity

string

使用者標識,阿里雲帳號ID。

12xxxxxxx

output.modifier

string

修改人的阿里雲帳號ID。

12xxxxxxx

output.creator

string

建立人的阿里雲帳號ID。

12xxxxxxx

output.group

string

模型微調任務分組。

llm

output.max_output_cnt

integer

訓練期間最多儲存的 checkpoint 數量。

等同於超參數save_total_limit參數的值。

8

請求樣本

請將<替換為訓練資料集的檔案id>完整替換為上傳資料集擷取的檔案ID。

圖生視頻-基於首幀

Wan2.6模型

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model":"wan2.6-i2v",
    "training_file_ids":[
        "<替換為訓練資料集的檔案id>"
    ],
    "training_type":"efficient_sft",
    "hyper_parameters":{
        "n_epochs":400,
        "batch_size":2,
        "learning_rate":2e-5,
        "split":0.9,
        "eval_epochs": 50,
        "max_pixels": 36864
    }
}'

Wan2.5模型

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model":"wan2.5-i2v-preview",
    "training_file_ids":[
        "<替換為訓練資料集的檔案id>"
    ],
    "training_type":"efficient_sft",
    "hyper_parameters":{
        "n_epochs":400,
        "batch_size":2,
        "learning_rate":2e-5,
        "split":0.9,
        "eval_epochs": 50,
        "max_pixels": 36864
    }
}'

Wan2.2模型

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model":"wan2.2-i2v-flash",
    "training_file_ids":[
        "<替換為訓練資料集的檔案id>"
    ],
    "training_type":"efficient_sft",
    "hyper_parameters":{
        "n_epochs":400,
        "batch_size":4,
        "learning_rate":2e-5,
        "split":0.9,
        "eval_epochs": 50,
        "max_pixels": 262144
    }
}'

圖生視頻-基於首尾幀

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model":"wan2.2-kf2v-flash",
    "training_file_ids":[
        "<替換為訓練資料集的檔案id>"
    ],
    "training_type":"efficient_sft",
    "hyper_parameters":{
        "n_epochs":400,
        "batch_size":4,
        "learning_rate":2e-5,
        "split":0.9,
        "eval_epochs": 50,
        "max_pixels": 262144
    }
}'

上傳多個訓練集和驗證集

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model":"wan2.5-i2v-preview",
    "training_file_ids":[
        "<替換為訓練集的檔案id_1>",
        "<替換為訓練集的檔案id_2>"
    ],
    "validation_file_ids":[
         "<替換為驗證集的檔案id_1>",
         "<替換為驗證集的檔案id_2>"
    ],
    "training_type":"efficient_sft",
    "hyper_parameters":{
        "n_epochs":400,
        "batch_size":2,
        "learning_rate":2e-5,
        "split":0.9,
        "eval_epochs": 50,
        "max_pixels": 36864
    }
}'

響應樣本

重點關注這兩個參數:output.job_id(任務ID)output.finetuned_output(微調後產出的新模型名稱)。

{
    "request_id": "0eb05b0c-02ba-414a-9d0c-xxxxxxxxx",
    "output": {
        "job_id": "ft-202511111122-xxxx",
        "job_name": "ft-202511111122-xxxx",
        "status": "PENDING",
        "finetuned_output": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "model": "wan2.5-i2v-preview",
        "base_model": "wan2.5-i2v-preview",
        "training_file_ids": [
            "xxxxxxxxxxxx"
        ],
        "validation_file_ids": [],
        "hyper_parameters": {
            "n_epochs": 400,
            "batch_size": 2,
            "learning_rate": 2.0E-5,
            "split": 0.9,
            "eval_epochs": 50
        },
        "training_type": "efficient_sft",
        "create_time": "2025-11-11 11:22:22",
        "workspace_id": "llm-xxxxxxxxx",
        "user_identity": "12xxxxxxx",
        "modifier": "12xxxxxxx",
        "creator": "12xxxxxxx",
        "group": "llm",
        "max_output_cnt": 20
    }
}

查詢微調任務狀態

API描述:通過 job_id 查詢微調任務進度。輪詢此介面,當任務狀態status 變為 SUCCEEDED,表示模型訓練成功完成。

說明

本文樣本的微調任務訓練需要數小時,具體耗時根據基本模型而定,請耐心等待。

請求介面

GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

job_id

Path parameter

string

微調任務ID。

ft-202511111122-xxxx

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

object

任務詳情。

-

output.job_id

string

模型微調任務唯一標識,用於後續查詢任務狀態。

ft-202511111122-xxxx

output.job_name

string

模型微調任務名稱。

ft-202511111122-xxxx

output.status

string

微調訓練任務的狀態。

  • PENDING:訓練待開始。

  • QUEUING:訓練正在排隊(同時只有一個訓練任務可以進行)。

  • RUNNING:訓練進行中中。

  • CANCELING:訓練正在取消中。

  • SUCCEEDED:訓練成功。

  • FAILED:訓練失敗。

  • CANCELED:訓練已經取消。

PENDING

output.finetuned_output

string

微調後產出的新模型名稱。

wan2.5-i2v-preview-ft-202511111122-xxxx

output.model

string

使用的基準模型。

wan2.5-i2v-preview

output.base_model

string

使用的基準模型。

wan2.5-i2v-preview

output.training_file_ids

array

使用的訓練集檔案ID列表。

["file-ft-b2416bacc4d742xxxx"]

output.validation_file_ids

array

使用的驗證集檔案ID列表。若未上傳驗證集,為空白列表。

[]

output.hyper_parameters

object

實際使用的超參數。

{...}

output.training_type

string

模型微調的訓練方式。固定為efficient_sft。

efficient_sft

output.create_time

string

微調任務建立時間。

2025-11-11 11:22:22

output.end_time

string

微調任務完成時間。

2025-11-11 16:49:01

output.workspace_id

string

阿里雲百鍊API Key所屬的業務空間ID。

請參見擷取Workspace ID

llm-xxxxxxxxx

output.user_identity

string

使用者標識,阿里雲帳號ID。

12xxxxxxx

output.modifier

string

修改人的阿里雲帳號ID。

12xxxxxxx

output.creator

string

建立人的阿里雲帳號ID。

12xxxxxxx

output.group

string

模型微調任務分組。

llm

output.max_output_cnt

integer

最多儲存的 checkpoint 數量。

等同於超參數save_total_limit的值。

8

output.output_cnt

integer

實際儲存的 checkpoint 數量。

該值小於或等於output.max_output_cnt

8

output.usage

integer

訓練消耗的總Token數量,用於模型訓練計費。

432000

請求樣本

請將 URL 中的 <替換為微調任務job_id> 完整替換為建立微調任務輸出參數job_id的值。

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json'

響應樣本

關注兩個參數:output.status(狀態為SUCCEEDED,表示訓練完成)output.usage(訓練消耗的總Token數量)

{
    "request_id": "9bbb953c-bef2-4b59-9fc5-xxxxxxxxx",
    "output": {
        "job_id": "ft-202511111122-xxxx",
        "job_name": "ft-202511111122-xxxx",
        "status": "SUCCEEDED",
        "finetuned_output": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "model": "wan2.5-i2v-preview",
        "base_model": "wan2.5-i2v-preview",
        "training_file_ids": [
            "xxxxxxxxxxxx"
        ],
        "validation_file_ids": [],
        "hyper_parameters": {
            "n_epochs": 400,
            "batch_size": 2,
            "learning_rate": 2.0E-5,
            "split": 0.9,
            "eval_epochs": 50
        },
        "training_type": "efficient_sft",
        "create_time": "2025-11-11 11:22:22",
        "workspace_id": "llm-xxxxxxxxx",
        "user_identity": "xxxxxxxxx",
        "modifier": "xxxxxxxxx",
        "creator": "xxxxxxxxx",
        "end_time": "2025-11-11 16:49:01",
        "group": "llm",
        "usage": 432000,
        "max_output_cnt": 8,
        "output_cnt": 8
    }
}

部署模型

API描述:將訓練好的模型發布為線上 API 服務。請先查詢微調任務狀態,確保模型訓練任務的狀態status 為 SUCCEEDED

請求介面

POST https://dashscope-intl.aliyuncs.com/api/v1/deployments
Content-Type: application/json

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

model_name

Body

string

待部署的模型名稱。

wan2.5-i2v-preview-ft-202511111122-xxxx

capacity

Body

integer

部署的模型執行個體數量。推薦設定為1。

1

plan

Body

string

部署方式。LoRA高效微調固定為lora

lora

aigc_config

Body

object

提示詞配置。

-

aigc_config.use_input_prompt

Body

boolean

用於控制 API 呼叫時的提示詞產生邏輯。

  • false(預設值):自動產生模式。系統忽略在 API 介面傳入的 prompt,強制使用下方兩個參數配置的模板,自動產生提示詞。

  • true:手動傳入模式。系統直接使用在 API 介面傳入的 prompt。下方配置的模板參數將全部失效。

false

aigc_config.prompt

Body

string

預設的Prompt模板。

僅在use_input_prompt=false時生效。

在模型調用時,系統會分析輸入映像,將畫面內容填入該模板,自動產生帶特效指令的完整描述。

注意:此參數會自動覆蓋模型調用介面中傳入的 prompt 參數。

根據映像內容提供視頻描述...

請參見請求樣本

aigc_config.lora_prompt_default

Body

string

備用Prompt模板。

僅在use_input_prompt=false時生效。

當使用aigc_config.prompt產生失敗時,將使用此參數來產生視頻。

然後開始展示s86b5p金錢雨特效...

請參見請求樣本

關於aigc_config.prompt參數說明

  • 為什麼要設定這個參數

    如果不設定此參數,每次調用模型都需要手動編寫完整 Prompt;設定後,調用微調模型時,只需上傳圖片,系統會根據此參數自動補全特效指令,無需手動輸入 Prompt。

  • 如何設定?

    Prompt = 任務指令(告訴模型要做什麼)+ 輸出模板(規範輸出格式)+ 樣本(讓模型學習樣本結構)。

    根據映像內容提供視頻描述,描述必須包含“然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞她(他)。鈔票持續落下,同時鏡頭緩緩拉進,她(他)雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中”。
    輸出模版:
    視頻開頭展示了[主體描述]。[環境描述]。然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞她(他)。鈔票持續落下,同時鏡頭緩緩拉進,她(他)雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中。
    樣本:
    視頻開頭展示了一位年輕女性在海灘上的情境。她的頭髮濕漉漉的,呈現出深棕色,捲曲且略顯淩亂。她的臉上帶著燦爛的笑容。背景是波濤洶湧的海浪和遠處的山脈。然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞她。鈔票持續落下,同時鏡頭緩緩拉進,她雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中。
    關於“輸出模板”描述,請參見視頻標註:為視頻編寫Prompt

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

object

任務詳情。

-

output.deployed_model

string

部署模型的唯一標識。

用於查詢模型部署狀態和調用模型。

wan2.5-i2v-preview-ft-202511111122-xxxx

output.model_name

string

模型標識名。

wan2.5-i2v-preview-ft-202511111122-xxxx

output.status

string

部署狀態:

  • PENDING:部署中

  • RUNNING:運行中

  • FAILED:部署失敗

PENDING

output.base_model

string

使用的基準模型。

wan2.5-i2v-preview

output.gmt_create

string

部署任務建立時間。

2025-11-11T17:46:53.294

output.gmt_modified

string

部署任務更新時間。

2025-11-11T17:46:53.294

output.workspace_id

string

阿里雲百鍊API Key所屬的業務空間ID。

請參見擷取Workspace ID

llm-xxxxxxxxx

output.charge_type

string

付費模式。post_paid表示後付費。

post_paid

output.creator

string

建立人的阿里雲帳號ID。

12xxxxxxx

output.modifier

string

修改人的阿里雲帳號ID。

12xxxxxxx

output.plan

string

部署方式。

lora

請求樣本

請將 <替換為模型名稱model_name> 完整替換為建立微調任務輸出參數finetuned_output的值。

圖生視頻-基於首幀

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"
}'

圖生視頻-基於首尾幀

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 she/he begins the s86b5p transformation.“\nOutput Template:\nThe video begins with a shot of [subject description]. [Environment description]. Then she/he begins the s86b5p transformation.\nExample:\nThe video begins with a young woman in an outdoor setting. She has short, curly dark brown hair and a friendly smile. She is wearing a black Polo shirt with colorful floral embroidery. The background features green vegetation and distant mountains. Then she begins the s86b5p transformation.",
        "lora_prompt_default": "Then she/he begins the s86b5p transformation."
    },
    "capacity": 1,
    "plan": "lora"
}'

響應樣本

關注兩個參數:output.deployed_model(部署模型的唯一標識)、output.status(狀態為PENDING,表示部署中)。

{
    "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"
    }
}

查詢模型部署狀態

API描述:輪詢此介面,當任務狀態status 變為 RUNNING,表示模型已部署成功。

說明

本文樣本的微調模型,部署過程預計需要 5~10分鐘

請求介面

GET https://dashscope-intl.aliyuncs.com/api/v1/deployments/{deployed_model}

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

deployed_model

Path parameter

string

部署模型的唯一標識。

填寫部署模型輸出參數 output.deployed_model 的值。

wan2.5-i2v-preview-ft-202511111122-xxxx

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

object

任務詳情。

-

output.deployed_model

string

部署模型的唯一標識。用於後續調用模型。

wan2.5-i2v-preview-ft-202511111122-xxxx

output.model_name

string

模型標識名。

wan2.5-i2v-preview-ft-202511111122-xxxx

output.status

string

部署狀態:

  • PENDING:部署中

  • RUNNING:運行中

  • ARREARS_DOWN:欠費停服

  • ARREARS_RECOVERING:欠費停服恢複中

  • FAILED:部署失敗

  • OFFLINING:服務下線中

  • UPDATING:變更配置中

  • UPDATING_FAILED:變更配置失敗

RUNNING

output.base_model

string

使用的基準模型。

wan2.5-i2v-preview

output.gmt_create

string

部署任務建立時間。

2025-11-11T17:46:53.294

output.gmt_modified

string

部署任務更新時間。

2025-11-11T18:02:2

output.workspace_id

string

阿里雲百鍊API Key所屬的業務空間ID。

請參見擷取Workspace ID

llm-xxxxxxxxx

output.charge_type

string

付費模式。post_paid表示後付費。

post_paid

output.creator

string

建立人的阿里雲帳號ID。

12xxxxxxx

output.modifier

string

修改人的阿里雲帳號ID。

12xxxxxxx

output.plan

string

部署方式。

lora

請求樣本

請將 <替換為deployed_model> 完整替換為部署模型輸出參數 output.deployed_model 的值。

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/deployments/<替換為deployed_model>' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' 

響應樣本

關注status欄位。當狀態變為 RUNNING 時,表示模型已部署成功,可以開始調用。

{
    "request_id": "66d15f35-0772-409f-bc70-xxxxxxxxx",
    "output": {
        "deployed_model": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "gmt_create": "2025-11-11T17:46:53",
        "gmt_modified": "2025-11-11T18:02:24",
        "status": "RUNNING",
        "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": "12xxxxxxxx",
        "plan": "lora"
    }
}

調用模型產生視頻

調用微調後的LoRA模型,請參見調用模型產生視頻

Checkpoint 管理

1. 查詢Checkpoint列表

API描述:擷取通過驗證整合功產生預覽視頻的 Checkpoint列表,驗證失敗的不會列出。

使用限制:該介面需在模型微調訓練完成後調用,否則將返回空列表。

請求介面

GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}/validation-results

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

job_id

Path parameter

string

微調任務ID。

ft-202511111122-xxxx

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

array[string]

Checkpoint列表。

-

output[].checkpoint

string

Checkpoint名稱。

checkpoint-160

請求樣本

請將 URL 中的 <替換為微調任務job_id> 完整替換為建立微調任務輸出參數job_id的值。

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>/validation-results' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' 

響應樣本

{
    "request_id": "da1310f5-5a21-4e29-99d4-xxxxxx",
    "output": [
        {
            "checkpoint": "checkpoint-160"
        },
        {
            "checkpoint": "checkpoint-20"
        },
        {
            "checkpoint": "checkpoint-40"
        },
        {
            "checkpoint": "checkpoint-60"
        }
    ]
}

2. 查詢Checkpoint驗證結果

API描述: 根據checkpoint(例如“checkpoint-160”),查看其產生的視頻效果。

請求介面

GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}/validation-details/{checkpoint}?page_no=1&page_size=10

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

job_id

Path parameter

string

微調任務ID。

ft-202511111122-xxxx

checkpoint

Path parameter

string

Checkpoint名稱。

checkpoint-160

page_no

Query parameter

integer

頁碼。預設為1。

1

page_size

Query parameter

integer

每頁數量。預設為10。

10

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

375b3ad0-d3fa-451f-b629-xxxxxxx

output

object

輸出結果。

-

output.page_no

integer

頁碼。

1

output.page_size

integer

每頁數量。

10

output.total

integer

驗證集列表總數量。

1

output.list

array[object]

驗證集列表。

-

output.list[].video_path

string

通過Checkpoint產生的視頻。

video_path有效期間為24小時,請及時下載視頻。

https://finetune-swap-wulanchabu.oss-cn-wulanchabu.aliyuncs.com/xxx.mp4?Expires=xxxx

output.list[].prompt

string

驗證資料的prompt。從資料集的標註檔案data.jsonl獲得。

視頻開頭展示了一位年輕男性坐在咖啡館的情境...

output.list[].first_frame_path

string

驗證的映像地址。系統會讀取資料集中的映像,並產生一個公網URL地址。

https://finetune-swap-wulanchabu.oss-cn-wulanchabu.aliyuncs.com/xxx.jpeg

請求樣本

  • <替換為微調任務job_id>: 完整替換為建立微調任務輸出參數job_id的值。

  • <替換為選擇的checkpoint>:完整替換為選定的Checkpoint名稱,例如“checkpoint-160”。

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>/validation-details/<替換為選擇的checkpoint>?page_no=1&page_size=10' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

響應樣本

video_path有效期間為24小時,請及時下載視頻。
{
    "request_id": "375b3ad0-d3fa-451f-b629-xxxxxxx",
    "output": {
        "page_no": 1,
        "page_size": 10,
        "total": 1,
        "list": [
            {
                "video_path": "https://finetune-swap-wulanchabu.oss-cn-wulanchabu.aliyuncs.com/xxx.mp4?Expires=xxxx",
                "prompt": "視頻開頭展示了一位年輕男性坐在咖啡館的情境。他穿著一件米色的Polo衫,神情專註且略顯沉思,手指輕輕托著下巴。他的面前擺放著一杯熱氣騰騰的咖啡,背景是木質條紋的牆壁和一個裝飾牌。然後開始展示s86b5p金錢雨特效,無數巨大尺寸的美元鈔票(米黃底/深綠圖案)如暴雨般傾瀉而下,密集地砸向並環繞他。鈔票持續落下,他雙臂舒展上揚,脖頸微仰,表情驚喜,完全沉浸在這場狂野的金錢雨中。",
                "first_frame_path": "https://finetune-swap-wulanchabu.oss-cn-wulanchabu.aliyuncs.com/xxx.jpeg"
            }
        ]
    }
}

3. 匯出Checkpoint

API描述:將Checkpoint匯出為可部署模型。

請求介面

GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}/export/{checkpoint}?model_name={model_name}

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

job_id

Path parameter

string

微調任務ID。

ft-202511111122-xxxx

checkpoint

Path parameter

string

Checkpoint名稱。

checkpoint-160

model_name

Query parameter

string

用於在控制台中展示的匯出模型名稱。

該名稱需全域唯一,建議使用中英文、數字、底線(_)和虛線(-)字元。

請注意:此參數僅用於控制台顯示,實際匯出的模型名稱以查詢匯出的模型詳情輸出參數output[].model_name為準。

wan2.5-i2v-preview-ft-202511111122-xxxx

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

boolean

匯出請求是否提交成功。

  • true:表示匯出請求提交成功。

  • false:表示匯出請求提交失敗,建議重試。

true

請求樣本

  • <替換為微調任務job_id>:完整替換為建立微調任務輸出參數job_id的值。

  • <替換為待匯出的checkpoint>:完整替換為checkpoint的值,例如“checkpoint-160”。

  • <替換為控制台展示的匯出模型名稱>:完整替換為自訂的模型名稱,僅用於控制台展示。

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>/export/<替換為待匯出的checkpoint>?model_name=<替換為控制台展示的匯出模型名稱>' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

響應樣本

{
    "request_id": "0817d1ed-b6b6-4383-9650-xxxxx",
    "output": true
}

4. 查詢匯出模型詳情

API描述:查詢所有Checkpoint的狀態,確認匯出已完成,並擷取它專屬的、用於部署的新模型名稱(model_name)。

請求介面

GET https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/{job_id}/checkpoints

入參描述

欄位

傳參方式

類型

必選

描述

樣本值

job_id

Path parameter

string

微調任務ID。

ft-202511111122-xxxx

出參描述

欄位

類型

描述

樣本值

request_id

string

請求的唯一識別碼。

0eb05b0c-02ba-414a-9d0c-xxxxxxxxx

output

array[object]

Checkpoint列表詳情。

-

output[].create_time

string

建立時間。

2025-11-11T13:27:29

output[].job_id

string

微調任務ID。

ft-202511111122-xxxx

output[].checkpoint

string

Checkpoint名稱。

checkpoint-160

output[].full_name

string

Checkpoint完整名稱標識。

ft-202511111122-496e-checkpoint-160

output[].model_name

string

匯出後的模型名稱。用於模型部署和調用。

status為SUCCEEDED時返回。

wan2.5-i2v-preview-ft-202511111122-xxxx-c160

output[].model_display_name

string

模型展示名稱。

wan2.5-i2v-preview-ft-202511111122-xxxx

output[].status

string

模型匯出狀態:

  • PENDING:排隊中

  • PROCESSING:匯出中

  • SUCCEEDED:匯出成功

  • FAILED:匯出失敗

  • UNSUPPORTED:不支援匯出

SUCCEEDED

請求樣本

請將 <替換為微調任務job_id> 完整替換為建立微調任務輸出參數job_id的值。

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>/checkpoints' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

響應樣本

請在返回列表中定位目標 Checkpoint(如 checkpoint-160)。當其狀態變為 SUCCEEDED 時,表示匯出成功,請務必擷取並儲存 model_name,它是後續模型部署與調用的唯一標識。

{
    "request_id": "b0e33c6e-404b-4524-87ac-xxxxxx",
    "output": [
         ......,
        {
            "create_time": "2025-11-11T13:42:31",
            "full_name": "ft-202511111122-496e-checkpoint-180",
            "job_id": "ft-202511111122-496e",
            "checkpoint": "checkpoint-180",
            "status": "PENDING" // 未匯出的checkpoint,沒有model_name欄位
        },
        {
            "create_time": "2025-11-11T13:27:29",
            "full_name": "ft-202511111122-496e-checkpoint-160",
            "job_id": "ft-202511111122-496e",
            "checkpoint": "checkpoint-160",                             
            "model_name": "wan2.5-i2v-preview-ft-202511111122-xxxx-c160", // 重要欄位,用於模型部署和調用
            "model_display_name": "wan2.5-i2v-preview-ft-202511111122-xxxx", 
            "status": "SUCCEEDED" // 成功匯出的checkpoint
        },
        ......
        
    ]
}

5. 部署和調用模型

在成功匯出 Checkpoint 並擷取 model_name 後,請按照以下步驟執行後續操作:

微調任務管理

查詢微調任務日誌

請求樣本

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>/logs' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

響應樣本

{
    "request_id": "b7ecb456-6dd1-4f35-a581-xxxxxx",
    "output": {
        "total": 25,
        "logs": [
            "2025-11-11 11:23:37,315 - INFO - data process succeeded, start to fine-tune",
            " Actual number of consumed tokens is 215040 !",
            " Actual number of consumed tokens is 419840 !",
            " Actual number of consumed tokens is 624640 !",
            " Actual number of consumed tokens is 829440 !",
            " Actual number of consumed tokens is 1034240 !",
            " Actual number of consumed tokens is 1239040 !",
            " Actual number of consumed tokens is 1443840 !",
            " Actual number of consumed tokens is 1648640 !",
            " Actual number of consumed tokens is 1853440 !",
            " Actual number of consumed tokens is 2058240 !",
            " Actual number of consumed tokens is 2263040 !",
            " Actual number of consumed tokens is 2467840 !",
            " Actual number of consumed tokens is 2672640 !",
            " Actual number of consumed tokens is 2877440 !",
            " Actual number of consumed tokens is 3082240 !",
            " Actual number of consumed tokens is 3287040 !",
            " Actual number of consumed tokens is 3491840 !",
            " Actual number of consumed tokens is 3696640 !",
            " Actual number of consumed tokens is 3901440 !",
            "2025-11-11 16:31:40,760 - INFO - fine-tuned output got, start to transfer it for inference",
            "2025-11-11 16:32:29,162 - INFO - transfer for inference succeeded, start to deliver it for inference",
            "2025-11-11 16:40:28,784 - INFO - start to save checkpoint",
            "2025-11-11 16:49:01,738 - INFO - finetune-job succeeded",
            "2025-11-11 16:49:02,234 - INFO - ##FT_COMPLETE##"
        ]
    }
}

查詢微調工作清單

請求樣本

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

響應樣本

{
    "request_id": "bf4d3475-f50c-42e2-a263-xxxxxxxxx",
    "output": {
        "page_no": 1,
        "page_size": 10,
        "total": 1,
        "jobs": [
            {
                "job_id": "ft-202511111122-xxxx",
                "job_name": "ft-202511111122-xxxx",
                "status": "SUCCEEDED",
                "finetuned_output": "wan2.5-i2v-preview-ft-202511111122-xxxx",
                "model": "wan2.5-i2v-preview",
                "base_model": "wan2.5-i2v-preview",
                "training_file_ids": [
                    "xxxxxxxxx"
                ],
                "validation_file_ids": [],
                "hyper_parameters": {
                    "n_epochs": 400,
                    "batch_size": 2,
                    "learning_rate": 2.0E-5,
                    "split": 0.9,
                    "eval_epochs": 50
                },
                "training_type": "efficient_sft",
                "create_time": "2025-11-11 11:22:22",
                "workspace_id": "llm-xxxxxxxxx",
                "user_identity": "xxxxxxxxx",
                "modifier": "xxxxxxxxx",
                "creator": "xxxxxxxxx",
                "end_time": "2025-11-11 16:49:01",
                "group": "llm",
                "usage": 432000,
                "max_output_cnt": 8,
                "output_cnt": 8
            }
        ]
    }
}

取消微調任務

請求樣本

curl --location --request POST 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>/cancel' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' 

響應樣本

{
    "request_id": "d8dab938-e32e-40bf-83ab-xxxxxx",
    "output": {
        "status": "success"
    }
}

刪除微調任務

請求樣本

curl --location --request DELETE 'https://dashscope-intl.aliyuncs.com/api/v1/fine-tunes/<替換為微調任務job_id>' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' 

響應樣本

{
    "request_id": "1301136c-12f2-4504-880a-xxxxxx",
    "output": {
        "status": "success"
    }
}

部署模型管理

刪除部署的模型服務

重要

執行該操作後,模型部署服務將立即下線且不可恢複

  1. 模型將無法調用。

  2. 部署服務停止計費。

請求樣本

curl --request DELETE 'https://dashscope-intl.aliyuncs.com/api/v1/deployments/<替換為deployed_model>' \
    --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
    --header 'Content-Type: application/json' 

響應樣本

關注output.status參數:若值為 DELETING,表示刪除請求已成功提交,正在刪除模型服務。

{
    "request_id": "c2ed2aa2-39b8-4a86-b79e-xxxxxx",
    "output": {
        "deployed_model": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "gmt_create": "2025-11-11T17:46:53",
        "gmt_modified": "2025-12-22T11:18:27.532",
        "status": "DELETING",
        "model_name": "wan2.5-i2v-preview-ft-202511111122-xxxx",
        "base_model": "wan2.5-i2v-preview",
        "workspace_id": "llm-xxxxxx",
        "charge_type": "post_paid",
        "creator": "xxxxxx",
        "modifier": "xxxxxx",
        "plan": "lora"
    }
}

之後,再調用查詢模型部署狀態進行驗證。若返回如下內容,說明部署的服務已不存在,刪除成功。

{
    "request_id": "eb619064-0c4£-4d29-aa49-xxxxxx",
    "message": "Not found.",
    "code": "NotFound"
}