文档

视频生成 3.0

通过 TokenByte 主站视频接口调用万相 3.0 文生、首尾帧与参考素材视频

POSThttps://api.tokenbyte.ai/v1/videos

使用 TokenByte 主站视频接口提交万相 3.0 异步生成任务。请先在控制台创建令牌,并将令牌分组选择为 wan-video。

调用前说明

图片、视频和音频素材必须使用服务端能够访问的公网 URL。resolution 的值大小写敏感。

模型支持的分辨率
w3.0-video480p、720p、1080p
w3.0-video-pro1080p、2k、4k

视频时长 duration 支持 2~30 秒,默认值为 5。

文生视频

curl --request POST 'https://api.tokenbyte.ai/v1/videos' \
  --header 'Authorization: Bearer sk-替换为令牌' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "w3.0-video-pro",
    "prompt": "一只柯基在未来科技城市中奔跑,霓虹灯闪烁,电影感运镜,画面流畅稳定",
    "duration": 5,
    "resolution": "1080p",
    "ratio": "16:9",
    "audio": true,
    "prompt_extend": true,
    "seed": 123456
  }'

首帧图生视频

curl --request POST 'https://api.tokenbyte.ai/v1/videos' \
  --header 'Authorization: Bearer sk-替换为令牌' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "w3.0-video-pro",
    "prompt": "人物自然转身并面向镜头,动作流畅,电影感运镜",
    "first_frame": "https://example.com/first-frame.jpg",
    "duration": 5,
    "resolution": "1080p",
    "ratio": "16:9",
    "audio": true,
    "prompt_extend": true
  }'

首尾帧生视频

curl --request POST 'https://api.tokenbyte.ai/v1/videos' \
  --header 'Authorization: Bearer sk-替换为令牌' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "w3.0-video-pro",
    "prompt": "从白天平滑过渡到夜晚,镜头缓慢向前推进",
    "first_frame": "https://example.com/first-frame.jpg",
    "last_frame": "https://example.com/last-frame.jpg",
    "duration": 5,
    "resolution": "1080p",
    "ratio": "16:9",
    "audio": false,
    "prompt_extend": true
  }'

参考素材生视频

curl --request POST 'https://api.tokenbyte.ai/v1/videos' \
  --header 'Authorization: Bearer sk-替换为令牌' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "w3.0-video-pro",
    "prompt": "保持参考人物外观一致,复刻参考视频的动作和镜头节奏",
    "reference_images": ["https://example.com/person.jpg"],
    "reference_videos": ["https://example.com/action.mp4"],
    "reference_audios": ["https://example.com/background.mp3"],
    "duration": 10,
    "resolution": "1080p",
    "ratio": "adaptive",
    "audio": true,
    "prompt_extend": true
  }'

images 兼容字段

images 中第一张图片会转换为 first_frame,第二张图片会转换为 last_frame。

curl --request POST 'https://api.tokenbyte.ai/v1/videos' \
  --header 'Authorization: Bearer sk-替换为令牌' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "w3.0-video-pro",
    "prompt": "两个画面之间自然、平滑地转换",
    "images": [
      "https://example.com/first-frame.jpg",
      "https://example.com/last-frame.jpg"
    ],
    "duration": 5,
    "size": "1080p",
    "ratio": "16:9"
  }'

查询任务与获取视频

提交成功后保存响应中的 id。任务状态变为 completed 后,即可下载视频内容。

curl --request GET 'https://api.tokenbyte.ai/v1/videos/TASK_ID' \
  --header 'Authorization: Bearer sk-替换为令牌'

curl --location --request GET \
  'https://api.tokenbyte.ai/v1/videos/TASK_ID/content' \
  --header 'Authorization: Bearer sk-替换为令牌' \
  --output result.mp4

提交成功响应示例:

{
  "id": "任务公开ID",
  "object": "video",
  "model": "w3.0-video-pro",
  "status": "queued"
}

参数说明

参数类型必填说明
modelstring是w3.0-video 或 w3.0-video-pro。
promptstring是视频生成提示词。
first_framestring否首帧图片的公网 URL。
last_framestring否尾帧图片的公网 URL。
reference_imagesstring[]否参考图片的公网 URL 数组。
reference_videosstring[]否参考视频的公网 URL 数组。
reference_audiosstring[]否参考音频的公网 URL 数组。
resolutionstring否输出分辨率,支持值取决于模型,大小写敏感。
durationnumber否2~30 秒,默认 5。
ratiostring否adaptive、16:9、4:3、1:1、3:4 或 9:16;默认 adaptive。
audioboolean否是否生成或保留音频;显式传入 false 会正常传给上游。
seedinteger否随机种子,范围 0~2147483647。
prompt_extendboolean否是否启用提示词扩写;显式传入 false 会正常传给上游。

本页导航