Wan 3.0 API
阿里巴巴 Wan 3.0 视频生成模型的完整 API 参考。
模型变体
此 API 支持四种模型变体:
快速比较
共用端点
所有 Wan 3.0 变体均使用视频任务端点:
POST /api/v1/video/task
共用参数
必填
可选
Wan 3.0 文生视频
将 model_name 设为 "wan-3.0-text-to-video",并提供共用的必填参数。
请求示例
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'wan-3.0-text-to-video',
prompt: 'A cinematic tracking shot follows a cyclist through a rain-soaked neon city at night',
duration: 8,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
seed: 42
})
});
const { data } = await response.json();
const taskId = data.task_id;
Wan 3.0 图生视频
必填图像输入
两张图像都必须采用 JPEG、JPG、无 Alpha 通道的 PNG、BMP 或 WEBP 格式。每张图像的各边长度必须在 240 至 8000 像素之间。
请求示例
{
model_name: 'wan-3.0-image-to-video',
prompt: 'The camera glides forward as daylight gradually shifts into a warm evening glow',
image_url: 'https://example.com/start-frame.jpg',
image_end_url: 'https://example.com/end-frame.jpg',
duration: 8,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
seed: 42
}
Wan 3.0 视频编辑
必填视频输入
源视频时长与请求的输出 duration 之和不得超过 30 秒。
请求示例
{
model_name: 'wan-3.0-video-edit',
prompt: 'Turn the daytime scene into a rainy evening while preserving the subject and camera movement',
video_url: 'https://example.com/source-video.mp4',
duration: 10,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
seed: 42
}
Wan 3.0 参考生成视频
参考输入为可选项,并且可以组合使用,但 files 和 links 不能同时提交。
可选参考输入
请求示例
{
model_name: 'wan-3.0-reference-to-video',
prompt: 'Use the references to create a cinematic product launch with coordinated motion and sound',
duration: 12,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
images: ['https://example.com/product-reference.jpg'],
videos: ['https://example.com/motion-reference.mp4'],
audios: ['https://example.com/sound-reference.mp3'],
links: ['https://example.com/public-creative-brief'],
seed: 42
}
若要使用参考文件而非网页,请省略 links,并在 files 中传入单个 URL。
响应格式
初始响应
所有模型都会返回用于轮询的 task_id:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
轮询响应
轮询 GET /api/v1/video/{taskId} 以检查状态:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
状态值
submitted:任务已接受,正在等待处理
processing:视频生成正在进行中
succeed:视频生成已完成
failed:视频生成失败
最佳实践
- 提示词说明:清晰描述主体、动作、镜头运动、节奏、环境和声音意图。
- 图像输入:使用与请求宽高比匹配的首帧、尾帧和参考图像。PNG 图像不得包含 Alpha 通道。
- 视频编辑时长:选择请求的输出时长前,请检查源视频时长,确保两者之和不超过 30 秒。
- 参考内容限制:提交前,请验证每组参考内容的数量、格式、尺寸和总时长。
- 文件和链接:仅提交一个参考文件或一个公开网页链接,同一请求中不得同时提交两者。