HappyHorse-图生视频API
更新时间 2026-09-06 17:31:25
最近更新时间: 2026-09-06 17:31:25
本文介绍 HappyHorse-图生视频模型调用API。
模型简介
HappyHorse图生视频系列模型,以输入首帧图片作为画面基础,结合文本提示词做内容引导,生成物理真实、运动流畅的短视频。采用异步任务模式,调用流程为:创建生成任务获取 task_id → 通过 task_id 轮询查询任务结果。
支持的模型
| 模型 | 说明 |
|---|---|
| happyhorse‑1.0‑i2v | HappyHorse 图生视频 v1.0 基础版本 |
| happyhorse‑1.1‑i2v | HappyHorse 图生视频 v1.1 迭代版本,运动、画面效果优化 |
调用流程
接口采用异步任务模式,分两步执行:
step1:调用创建任务接口,成功返回task_id
step2:调用查询任务接口查询对应task_id,直到task_status值为SUCCEEDED,获取生成视频url
创建任务接口详情
http调用
请求方式:POST
请求路径:https://ai.ctaigw.cn/v1/services/aigc/video-generation/video-synthesis
请求头
| 参数 | 必填 | 说明 |
|---|---|---|
| Content‑Type | 是 | 固定application/json |
| Authorization | 是 | Bearer ${YOUR_APP_KEY} |
| X‑DashScope‑Async | 是 | 必须enable |
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型调用名称或模型ID |
| input | object | 是 | 输入对象 |
| input.prompt | string | 否 | 文本提示词,引导视频生成内容 |
| input.media | array | 是 | 媒体数组,只能传入 1 个首帧素材 |
| input.media[].type | string | 是 | 素材类型,固定取值 first_frame,代表首帧图 |
| input.media[].url | string | 是 | 首帧图片,支持公网 http/https URL,或者 Base64; 格式:JPEG/JPG/PNG/WEBP; 分辨率≥300px; 宽高比 1:2.5 ~ 2.5:1; 文件≤20MB |
| parameters | object | 否 | 视频生成参数 |
| parameters.resolution | string | 否 | 输出分辨率档位:480P / 720P / 1080P;默认1080P;输出宽高比跟随输入首帧 |
| parameters.duration | integer | 否 | 视频时长,取值 3‑15 整数,默认 5 秒 |
| parameters.watermark | boolean | 否 | 是否添加水印标识,水印位于视频右下角,文案固定为“AI生成”。 - false:默认值,不添加水印。 - true:添加水印。 |
| parameters.seed | integer | 否 | 随机种子 [0,2147483647]; 相同 seed 结果倾向稳定,但不能保证完全一致 |
响应参数
| 参数 | 类型 | 说明 |
|---|---|---|
| request_id | string | 请求唯一标识,用于问题排查溯源 |
| output | object | 任务输出主体 |
| output.task_id | string | 查询的任务 ID |
| output.task_status | string | 任务状态 - PENDING:任务排队中 - RUNNING:任务处理中 - SUCCEEDED:任务执行成功 - FAILED:任务执行失败 - CANCELED:任务已取消 - UNKNOWN:任务不存在或状态未知 |
查询任务接口详情
http调用
请求方式:GET
请求路径:https://ai.ctaigw.cn/v1/tasks/{task_id}
Path 路径参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| task_id | string | 是 | 创建异步任务接口返回的任务 ID |
请求头
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | 身份认证,格式:Bearer ${YOUR_APP_KEY} |
响应参数
| 参数 | 类型 | 说明 |
|---|---|---|
| output.task_id | string | 任务 ID |
| output.task_status | string | 任务状态 - PENDING:任务排队中 - RUNNING:任务处理中 - SUCCEEDED:任务执行成功 - FAILED:任务执行失败 - CANCELED:任务已取消 - UNKNOWN:任务不存在或状态未知 |
| output.submit_time | string | 任务提交时间 |
| output.scheduled_time | string | 任务调度开始时间 |
| output.end_time | string | 任务结束时间 |
| output.orig_prompt | string | 用户原始输入 prompt |
| output.video_url | string | 仅 SUCCEEDED 返回 |
| usage | object | 计费统计,成功任务返回 |
| usage.duration | integer | 计费视频时长 |
| usage.output_video_duration | integer | 输出视频时长 |
| usage.input_video_duration | integer | 输入视频时长,文生视频固定 0 |
| usage.video_count | integer | 输出视频数量,固定 1 |
| usage.SR | integer | 分辨率档位 |
| request_id | string | 请求唯一 ID |
请求/响应示例
创建任务请求示例
请求
curl --location 'https://ai.ctaigw.cn/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer ${YOUR_APP_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"model": "happyhorse-1.1-i2v",
"input": {
"prompt": "复古70年代地铁站,街头音乐家弹奏吉他,路人匆匆走过,镜头缓慢右移",
"media": [
{
"type": "first_frame",
"url": "https://aaaa.ctyun.cn/001.png"
}
]
},
"parameters": {
"resolution": "720P",
"duration": 5
}
}'正常响应
{
"output": {
"task_status": "PENDING",
"task_id": "xxxx‑xxxx‑xxxx‑xxxx"
},
"request_id": "00d06a841873c0a83bfaf1fae0184625"
}异常响应
{
"error": {
"type:": "Invalid_request",
"code": "missing_parameter",
"message": "Missing required parameters"
}
}查询任务请求示例
请求
curl -X GET https://ai.ctaigw.cn/v1/tasks/{task_id} \
--header "Authorization: Bearer ${YOUR_APP_KEY}"正常响应
{
"request_id": "00d06a841873c0a83bfaf1fae0184625",
"output": {
"task_id": "xxxx‑xxxx‑xxxx‑xxxx",
"task_status": "SUCCEEDED",
"submit_time": "2026-08-26 12:10:05.001",
"scheduled_time": "2026-08-26 12:10:05.201",
"end_time": "2026-08-26 12:10:25.001",
"orig_prompt": "复古70年代地铁站,街头音乐家弹奏吉他,路人匆匆走过,镜头缓慢右移",
"video_url": "https://aaaa.ctyun.cn/xxx.mp4"
},
"usage": {
"duration": 10,
"input_video_duration": 0,
"output_video_duration": 10,
"video_count": 1,
"SR": 720
}
}