跳转到主要内容
POST
/
v3
/
async
/
vidu-q2-template2video
VIDU Q2 场景模板
curl --request POST \
  --url https://api.ppio.com/v3/async/vidu-q2-template2video \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "bgm": true,
  "area": "<string>",
  "seed": 123,
  "beast": "<string>",
  "images": [
    "<string>"
  ],
  "prompt": "<string>",
  "wm_url": "<string>",
  "payload": "<string>",
  "template": "<string>",
  "meta_data": "<string>",
  "watermark": true,
  "wm_position": 123,
  "aspect_ratio": "<string>"
}
'
import requests

url = "https://api.ppio.com/v3/async/vidu-q2-template2video"

payload = {
"bgm": True,
"area": "<string>",
"seed": 123,
"beast": "<string>",
"images": ["<string>"],
"prompt": "<string>",
"wm_url": "<string>",
"payload": "<string>",
"template": "<string>",
"meta_data": "<string>",
"watermark": True,
"wm_position": 123,
"aspect_ratio": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
bgm: true,
area: '<string>',
seed: 123,
beast: '<string>',
images: ['<string>'],
prompt: '<string>',
wm_url: '<string>',
payload: '<string>',
template: '<string>',
meta_data: '<string>',
watermark: true,
wm_position: 123,
aspect_ratio: '<string>'
})
};

fetch('https://api.ppio.com/v3/async/vidu-q2-template2video', 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.ppio.com/v3/async/vidu-q2-template2video",
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([
'bgm' => true,
'area' => '<string>',
'seed' => 123,
'beast' => '<string>',
'images' => [
'<string>'
],
'prompt' => '<string>',
'wm_url' => '<string>',
'payload' => '<string>',
'template' => '<string>',
'meta_data' => '<string>',
'watermark' => true,
'wm_position' => 123,
'aspect_ratio' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);

$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.ppio.com/v3/async/vidu-q2-template2video"

payload := strings.NewReader("{\n \"bgm\": true,\n \"area\": \"<string>\",\n \"seed\": 123,\n \"beast\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"wm_url\": \"<string>\",\n \"payload\": \"<string>\",\n \"template\": \"<string>\",\n \"meta_data\": \"<string>\",\n \"watermark\": true,\n \"wm_position\": 123,\n \"aspect_ratio\": \"<string>\"\n}")

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

req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")

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.ppio.com/v3/async/vidu-q2-template2video")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"bgm\": true,\n \"area\": \"<string>\",\n \"seed\": 123,\n \"beast\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"wm_url\": \"<string>\",\n \"payload\": \"<string>\",\n \"template\": \"<string>\",\n \"meta_data\": \"<string>\",\n \"watermark\": true,\n \"wm_position\": 123,\n \"aspect_ratio\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ppio.com/v3/async/vidu-q2-template2video")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"bgm\": true,\n \"area\": \"<string>\",\n \"seed\": 123,\n \"beast\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"wm_url\": \"<string>\",\n \"payload\": \"<string>\",\n \"template\": \"<string>\",\n \"meta_data\": \"<string>\",\n \"watermark\": true,\n \"wm_position\": 123,\n \"aspect_ratio\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "task_id": "<string>",
  "provider_request_id": "<string>"
}
VIDU Q2 场景模板转视频 API,支持多种特效场景模板,根据模板和输入图像生成特效视频内容。
这是一个异步API,只会返回异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 来检索视频生成结果。

请求头

Content-Type
string
必填
枚举值: application/json
Authorization
string
必填
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。

请求体

bgm
boolean
默认值:false
是否为生成的视频添加背景音乐。默认:false。传 true 时系统将从预设 BGM 库中自动挑选合适的音乐并添加;不传或为 false 则不添加 BGM。BGM 不限制时长,系统根据视频时长自动适配
area
string
默认值:"auto"
异域公主特效专属参数。仅当 template 传 exotic_princess 时可用。默认:auto可选值:auto, denmark, uk, africa, china, mexico, switzerland, russia, italy, korea, thailand, india, japan
seed
integer
默认值:0
随机种子。当默认不传或者传 0 时,会使用随机数替代;手动设置则使用设置的种子
beast
string
默认值:"auto"
与兽同行特效专属参数。仅当 template 传 beast_companion 时可用。默认:auto可选值:auto, bear, tiger, elk, snake, lion, wolf
images
string[]
必填
输入图像列表。模型将以此参数中传入的图片来生成视频。支持传入图片 Base64 编码或图片 URL(确保可访问)。图片支持 png、jpeg、jpg、webp 格式。图片比例需要小于 1:4 或 4:1,大小不超过 50MB。Base64 decode 之后的字节长度需要小于 10M,且编码必须包含适当的内容类型字符串,例如:data:image/png;base64,{base64_encode}数组长度:1 - 无限制
prompt
string
文本提示词,生成视频的文本描述。注:当 template=subject_3、pubg_winner_hit 时,提示词非必传
wm_url
string
水印内容,此处为图片 URL。不传时,使用默认水印:内容由 AI 生成
payload
string
透传参数,不做任何处理,仅数据传输。最多 1048576 个字符长度限制:0 - 1048576
template
string
必填
场景模板参数。不同的场景模板对应不同的调用参数。常见模板:subject_3(人物换装)、pubg_winner_hit(吃鸡特效)、exotic_princess(异域公主)、beast_companion(与兽同行)等,具体模板请参考:https://platform.vidu.cn/docs/templates
meta_data
string
元数据标识,json 格式字符串,透传字段。您可以自定义格式或使用示例格式。该参数为空时,默认使用 vidu 生成的元数据标识。示例格式:{"Label": "your_label", "ContentProducer": "your_content_producer", "ContentPropagator": "your_content_propagator", "ProduceID": "your_product_id", "PropagateID": "your_propagate_id", "ReservedCode1": "your_reserved_code1", "ReservedCode2": "your_reserved_code2"}
watermark
boolean
默认值:false
是否添加水印。true:添加水印;false:不添加水印。目前水印内容为固定,内容由 AI 生成,默认不加。您可以通过 watermarked_url 参数查询获取带水印的视频内容
wm_position
integer
默认值:3
水印位置,表示水印出现在图片的位置。1:左上角;2:右上角;3:右下角;4:左下角。默认为 3可选值:1, 2, 3, 4
aspect_ratio
string
默认值:"16:9"
视频比例。默认 16:9,可选值:16:9、9:16。不同 template 支持的可选值不同,详情见模版说明可选值:16:9, 9:16

响应

task_id
string
必填
异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 以获取生成结果
provider_request_id
string
提供商请求 ID(可选)
最后修改于 2026年7月3日