跳转到主要内容
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
图生视频:首帧图创建视频生成任务
curl --request POST \
  --url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-DashScope-Async: <x-dashscope-async>' \
  --data '
{
  "model": "happyhorse-1.0-i2v",
  "input": {
    "prompt": "一只猫在草地上奔跑,阳光明媚,镜头跟随",
    "media": [
      {
        "type": "first_frame",
        "url": "https://your-cdn.com/cat.png"
      }
    ]
  }
}
'
import requests

url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"

payload = {
"model": "happyhorse-1.0-i2v",
"input": {
"prompt": "一只猫在草地上奔跑,阳光明媚,镜头跟随",
"media": [
{
"type": "first_frame",
"url": "https://your-cdn.com/cat.png"
}
]
}
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'happyhorse-1.0-i2v',
input: {
prompt: '一只猫在草地上奔跑,阳光明媚,镜头跟随',
media: [{type: 'first_frame', url: 'https://your-cdn.com/cat.png'}]
}
})
};

fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'happyhorse-1.0-i2v',
'input' => [
'prompt' => '一只猫在草地上奔跑,阳光明媚,镜头跟随',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://your-cdn.com/cat.png'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"

payload := strings.NewReader("{\n \"model\": \"happyhorse-1.0-i2v\",\n \"input\": {\n \"prompt\": \"一只猫在草地上奔跑,阳光明媚,镜头跟随\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/cat.png\"\n }\n ]\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"happyhorse-1.0-i2v\",\n \"input\": {\n \"prompt\": \"一只猫在草地上奔跑,阳光明媚,镜头跟随\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/cat.png\"\n }\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"happyhorse-1.0-i2v\",\n \"input\": {\n \"prompt\": \"一只猫在草地上奔跑,阳光明媚,镜头跟随\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://your-cdn.com/cat.png\"\n }\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "output": {
    "task_id": "hh-...",
    "task_status": "PENDING"
  },
  "request_id": "..."
}
右侧 Playground 可直接调试:在 AuthorizationBearer sk-your-api-key,填好 model / input.media / parameters 后发起请求。提交成功返回 task_id,轮询与下载见下方说明。
本页是 happyhorse-1.0-i2v(图生视频)的创建接口:给一张首帧图 + prompt,让画面动起来。完整异步流程见 HappyHorse 概览
  • HappyHorse 的 i2v 不支持 driving_audio(音频驱动):只接受 first_frame。做对口型 / rap 请用 Wan2.7-i2v
  • input.media 必填,否则上游报 图生视频模型 ... 必须提供图片。媒体 url 必须是公网可直接 GET 的 https 链接。
  • 创建请求走 /wan/api/v1/... 并带 X-DashScope-Async: enable,不要用 /v1/videos

代码示例

curl -X POST "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis" \
  -H "X-DashScope-Async: enable" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse-1.0-i2v",
    "input": {
      "prompt": "一只猫在草地上奔跑,阳光明媚,镜头跟随",
      "media": [
        {"type": "first_frame", "url": "https://your-cdn.com/cat.png"}
      ]
    },
    "parameters": {"resolution": "720P", "duration": 5, "prompt_extend": true, "watermark": true}
  }'
import requests

url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
headers = {
    "Authorization": "Bearer sk-your-api-key",
    "Content-Type": "application/json",
    "X-DashScope-Async": "enable",
}
body = {
    "model": "happyhorse-1.0-i2v",
    "input": {
        "prompt": "一只猫在草地上奔跑,阳光明媚,镜头跟随",
        "media": [{"type": "first_frame", "url": "https://your-cdn.com/cat.png"}],
    },
    "parameters": {"resolution": "720P", "duration": 5, "prompt_extend": True, "watermark": True},
}
resp = requests.post(url, json=body, headers=headers, timeout=30)
print("task_id:", resp.json()["output"]["task_id"])

参数与媒体速查

参数类型必填默认说明
modelstring固定 happyhorse-1.0-i2v
input.promptstring文本提示词
input.mediaarray见下方媒体表
parameters.resolutionstring720P720P / 1080P
parameters.durationint52–15 秒整数
parameters.prompt_extendbooltrue智能改写,推荐开启
parameters.watermarkboolfalse「AI 生成」水印

media[] 取值

type必填张数说明
first_frame1首帧图,视频从这张图开始(HappyHorse i2v 仅支持此项)

响应格式

{
  "output": { "task_id": "...", "task_status": "PENDING" },
  "request_id": "..."
}
提交后 轮询 GET /v1/tasks/{task_id} 直到 completed,再从 result_url 下载 mp4(不带 Authorization,24 小时过期)。完整轮询循环见 HappyHorse 概览 · 异步调用流程

授权

Authorization
string
header
必填

在 API易控制台获取的 API Key

请求头

X-DashScope-Async
enum<string>
默认值:enable
必填

异步处理开关,必须设置为 enable

可用选项:
enable

请求体

application/json
model
enum<string>
默认值:happyhorse-1.0-i2v
必填

模型 ID,图生视频固定 happyhorse-1.0-i2v

可用选项:
happyhorse-1.0-i2v
input
object
必填
parameters
object

响应

任务已提交,返回 task_id 与 PENDING 状态

output
object
request_id
string

请求唯一标识

示例:

"..."