通义万相 Wan2 首尾帧生视频
curl --request POST \
--url https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_frame_url": "<string>",
"last_frame_url": "<string>",
"model": "wan2.2-kf2v-flash",
"negative_prompt": "<string>",
"prompt": "<string>",
"prompt_extend": true,
"seed": 1073741823,
"template": "<string>",
"watermark": true
}
'import requests
url = "https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video"
payload = {
"first_frame_url": "<string>",
"last_frame_url": "<string>",
"model": "wan2.2-kf2v-flash",
"negative_prompt": "<string>",
"prompt": "<string>",
"prompt_extend": True,
"seed": 1073741823,
"template": "<string>",
"watermark": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_frame_url: '<string>',
last_frame_url: '<string>',
model: 'wan2.2-kf2v-flash',
negative_prompt: '<string>',
prompt: '<string>',
prompt_extend: true,
seed: 1073741823,
template: '<string>',
watermark: true
})
};
fetch('https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video', 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.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video",
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([
'first_frame_url' => '<string>',
'last_frame_url' => '<string>',
'model' => 'wan2.2-kf2v-flash',
'negative_prompt' => '<string>',
'prompt' => '<string>',
'prompt_extend' => true,
'seed' => 1073741823,
'template' => '<string>',
'watermark' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video"
payload := strings.NewReader("{\n \"first_frame_url\": \"<string>\",\n \"last_frame_url\": \"<string>\",\n \"model\": \"wan2.2-kf2v-flash\",\n \"negative_prompt\": \"<string>\",\n \"prompt\": \"<string>\",\n \"prompt_extend\": true,\n \"seed\": 1073741823,\n \"template\": \"<string>\",\n \"watermark\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_frame_url\": \"<string>\",\n \"last_frame_url\": \"<string>\",\n \"model\": \"wan2.2-kf2v-flash\",\n \"negative_prompt\": \"<string>\",\n \"prompt\": \"<string>\",\n \"prompt_extend\": true,\n \"seed\": 1073741823,\n \"template\": \"<string>\",\n \"watermark\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_frame_url\": \"<string>\",\n \"last_frame_url\": \"<string>\",\n \"model\": \"wan2.2-kf2v-flash\",\n \"negative_prompt\": \"<string>\",\n \"prompt\": \"<string>\",\n \"prompt_extend\": true,\n \"seed\": 1073741823,\n \"template\": \"<string>\",\n \"watermark\": true\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}视频生成 - Wan2
Wan2 首尾帧生视频
使用通义万相 Wan2.2 首尾帧生视频模型(wan2.2-kf2v-flash),仅需提供首帧和尾帧图片,结合提示词即可生成丝滑流畅的动态视频,支持特效模板
POST
/
generate
/
bailian
/
wan2-keyframe-to-video
通义万相 Wan2 首尾帧生视频
curl --request POST \
--url https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_frame_url": "<string>",
"last_frame_url": "<string>",
"model": "wan2.2-kf2v-flash",
"negative_prompt": "<string>",
"prompt": "<string>",
"prompt_extend": true,
"seed": 1073741823,
"template": "<string>",
"watermark": true
}
'import requests
url = "https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video"
payload = {
"first_frame_url": "<string>",
"last_frame_url": "<string>",
"model": "wan2.2-kf2v-flash",
"negative_prompt": "<string>",
"prompt": "<string>",
"prompt_extend": True,
"seed": 1073741823,
"template": "<string>",
"watermark": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
first_frame_url: '<string>',
last_frame_url: '<string>',
model: 'wan2.2-kf2v-flash',
negative_prompt: '<string>',
prompt: '<string>',
prompt_extend: true,
seed: 1073741823,
template: '<string>',
watermark: true
})
};
fetch('https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video', 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.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video",
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([
'first_frame_url' => '<string>',
'last_frame_url' => '<string>',
'model' => 'wan2.2-kf2v-flash',
'negative_prompt' => '<string>',
'prompt' => '<string>',
'prompt_extend' => true,
'seed' => 1073741823,
'template' => '<string>',
'watermark' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video"
payload := strings.NewReader("{\n \"first_frame_url\": \"<string>\",\n \"last_frame_url\": \"<string>\",\n \"model\": \"wan2.2-kf2v-flash\",\n \"negative_prompt\": \"<string>\",\n \"prompt\": \"<string>\",\n \"prompt_extend\": true,\n \"seed\": 1073741823,\n \"template\": \"<string>\",\n \"watermark\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_frame_url\": \"<string>\",\n \"last_frame_url\": \"<string>\",\n \"model\": \"wan2.2-kf2v-flash\",\n \"negative_prompt\": \"<string>\",\n \"prompt\": \"<string>\",\n \"prompt_extend\": true,\n \"seed\": 1073741823,\n \"template\": \"<string>\",\n \"watermark\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_frame_url\": \"<string>\",\n \"last_frame_url\": \"<string>\",\n \"model\": \"wan2.2-kf2v-flash\",\n \"negative_prompt\": \"<string>\",\n \"prompt\": \"<string>\",\n \"prompt_extend\": true,\n \"seed\": 1073741823,\n \"template\": \"<string>\",\n \"watermark\": true\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}使用阿里云通义万相首尾帧生视频模型,仅需提供首帧和尾帧图片即可生成丝滑流畅的动态视频。
模型特点:
- 首尾帧控制 - 精确控制视频起始和结束画面
- 平滑过渡 - 自动生成丝滑流畅的中间帧动画
- 多分辨率 - 支持 480P、720P、1080P 输出
- 智能改写 - 支持 prompt 智能改写优化效果
- 特效模板 - 支持预设视频特效模板
授权
请使用您的 API Token 进行认证
请求体
application/json
任务参数
首帧图像 URL(必填) 支持公网 URL(HTTP/HTTPS)或 Base64 编码 图像格式:JPEG、JPG、PNG(无透明通道)、BMP、WEBP 图像分辨率:宽度和高度范围为 [360, 2000] 像素 文件大小:不超过 10MB 输出视频的宽高比将以此图像为基准
尾帧图像 URL(可选) 要求同首帧图像,分辨率可与首帧不同 使用特效模板(template)时无需传入
模型名称(可选,建议留空) 留空时使用最新版本模型,后续模型升级会自动应用 当前默认:wan2.2-kf2v-flash
可用选项:
wan2.2-kf2v-flash 反向提示词(可选,最大 500 字符) 用来描述不希望在视频画面中看到的内容
Maximum string length:
500文本提示词(可选,最大 800 字符) 用来描述生成视频中期望包含的元素和视觉特点 首尾帧主体/场景变化较大时,建议描写变化过程(如运镜、主体运动)
Maximum string length:
800是否开启 prompt 智能改写(可选,默认 true) 开启后使用大模型对输入 prompt 进行智能改写
分辨率档位(可选,默认 720P) wan2.2-kf2v-flash:可选值 480P、720P、1080P
可用选项:
480P, 720P, 1080P 随机种子(可选,范围 0-2147483647)
必填范围:
0 <= x <= 2147483647视频特效模板名称(可选) 使用此参数时,仅需传入 first_frame_url 不同模型支持不同的特效模板
是否添加水印(可选,默认 false) 水印位于视频右下角,文案固定为"AI生成"
响应
OK
Task ID
示例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I