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

下一步

部署为异步操作,调用本接口后可通过查询和管理部署接口查询部署状态。