可灵-视频生成模型支持**文生视频、图生视频-基于首帧、图生视频-基于首尾帧、参考生视频以及视频编辑**。

**重要**

本文档仅适用于“中国内地（北京）”地域，且必须使用该地域的[API Key](https://bailian.console.aliyun.com/?tab=model#/api-key)。

## **服务开通**

请前往[阿里云百炼控制台](https://bailian.console.aliyun.com/cn-beijing/?tab=model#/model-market/all)，搜索“kling”，找到**可灵AI** 模型卡片，单击**立即开通**，在弹窗内确认开通及授权。

## 适用范围

为确保调用成功，请务必保证**模型、Endpoint URL 和 API Key 均属于同一地域**。跨地域调用将会失败。

-   [**选择模型**](https://help.aliyun.com/zh/model-studio/use-video-generation#56194eb777noq)：确认模型所属的地域。
    
-   **选择 URL**：选择对应的地域 Endpoint URL，支持HTTP URL。
    
-   **配置 API Key**：选择地域并[获取API Key](https://help.aliyun.com/zh/model-studio/get-api-key)，再[配置API Key到环境变量](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)。
    

## HTTP调用

由于视频生成任务耗时较长（通常为1-5分钟），API采用异步调用。整个流程包含 **"创建任务 -> 轮询获取"** 两个核心步骤，具体如下：

### **步骤1：创建任务获取任务ID**

**北京地域**：`POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis`

**说明**

-   创建成功后，使用接口返回的 `task_id` 查询结果，task\_id 有效期为 24 小时。**请勿重复创建任务**，轮询获取即可。
    
-   新手指引请参见[Postman](https://help.aliyun.com/zh/model-studio/first-call-to-image-and-video-api)。
    

| #### 请求参数 | ## 文生视频 支持模型：`kling/kling-v3-omni-video-generation`、`kling/kling-v3-video-generation`。 ``` curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\ -H 'X-DashScope-Async: enable' \\ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\ -H 'Content-Type: application/json' \\ -d '{ "model": "kling/kling-v3-video-generation", "input": { "prompt": "一只小猫在月光下奔跑" }, "parameters": { "mode": "std", "aspect_ratio": "16:9", "duration": 5, "audio": false, "watermark": true } }' ``` ## 文生视频（智能分镜） 支持模型：`kling/kling-v3-omni-video-generation`、`kling/kling-v3-video-generation` 。 ``` curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\ -H 'X-DashScope-Async: enable' \\ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\ -H 'Content-Type: application/json' \\ -d '{ "model": "kling/kling-v3-video-generation", "input": { "prompt": "", "multi_shot": true, "shot_type": "customize", "multi_prompt": [ { "index": 1, "prompt": "雾岭镇比地图上更小，山雾像棉絮一样堵在街口。邮局背后果然有三棵槐树，第三棵树根旁的泥土被人动过。", "duration": 5 }, { "index": 2, "prompt": "林澈蹲下挖出一个铁盒，里面除了一把生锈的钥匙，还有一盘老旧的录音带。录音机是邮局借的，按下播放键时，父亲的声音从沙沙杂音里爬出来：“如果你听到这段话，说明你已经走到我走过的路上了。", "duration": 5 } ], "media": [], "element_list": [] }, "parameters": { "mode": "pro", "duration": 10, "audio": true, "aspect_ratio": "9:16", "watermark": true } }' ``` ## 图生视频（首帧生视频） 支持模型：`kling/kling-v3-omni-video-generation`、`kling/kling-v3-video-generation` 。 ``` curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\ -H 'X-DashScope-Async: enable' \\ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\ -H 'Content-Type: application/json' \\ -d '{ "model": "kling/kling-v3-omni-video-generation", "input": { "prompt": "让图片中的人物动起来，头发被微风吹动", "media": [ { "type": "first_frame", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp" } ] }, "parameters": { "mode": "std", "duration": 5, "audio": false, "watermark": true } }' ``` ## 图生视频（首尾帧生视频） 支持模型：`kling/kling-v3-omni-video-generation`、`kling/kling-v3-video-generation` 。 ``` curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\ -H 'X-DashScope-Async: enable' \\ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\ -H 'Content-Type: application/json' \\ -d '{ "model": "kling/kling-v3-omni-video-generation", "input": { "prompt": "写实风格，一只黑色小猫好奇地看向天空，镜头从平视逐渐上升，最后俯拍它的好奇的眼神。", "media": [ { "type": "first_frame", "url": "https://wanx.alicdn.com/material/20250318/first_frame.png" }, { "type": "last_frame", "url": "https://wanx.alicdn.com/material/20250318/last_frame.png" } ] }, "parameters": { "mode": "std", "duration": 5, "audio": false, "watermark": true } }' ``` ## 参考生视频（视频+图像） 支持模型：`kling/kling-v3-omni-video-generation`。 ``` curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\ -H 'X-DashScope-Async: enable' \\ -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\ -H 'Content-Type: application/json' \\ -d '{ "model": "kling/kling-v3-omni-video-generation", "input": { "prompt": "<<<element_1>>>背景，<<<image_2>>>和<<<image_1>>>握手交谈，<<<video_1>>>人物穿着黑色风衣的侦探站在公寓楼顶，手持望远镜观察街道", "multi_shot": false, "shot_type": "intelligence", "multi_prompt": [], "media": [ { "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/lip_sync_5s.mp4", "type": "base", "keep_original_sound": "yes" }, { "type": "refer", "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/zem_test/yangmi01.jpg" }, { "type": "refer", "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/human_2.JPG" } ], "element_list": [ { "element_id": 171 } ] }, "parameters": { "mode": "pro", "duration": 10, "audio": false, "aspect_ratio": "1:1", "watermark": true } }' ``` |
| --- | --- |
| ##### 请求头（Headers） |
| **Content-Type** `*string*` **（必选）** 请求内容类型。此参数必须设置为`application/json`。 |
| **Authorization** `*string*`**（必选）** 请求身份认证。接口使用阿里云百炼API Key进行身份认证。示例值：Bearer sk-xxxx。 |
| **X-DashScope-Async** `*string*` **（必选）** 异步处理配置参数。HTTP请求只支持异步，**必须设置为**`**enable**`。 **重要** 缺少此请求头将报错：“current user api does not support synchronous calls”。 |
| ##### 请求体（Request Body） |
| **model** `*string*` **（必选）** 模型名称。 可选值： - `kling/kling-v3-omni-video-generation` - `kling/kling-v3-video-generation` |
| **input** `*object*` **（必选）** 输入的基本信息，如提示词、媒体素材等。 **属性** **prompt** `*string*` （条件必填） 文本提示词。用来描述生成视频中期望包含的元素和视觉特点。 支持中英文，每个汉字/字母占一个字符，不超过2500个字符，超过部分会自动截断。 填写逻辑： - 当 `shot_type=intelligence` 时，此参数**必填**。 - 当 `shot_type=customize` 时，此参数**不生效**，请以 `multi_prompt` 为准。 Omni模型可通过prompt与主体、图片、视频等内容实现多种能力： - 支持模型：`kling/kling-v3-omni-video-generation`。 - 适用任务：参考生视频。 - 引用格式：通过`<<<>>>`的格式来指定某个主体、图片、视频，如：`<<<element_1>>>`、`<<<image_1>>>`、`<<<video_1>>>`。 - 引用顺序：按照`media`数组顺序定义prompt中引用的顺序。 - 用法示例：`一只<<<element_1>>>在月光下奔跑`。 **media** `*array*` （可选） 文生视频任务无需填写此参数。 媒体素材列表，用于指定图像或视频素材。 不同模型支持的媒体素材搭配不一样： **素材组合规则** kling/kling-v3-video-generation 仅支持以下媒体素材组合，非法组合将报错。 - **图生视频-基于首帧**：`first_frame`。 - 数量限制：首帧1张。 - **图生视频-基于首尾帧**：`first_frame+last_frame`。 - 数量限制：首帧1张，尾帧1张。 kling/kling-v3-omni-video-generation 仅支持以下媒体素材组合，非法组合将报错。 - **图生视频-基于首帧**：`first_frame`。 - 图像数量：首帧1张。 - **图生视频-基于首尾帧**：`first_frame+last_frame`。 - 图像数量：首帧1张，尾帧1张。 - **参考生视频**：支持以下 `media` 组合。 - 仅传入 `feature` 时：必须传入1个视频。 - 仅传入 `refer` 时：参考图片与多图主体数量（`element_list` 的数组长度）之和不得超过7。 - 传入 `feature+refer` 时：必须传入1个视频，且参考图片与多图主体数量（`element_list` 的数组长度）之和不得超过4。 - 传入 `feature+first_frame` 时：必须传入1个视频和1张首帧。 - **视频编辑**：支持以下 `media` 组合。 - 仅传入 `base` 时：必须传入1个视频。 - 传入 `base+refer` 时：必须传入1个视频，且参考图片与多图主体数量（`element_list` 的数组长度）之和不得超过4。 **属性** **type** `*string*` **（必选）** 媒体素材类型。可选值与所选模型有关： kling/kling-v3-video-generation 可选值： - `first_frame`：首帧图片。 - `last_frame`：尾帧图片。 不同媒体素材之间的搭配限制，请参见 `media` 参数下的“素材组合规则”。 kling/kling-v3-omni-video-generation 可选值： - `first_frame`：首帧图片。 - `last_frame`：尾帧图片。 - `refer`：参考图片。 - `base`：待编辑视频。 - `feature`：特征参考视频。 不同媒体素材之间的搭配限制，请参见 `media` 参数下的“素材组合规则”。 **url** `*string*` **（必选）** 媒体素材URL。素材包括图像、视频。 传入图像（type=first\\_frame或last\\_frame或refer） 图像URL。 - 支持 HTTP 或 HTTPS 协议。 - 示例值：https://xxx/xxx.png。 图像限制： - 格式：JPEG、JPG、PNG（不支持透明通道）。 - 分辨率：宽和高的范围为\\[300, 8000\\]像素。 - 宽高比：1:2.5 ~ 2.5:1。 - 文件大小：不超过10MB。 传入视频（type=base或feature） 视频文件的 URL。 - 支持 HTTP 和 HTTPS 协议。 - 示例值：https://xxx/xxx.mp4。 视频限制： - 格式：mp4、mov。 - 时长：3～10s。 - 分辨率：宽和高的范围为\\[720, 2160\\]像素。 - 文件大小：不超过200MB。 - 帧率：24～60fps。 **keep\\_original\\_sound** `*string*` （可选） 支持模型：kling/kling-v3-omni-video-generation 。 生效条件：当且仅当传入视频（type=base或feature）时生效。 是否保留原视频声音。 - `no`：默认值，不保留原声。 - `yes`：保留原声。 **multi\\_shot** `*boolean*` （可选） 是否开启多镜头生成。 - `false`：默认值，不开启多镜头。 - `true`：开启多镜头生成。 **shot\\_type** `*string*` （条件必填） 当`multi_shot=true` 时必填。多镜头模式类型。 - `intelligence`：智能分镜，由模型自动规划镜头。 - `customize`：自定义模式，支持自定义每个片段的提示词和时长。 **multi\\_prompt** `*array*` （条件必填） 当`shot_type=customize` 时必填。多镜头自定义模式下的片段列表。 **属性** **index** `*integer*` **（必选）** 分镜片段索引，分镜数量为1～6个，索引从1开始。 **prompt** `*string*` **（必选）** 对应片段的提示词，支持中英文，不超过512个字符，超过自动截断。 **duration** `*integer*` **（必选）** 对应片段的时长，单位为秒。 取值为\\[1, `parameters.duration`\\]之间的整数。 **element\\_list** `*array*` （可选） 主体列表，用于指定视频中需要引入的主体元素。 **属性** **element\\_id** `*integer*` （条件必填） 传`element_list`时必填，表示主体ID。请在[可灵-主体ID列表](https://help.aliyun.com/zh/model-studio/kling-object-ids)获取主体ID。 主体个数限制（element\\_list数组长度限制）： - 图生视频-基于首帧：最多支持3个主体。 - 图生视频-基于首尾帧：最多支持3个主体。 - 参考生视频（`type=refer`）：参考图片与多图主体数量之和不得超过7。 - 参考生视频（`type=feature+refer`）：参考图片与多图主体数量之和不得超过4。 |
| **parameters** `*object*` （可选） 视频生成参数。如设置生成模式、画面比例、视频时长、是否生成音频等。 **属性** **mode** `*string*` （可选） 视频生成模式。 - `pro`：默认值，专业模式，输出视频分辨率为1080P。 - `std`：标准模式，输出视频分辨率为720P。 **aspect\\_ratio** `*string*` （条件必填） 生成视频的宽高比例。 可选值： - `16:9`：默认值。 - `9:16` - `1:1` 以下场景必须填写： - 文生视频：必须设置。 - 参考生视频（`type=feature`、`type=feature+refer`、`type=refer`）：必须设置。 其他场景无需设置 - 图生视频-基于首帧：以首帧的宽高比为基准，无需填写。 - 图生视频-基于首尾帧：以首帧的宽高比为基准，无需填写。 - 参考生视频（`type=feature+first_frame`）：以首帧的宽高比为基准，无需填写。 - 视频编辑：以输入视频的宽高比为基准，无需填写。 **duration** `*integer*` （可选） **重要** duration直接影响费用，按秒计费，时间越长费用越高，请前往[百炼控制台](https://bailian.console.aliyun.com/cn-beijing?tab=model#/model-market/all)查看价格。 生成视频的时长，单位为秒。 - kling/kling-v3-omni-video-generation：取值为\\[3, 15\\]之间的整数，默认值为5。 - 注意：当传入视频（`type=base或feature`）时，取值为\\[3, 10\\]之间的整数，默认值为5。 - kling/kling-v3-video-generation：取值为\\[3, 15\\]之间的整数，默认值为5。 示例值：5。 **audio** `*boolean*` （可选） **重要** audio直接影响费用，请前往[百炼控制台](https://bailian.console.aliyun.com/cn-beijing?tab=model#/model-market/all)查看价格。 是否生成有声视频。开启后模型将根据视频内容自动生成匹配的背景音乐或音效。 - `false`：默认值，输出无声视频。 - `true`：输出有声视频。 注意：当传入视频（`type=base或feature`）时，`audio`只能设置为`false`。 **watermark** `*boolean*` （可选） 是否添加水印标识，水印位于视频右下角，文案固定为“可灵AI”。 - `false`：默认值，不添加水印。 - `true`：添加水印。 |

| #### 响应参数 | ### 成功响应 请保存 task\\_id，用于查询任务状态与结果。 ``` { "output": { "task_status": "PENDING", "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx" }, "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx" } ``` ### 异常响应 创建任务失败，请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)进行解决。 ``` { "code": "InvalidApiKey", "message": "No API-key provided.", "request_id": "7438d53d-6eb8-4596-8835-xxxxxx" } ``` |
| --- | --- |
| **output** `*object*` 任务输出信息。 **属性** **task\\_id** `*string*` 任务ID。查询有效期24小时。 **task\\_status** `*string*` 任务状态。 **枚举值** - PENDING：任务排队中 - RUNNING：任务处理中 - SUCCEEDED：任务执行成功 - FAILED：任务执行失败 - CANCELED：任务已取消 - UNKNOWN：任务不存在或状态未知 |
| **request\\_id** `*string*` 请求唯一标识。可用于请求明细溯源和问题排查。 |
| **code** `*string*` 请求失败的错误码。请求成功时不会返回此参数，详情请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)。 |     |
| **message** `*string*` 请求失败的详细信息。请求成功时不会返回此参数，详情请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)。 |     |

### **步骤2：根据任务ID查询结果**

**北京地域**：`GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}`

**说明**

-   **轮询建议**：视频生成过程约需数分钟，建议采用**轮询**机制，并设置合理的查询间隔（如 15 秒）来获取结果。
    
-   **任务状态流转**：PENDING（排队中）→ RUNNING（处理中）→ SUCCEEDED（成功）/ FAILED（失败）。
    
-   **task\_id 有效期**：**24小时**，超时后将无法查询结果，接口将返回任务状态为`UNKNOWN`。
    
-   **RPS 限制**：查询接口默认RPS为20。如需更高频查询或事件通知，建议[配置异步任务回调](https://help.aliyun.com/zh/model-studio/async-task-api)。
    
-   **更多操作**：如需批量查询、取消任务等操作，请参见[管理异步任务](https://help.aliyun.com/zh/model-studio/manage-asynchronous-tasks#f26499d72adsl)。
    

| #### 请求参数 | ## 查询任务结果 将`{task_id}`完整替换为上一步接口返回的`task_id`的值。`task_id`查询有效期为24小时。 ``` curl -X GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id} \\ --header "Authorization: Bearer $DASHSCOPE_API_KEY" ``` |
| --- | --- |
| ##### **请求头（Headers）** |
| **Authorization** `*string*`**（必选）** 请求身份认证。接口使用阿里云百炼API Key进行身份认证。示例值：Bearer sk-xxxx。 |
| ##### **URL路径参数（Path parameters）** |
| **task\\_id** `*string*`**（必选）** 任务ID。 |

| #### **响应参数** | #### **任务执行成功** ``` { "request_id": "340f0d7d-bf7e-4c8f-9c03-xxxxxx", "output": { "task_id": "24f5c51e-d67b-44dc-9acb-xxxxxx", "task_status": "SUCCEEDED", "submit_time": "2026-03-27 21:30:32.575", "scheduled_time": "2026-03-27 21:30:32.603", "end_time": "2026-03-27 21:31:09.177", "video_url": "https://v4-fdl.kechuangai.com/ksc2/xxx.mp4?xxxx", "watermark_video_url": "https://v2-fdl.kechuangai.com/ksc2/xxx.mp4?xxxx" }, "usage": { "duration": 5, "size": "1280*720", "fps": 24, "video_count": 1, "audio": false, "SR": "720" } } ``` ## 任务执行失败 若任务执行失败，task\\_status将置为 FAILED，并提供错误码和信息。请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)进行解决。 ``` { "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d", "output": { "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010", "task_status": "FAILED", "code": "InvalidParameter", "message": "The parameter is invalid xxxxxx" } } ``` ## 任务查询过期 task\\_id查询有效期为 24 小时，超时后将无法查询，返回以下报错信息。 ``` { "request_id": "a4de7c32-7057-9f82-8581-xxxxxx", "output": { "task_id": "502a00b1-19d9-4839-a82f-xxxxxx", "task_status": "UNKNOWN" } } ``` |
| --- | --- |
| **output** `*object*` 任务输出信息。 **属性** **task\\_id** `*string*` 任务ID。查询有效期24小时。 **task\\_status** `*string*` 任务状态。 **枚举值** - PENDING：任务排队中 - RUNNING：任务处理中 - SUCCEEDED：任务执行成功 - FAILED：任务执行失败 - CANCELED：任务已取消 - UNKNOWN：任务不存在或状态未知 **轮询过程中的状态流转：** - PENDING（排队中） → RUNNING（处理中）→ SUCCEEDED（成功）/ FAILED（失败）。 - 初次查询状态通常为 PENDING（排队中）或 RUNNING（处理中）。 - 当状态变为 SUCCEEDED 时，响应中将包含生成的视频URL。 - 若状态为 FAILED，请检查错误信息并重试。 - 若状态为 CANCELED，表示任务已取消，如需继续请重新提交任务。 - 若状态为 UNKNOWN，表示任务不存在或状态未知，可能在 task\\_id 不存在或超过 24 小时有效期后出现。 **submit\\_time** `*string*` 任务提交时间。格式为 YYYY-MM-DD HH:mm:ss.SSS。 **scheduled\\_time** `*string*` 任务执行时间。格式为 YYYY-MM-DD HH:mm:ss.SSS。 **end\\_time** `*string*` 任务完成时间。格式为 YYYY-MM-DD HH:mm:ss.SSS。 **video\\_url** `*string*` 视频URL。仅在 task\\_status 为 SUCCEEDED 时返回。 视频格式为MP4（H.264 编码）。视频链接有效期30天，但不建议将其作为长期存储依赖，请及时下载。 **watermark\\_video\\_url** `*string*` 带水印的视频URL。仅在 task\\_status 为 SUCCEEDED 时返回。 视频格式为MP4（H.264 编码）。视频链接有效期30天，但不建议将其作为长期存储依赖，请及时下载。 **orig\\_prompt** `*string*` 原始输入的prompt，对应请求参数`prompt`。 **code** `*string*` 请求失败的错误码。请求成功时不会返回此参数，详情请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)。 **message** `*string*` 请求失败的详细信息。请求成功时不会返回此参数，详情请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)。 |
| **usage** `*object*` 输出信息统计。只对成功的结果计数。 **属性** **duration** `*integer*` 生成视频的总视频时长，用于计费。 **size** `*string*` 生成视频的分辨率。示例值：1280\\*720。 **fps** `*integer*` 生成视频的帧率。示例值：24。 **SR** `*string*` 生成视频的分辨率档位。示例值：720。 **audio** `*boolean*` 生成视频是否为有声视频。示例值：false。 **video\\_count** `*integer*` 生成视频的数量。固定为1。 |
| **request\\_id** `*string*` 请求唯一标识。可用于请求明细溯源和问题排查。 |

## **错误码**

如果模型调用失败并返回报错信息，请参见[错误码](https://help.aliyun.com/zh/model-studio/error-code)进行解决。

/\* 调整 table 宽度 \*/ .aliyun-docs-content table.medium-width { max-width: 1018px; width: 100%; } .aliyun-docs-content table.table-no-border tr td:first-child { padding-left: 0; } .aliyun-docs-content table.table-no-border tr td:last-child { padding-right: 0; } /\* 支持吸顶 \*/ div:has(.aliyun-docs-content), .aliyun-docs-content .markdown-body { overflow: visible; } .stick-top { position: sticky; top: 46px; } /\*\*代码块字体\*\*/ /\* 减少表格中的代码块 margin，让表格信息显示更紧凑 \*/ .unionContainer .markdown-body table .help-code-block { margin: 0 !important; } /\* 减少表格中的代码块字号，让表格信息显示更紧凑 \*/ .unionContainer .markdown-body .help-code-block pre { font-size: 12px !important; } /\* 减少表格中的代码块字号，让表格信息显示更紧凑 \*/ .unionContainer .markdown-body .help-code-block pre code { font-size: 12px !important; } /\*\* API Reference 表格 \*\*/ .aliyun-docs-content table.api-reference tr td:first-child { margin: 0px; border-bottom: 1px solid #d8d8d8; } .aliyun-docs-content table.api-reference tr:last-child td:first-child { border-bottom: none; } .aliyun-docs-content table.api-reference p { color: #6e6e80; } .aliyun-docs-content table.api-reference b, i { color: #181818; } .aliyun-docs-content table.api-reference .collapse { border: none; margin-top: 4px; margin-bottom: 4px; } .aliyun-docs-content table.api-reference .collapse .expandable-title-bold { padding: 0; } .aliyun-docs-content table.api-reference .collapse .expandable-title { padding: 0; } .aliyun-docs-content table.api-reference .collapse .expandable-title-bold .title { margin-left: 16px; } .aliyun-docs-content table.api-reference .collapse .expandable-title .title { margin-left: 16px; } .aliyun-docs-content table.api-reference .collapse .expandable-title-bold i.icon { position: absolute; color: #777; font-weight: 100; } .aliyun-docs-content table.api-reference .collapse .expandable-title i.icon { position: absolute; color: #777; font-weight: 100; } .aliyun-docs-content table.api-reference .collapse.expanded .expandable-content { padding: 10px 14px 10px 14px !important; margin: 0; border: 1px solid #e9e9e9; } .aliyun-docs-content table.api-reference .collapse .expandable-title-bold b { font-size: 13px; font-weight: normal; color: #6e6e80; } .aliyun-docs-content table.api-reference .collapse .expandable-title b { font-size: 13px; font-weight: normal; color: #6e6e80; } .aliyun-docs-content table.api-reference .tabbed-content-box { border: none; } .aliyun-docs-content table.api-reference .tabbed-content-box section { padding: 8px 0 !important; } .aliyun-docs-content table.api-reference .tabbed-content-box.mini .tab-box { /\* position: absolute; left: 40px; right: 0; \*/ } .aliyun-docs-content .margin-top-33 { margin-top: 33px !important; } .aliyun-docs-content .two-codeblocks pre { max-height: calc(50vh - 136px) !important; height: auto; } .expandable-content section { border-bottom: 1px solid #e9e9e9; padding-top: 6px; padding-bottom: 4px; } .expandable-content section:last-child { border-bottom: none; } .expandable-content section:first-child { padding-top: 0; }

/\* 让表格显示成类似钉钉文档的分栏卡片 \*/ table.help-table-card td { border: 10px solid #FFF !important; background: #F4F6F9; padding: 16px !important; vertical-align: top; } /\* 减少表格中的代码块 margin，让表格信息显示更紧凑 \*/ .unionContainer .markdown-body table .help-code-block { margin: 0 !important; } /\* 减少表格中的代码块字号，让表格信息显示更紧凑 \*/ .unionContainer .markdown-body .help-code-block pre { font-size: 12px !important; } /\* 减少表格中的代码块字号，让表格信息显示更紧凑 \*/ .unionContainer .markdown-body .help-code-block pre code { font-size: 12px !important; } /\* 表格中的引用上下间距调小，避免内容显示过于稀疏 \*/ .unionContainer .markdown-body table blockquote { margin: 4px 0 0 0; }
示例：
文生视频：
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "kling/kling-v3-video-generation",
    "input": {
        "prompt": "一只小猫在月光下奔跑"
    },
    "parameters": {
        "mode": "std",
        "aspect_ratio": "16:9",
        "duration": 5,
        "audio": false,
        "watermark": true
    }
}'
文生视频（智能分镜）
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "kling/kling-v3-video-generation",
    "input": {
        "prompt": "",
        "multi_shot": true,
        "shot_type": "customize",
        "multi_prompt": [
            {
                "index": 1,
                "prompt": "雾岭镇比地图上更小，山雾像棉絮一样堵在街口。邮局背后果然有三棵槐树，第三棵树根旁的泥土被人动过。",
                "duration": 5
            },
            {
                "index": 2,
                "prompt": "林澈蹲下挖出一个铁盒，里面除了一把生锈的钥匙，还有一盘老旧的录音带。录音机是邮局借的，按下播放键时，父亲的声音从沙沙杂音里爬出来：“如果你听到这段话，说明你已经走到我走过的路上了。",
                "duration": 5
            }
        ],
        "media": [],
        "element_list": []
    },
    "parameters": {
        "mode": "pro",
        "duration": 10,
        "audio": true,
        "aspect_ratio": "9:16",
        "watermark": true
    }
}'
图生视频（首帧生视频）
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "kling/kling-v3-omni-video-generation",
    "input": {
        "prompt": "让图片中的人物动起来，头发被微风吹动",
        "media": [
            {
                "type": "first_frame",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp"
            }
        ]
    },
    "parameters": {
        "mode": "std",
        "duration": 5,
        "audio": false,
        "watermark": true
    }
}'
图生视频（首尾帧生视频）
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "kling/kling-v3-omni-video-generation",
    "input": {
        "prompt": "写实风格，一只黑色小猫好奇地看向天空，镜头从平视逐渐上升，最后俯拍它的好奇的眼神。",
        "media": [
            {
                "type": "first_frame",
                "url": "https://wanx.alicdn.com/material/20250318/first_frame.png"
            },
          {
                "type": "last_frame",
                "url": "https://wanx.alicdn.com/material/20250318/last_frame.png"
            }
        ]
    },
    "parameters": {
        "mode": "std",
        "duration": 5,
        "audio": false,
        "watermark": true
    }
}'
参考生视频（视频+图像）
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "kling/kling-v3-omni-video-generation",
    "input": {
        "prompt": "<<<element_1>>>背景，<<<image_2>>>和<<<image_1>>>握手交谈，<<<video_1>>>人物穿着黑色风衣的侦探站在公寓楼顶，手持望远镜观察街道",
        "multi_shot": false,
        "shot_type": "intelligence",
        "multi_prompt": [],
        "media": [
            {
                "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/lip_sync_5s.mp4",
                "type": "base",
                "keep_original_sound": "yes"
            },
            {
                "type": "refer",
                "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/zem_test/yangmi01.jpg"
            },
            {
                "type": "refer",
                "url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/human_2.JPG"
            }
        ],
        "element_list": [
            {
                "element_id": 171
            }
        ]
    },
    "parameters": {
        "mode": "pro",
        "duration": 10,
        "audio": false,
        "aspect_ratio": "1:1",
        "watermark": true
    }
}'
成功响应：
{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}
异常响应：
{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

查询任务结果：
curl -X GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

任务执行成功：
{
    "request_id": "340f0d7d-bf7e-4c8f-9c03-xxxxxx",
    "output": {
        "task_id": "24f5c51e-d67b-44dc-9acb-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-03-27 21:30:32.575",
        "scheduled_time": "2026-03-27 21:30:32.603",
        "end_time": "2026-03-27 21:31:09.177",
        "video_url": "https://v4-fdl.kechuangai.com/ksc2/xxx.mp4?xxxx",
        "watermark_video_url": "https://v2-fdl.kechuangai.com/ksc2/xxx.mp4?xxxx"
    },
    "usage": {
        "duration": 5,
        "size": "1280*720",
        "fps": 24,
        "video_count": 1,
        "audio": false,
        "SR": "720"
    }
}
任务执行失败：
{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The parameter is invalid xxxxxx"
    }
}
任务查询过期：
{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}