Appearance
HappyHorse 创建任务-图生视频
HappyHorse-参考生视频模型支持传入多张参考图像,通过文本提示词描述场景,将图像中的主体角色融合生成一段流畅的视频。
1 请求地址
POSThttps://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis
2. 请求参数
| 参数名 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| model | string | 是 | 无 | 模型名称。可选值:happyhorse-1.1-r2v、happyhorse-1.0-r2v |
| input | object | 是 | 无 | 输入信息,包含 prompt 和 media 字段 |
| input.prompt | string | 是 | 无 | 文本提示词。通过 [Image 1]、[Image 2] 等标识指代 media 数组中对应位置的参考图像。支持任何语言输入,长度不超过 5000 个非中文字符或 2500 个中文字符 |
| input.media | array | 是 | 无 | 媒体素材列表。数量 1~9 张,顺序对应 [Image 1]、[Image 2]… |
| input.media[].type | string | 是 | 无 | 媒体素材类型。固定值:reference_image(参考图像) |
| input.media[].url | string | 是 | 无 | 参考图像 URL 或 Base64 编码数据。支持格式:JPEG、JPG、PNG、WEBP;短边 ≥ 400px;文件大小 ≤ 20MB |
| parameters | object | 否 | - | 视频处理参数,如分辨率、时长等 |
| parameters.resolution | string | 否 | 1080P | 视频分辨率档位。可选值:720P、1080P |
| parameters.ratio | string | 否 | 16:9 | 视频宽高比16:9 9:16 3:4 4:3 4:5 5:4 1:1 9:21 21:9 |
| parameters.duration | integer | 否 | 5 | 视频时长,单位秒。取值范围 [3, 15] |
3. 请求示例
bash
curl --location 'https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "happyhorse-1.1-r2v",
"input": {
"prompt": "[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。",
"media": [
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
}'powershell
$headers = @{
"X-DashScope-Async" = "enable"
"Authorization" = "Bearer YOUR_API_KEY"
"Content-Type" = "application/json"
}
$body = @{
model = "happyhorse-1.1-r2v"
input = @{
prompt = "[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。"
media = @(
@{ type = "reference_image"; url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg" }
@{ type = "reference_image"; url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg" }
@{ type = "reference_image"; url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg" }
)
}
parameters = @{
resolution = "720P"
ratio = "16:9"
duration = 5
}
} | ConvertTo-Json -Depth 10
$response = Invoke-RestMethod -Uri "https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis" -Method Post -Headers $headers -Body $body
Write-Host $responsepython
import requests
url = "https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis"
headers = {
"X-DashScope-Async": "enable",
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"model": "happyhorse-1.1-r2v",
"input": {
"prompt": "[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。",
"media": [
{"type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg"},
{"type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg"},
{"type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg"}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
String json = """
{
"model": "happyhorse-1.1-r2v",
"input": {
"prompt": "[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。",
"media": [
{"type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg"},
{"type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg"},
{"type": "reference_image", "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg"}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis"))
.header("X-DashScope-Async", "enable")
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());vue
<script setup>
import axios from 'axios'
const url = 'https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis'
const data = {
model: 'happyhorse-1.1-r2v',
input: {
prompt: '[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。',
media: [
{ type: 'reference_image', url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg' },
{ type: 'reference_image', url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg' },
{ type: 'reference_image', url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg' }
]
},
parameters: { resolution: '720P', ratio: '16:9', duration: 5 }
}
const res = await axios.post(url, data, {
headers: {
'X-DashScope-Async': 'enable',
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
})
console.log(res.data)
</script>javascript
const url = 'https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis'
fetch(url, {
method: 'POST',
headers: {
'X-DashScope-Async': 'enable',
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'happyhorse-1.1-r2v',
input: {
prompt: '[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。',
media: [
{ type: 'reference_image', url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg' },
{ type: 'reference_image', url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg' },
{ type: 'reference_image', url: 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg' }
]
},
parameters: { resolution: '720P', ratio: '16:9', duration: 5 }
})
})
.then(res => res.json())
.then(data => console.log(data))csharp
using System.Net.Http;
using System.Text;
using Newtonsoft.Json.Linq;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-DashScope-Async", "enable");
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var requestBody = new JObject
{
["model"] = "happyhorse-1.1-r2v",
["input"] = new JObject
{
["prompt"] = "[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。",
["media"] = new JArray
{
new JObject { ["type"] = "reference_image", ["url"] = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg" },
new JObject { ["type"] = "reference_image", ["url"] = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg" },
new JObject { ["type"] = "reference_image", ["url"] = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg" }
}
},
["parameters"] = new JObject
{
["resolution"] = "720P",
["ratio"] = "16:9",
["duration"] = 5
}
};
var content = new StringContent(requestBody.ToString(), Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());vb
Imports System.Net.Http
Imports System.Text
Imports Newtonsoft.Json.Linq
Module RefToVideo
Sub Main()
Dim client As New HttpClient()
client.DefaultRequestHeaders.Add("X-DashScope-Async", "enable")
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY")
Dim requestBody As New JObject()
requestBody("model") = "happyhorse-1.1-r2v"
Dim inputObj As New JObject()
inputObj("prompt") = "[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。"
Dim mediaArray As New JArray()
mediaArray.Add(New JObject From {{"type", "reference_image"}, {"url", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg"}})
mediaArray.Add(New JObject From {{"type", "reference_image"}, {"url", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg"}})
mediaArray.Add(New JObject From {{"type", "reference_image"}, {"url", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg"}})
inputObj("media") = mediaArray
requestBody("input") = inputObj
Dim paramsObj As New JObject()
paramsObj("resolution") = "720P"
paramsObj("ratio") = "16:9"
paramsObj("duration") = 5
requestBody("parameters") = paramsObj
Dim json As String = requestBody.ToString()
Dim content As New StringContent(json, Encoding.UTF8, "application/json")
Dim response As HttpResponseMessage = client.PostAsync(
"https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis", content).Result
Console.WriteLine(response.Content.ReadAsStringAsync().Result)
End Sub
End Modulejava
import System.*;
import System.Net.*;
import System.IO.*;
import System.Text.*;
public class RefToVideo {
public static void main(String[] args) throws Exception {
String url = "https://llm.infiflow.cn/dashscope/api/v1/services/aigc/video-generation/video-synthesis";
String json = "{\"model\":\"happyhorse-1.1-r2v\",\"input\":{\"prompt\":\"[Image 1]中身着红色旗袍的女性,镜头先以侧面中景勾勒旗袍修身剪裁与S型曲线,随即切换至低角度仰拍,捕捉她轻抬玉手展开[Image 2]中的折扇的同时,[Image 3]中的流苏耳坠随头部转动轻盈摆动的细节,最后推近至面部特写,定格在她指尖轻点扇骨、眼波流转间的含蓄风情,多视角全方位展现东方韵味。\",\"media\":[{\"type\":\"reference_image\",\"url\":\"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg\"},{\"type\":\"reference_image\",\"url\":\"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg\"},{\"type\":\"reference_image\",\"url\":\"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg\"}]},\"parameters\":{\"resolution\":\"720P\",\"ratio\":\"16:9\",\"duration\":5}}";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json";
request.Headers.Add("X-DashScope-Async", "enable");
request.Headers.Add("Authorization", "Bearer YOUR_API_KEY");
byte[] bytes = Encoding.UTF8.GetBytes(json);
request.ContentLength = bytes.length;
request.GetRequestStream().write(bytes, 0, bytes.length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String result = new StreamReader(response.getResponseStream()).readToEnd();
System.out.println(result);
}
}4. 响应参数
| 字段 | 类型 | 描述 |
|---|---|---|
| output | object | 任务输出信息,包含 task_id、task_status 等 |
| output.task_id | string | 任务 ID,查询有效期 24 小时 |
| output.task_status | string | 任务状态。枚举值:PENDING(排队中)、RUNNING(处理中)、SUCCEEDED(成功)、FAILED(失败)、CANCELED(已取消)、UNKNOWN(未知) |
| request_id | string | 请求唯一标识,用于请求明细溯源和问题排查 |
| code | string | 请求失败的错误码,请求成功时不返回 |
| message | string | 请求失败的详细信息,请求成功时不返回 |
5. 响应示例
json
{
"output": {
"task_status": "PENDING",
"task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
},
"request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}json
{
"code": "InvalidApiKey",
"message": "No API-key provided.",
"request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}