跳转到主要内容
POST
/
v3
/
async
/
wan-t2v
Wan 2.1 文生视频
curl --request POST \
  --url https://api.ppio.com/v3/async/wan-t2v \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 123,
  "height": 123,
  "loras": [
    {
      "path": "<string>",
      "scale": 123
    }
  ],
  "seed": 123,
  "steps": 123,
  "guidance_scale": 123,
  "flow_shift": 123,
  "enable_safety_checker": true,
  "fast_mode": true,
  "watermark": true
}
'
import requests

url = "https://api.ppio.com/v3/async/wan-t2v"

payload = {
"prompt": "<string>",
"negative_prompt": "<string>",
"width": 123,
"height": 123,
"loras": [
{
"path": "<string>",
"scale": 123
}
],
"seed": 123,
"steps": 123,
"guidance_scale": 123,
"flow_shift": 123,
"enable_safety_checker": True,
"fast_mode": True,
"watermark": True
}
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({
prompt: '<string>',
negative_prompt: '<string>',
width: 123,
height: 123,
loras: [{path: '<string>', scale: 123}],
seed: 123,
steps: 123,
guidance_scale: 123,
flow_shift: 123,
enable_safety_checker: true,
fast_mode: true,
watermark: true
})
};

fetch('https://api.ppio.com/v3/async/wan-t2v', 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/wan-t2v",
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([
'prompt' => '<string>',
'negative_prompt' => '<string>',
'width' => 123,
'height' => 123,
'loras' => [
[
'path' => '<string>',
'scale' => 123
]
],
'seed' => 123,
'steps' => 123,
'guidance_scale' => 123,
'flow_shift' => 123,
'enable_safety_checker' => true,
'fast_mode' => true,
'watermark' => true
]),
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/wan-t2v"

payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"loras\": [\n {\n \"path\": \"<string>\",\n \"scale\": 123\n }\n ],\n \"seed\": 123,\n \"steps\": 123,\n \"guidance_scale\": 123,\n \"flow_shift\": 123,\n \"enable_safety_checker\": true,\n \"fast_mode\": true,\n \"watermark\": true\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/wan-t2v")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"loras\": [\n {\n \"path\": \"<string>\",\n \"scale\": 123\n }\n ],\n \"seed\": 123,\n \"steps\": 123,\n \"guidance_scale\": 123,\n \"flow_shift\": 123,\n \"enable_safety_checker\": true,\n \"fast_mode\": true,\n \"watermark\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ppio.com/v3/async/wan-t2v")

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 \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"width\": 123,\n \"height\": 123,\n \"loras\": [\n {\n \"path\": \"<string>\",\n \"scale\": 123\n }\n ],\n \"seed\": 123,\n \"steps\": 123,\n \"guidance_scale\": 123,\n \"flow_shift\": 123,\n \"enable_safety_checker\": true,\n \"fast_mode\": true,\n \"watermark\": true\n}"

response = http.request(request)
puts response.read_body
{
  "task_id": "<string>"
}
Wan 2.1 14B 文生视频模型的加速推理,这是一套全面且开放的视频基础模型套件,推动了视频生成的边界。默认情况下,API 将生成 5 秒的视频。
本模型服务仅针对已完成 PPIO派欧云 平台企业认证的用户开放。具体请参见实名认证
这是一个异步API,只会返回异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 来检索视频生成结果。

请求头

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

请求体

prompt
string
必填
指导生成所需的提示文本。取值范围:[1, 2000]
negative_prompt
string
负面提示指示模型避免生成哪些元素。取值范围:[0, 2000]
width
integer
输出视频的宽度。枚举值:4807208321280默认:832。如果未指定宽度或高度,宽度和高度将被强制设置为 832480
height
integer
输出视频的高度。支持:
  • (480p) 宽度为 480 时高度设置为 832
  • (480p) 宽度为 832 时高度设置为 480
  • (720p) 宽度为 720 时高度设置为 1280
  • (720p) 宽度为 1280 时高度设置为 720
默认:480。如果未指定宽度或高度,宽度和高度将被强制设置为 832480
loras
object[]
应用于视频生成的 LoRA 模型。支持最多指定 3 个 LoRA 模型
seed
integer
随机数种子,稳定扩散产生噪声的数字,取值范围:[-1, 9999999999]。默认值为 -1。
steps
integer
迭代步数,图片创建过程的迭代数,取值范围:[1, 40]。默认:30
guidance_scale
float
引导缩放参数控制生成内容对提示的跟随程度。取值范围:[0, 10]。默认:5.0
flow_shift
float
flow_shift 参数主要影响视频中物体运动的速度和幅度。更高的值产生更明显和更快的运动,而较低的值使运动更慢更细微。取值范围:[1, 10]。默认:5.0
enable_safety_checker
boolean
enable_safety_checker 参数控制是否对生成的内容应用安全过滤器。启用时,它有助于从视频输出中过滤掉潜在的有害或不当内容。默认:true
fast_mode
boolean
是否启用快速模式,将更快地生成视频但可能降低质量和价格。默认:false
watermark
boolean
默认值:false
为生成的视频添加水印。
  • false:不添加水印。
  • true:在视频添加文字的水印,标识由人工智能生成合成。

响应

task_id
string
必填
异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 以获取生成结果

示例

以下是如何使用 Wan 2.1 文生视频 API 的示例。
  1. 通过向 Wan 2.1 文生视频 API 发送 POST 请求生成 task_id。
请求:
curl --location 'https://api.ppio.com/v3/async/wan-t2v' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
    "height": 1280,
    "width": 720,
    "seed": -1,
    "prompt": "3D animation of a small, round, fluffy creature with big, expressive eyes explores a vibrant, enchanted forest. The creature, a whimsical blend of a rabbit and a squirrel, has soft blue fur and a bushy, striped tail. It hops along a sparkling stream, its eyes wide with wonder. The forest is alive with magical elements: flowers that glow and change colors, trees with leaves in shades of purple and silver, and small floating lights that resemble fireflies. The creature stops to interact playfully with a group of tiny, fairy-like beings dancing around a mushroom ring. The creature looks up in awe at a large, glowing tree that seems to be the heart of the forest."
}'
响应:
{
    "task_id": "{返回的任务 ID}"
}
  1. 使用 task_id 获取输出视频。
2xx 范围内的 HTTP 状态码表示请求已被成功接受,而 5xx 范围内的状态码表示内部服务器错误。 您可以在响应的 videos 中获取视频 URL。 请求:
curl --location --request GET 'https://api.ppio.com/v3/async/task-result?task_id={返回的任务 ID}' \
--header 'Authorization: Bearer {{API Key}}'
响应:
{
    "task": {
        "task_id": "{返回的任务 ID}",
        "task_type": "WAN_TXT_TO_VIDEO",
        "status": "TASK_STATUS_SUCCEED",
        "reason": "",
        "eta": 0,
        "progress_percent": 100
    },
    "images": [],
    "videos": [
        {
            "video_url": "{生成视频的 URL}",
            "video_url_ttl": "3600",
            "video_type": "mp4"
        }
    ]
}
最后修改于 2026年1月14日