跳转到内容
免费注册
Wan

Wan 视频 API:文生、图生、参考与编辑

用 BetterToken API Key 接入 Wan,按 Model ID 和操作选择字段、素材与生成方式。

你可以从文字、首帧或参考素材生成视频,也可以编辑已有视频。3.0 与 Prime 支持三种生成操作;2.7 按文生、图生、参考生成和编辑分别选择 Model ID。

先准备 BetterToken API Key。Base URL 为 https://bettertoken.ai/v1,认证使用 Authorization: Bearer YOUR_API_KEY。原样复制 Model ID,大小写必须一致。

下方每份 request.json 都使用同一流程:先报价,再确认创建、轮询与下载。报价不启动生成;创建会提交付费任务。当前费用见模型广场。

型号与操作

下表按操作列出可选值;字段默认值、素材数量和组合限制见对应小节。素材大小按 1 MB = 1048576 字节换算。

Model ID操作时长(秒)输出档位比例音频素材角色
wan2.7-i2vimage_to_video2–15,步长 1720p、1080p不传provider_defaultfirst_frame、last_frame、driving_audio
wan2.7-r2vreference_to_video2–15,步长 1720p、1080p16:9、9:16、1:1、4:3、3:4provider_defaultreference_image、reference_video
wan2.7-t2vtext_to_video2–15,步长 1720p、1080p16:9、9:16、1:1、4:3、3:4provider_defaultdriving_audio
wan2.7-videoeditvideo_edit2–15,步长 1;可用 auto720p、1080p不传provider_defaultbase_video
wan3.0-video-primeimage_to_video2–30,步长 1;可用 auto480p、720p、1080padaptive、21:9、16:9、4:3、1:1、3:4、9:16on、offfirst_frame、last_frame
wan3.0-video-primereference_to_video2–30,步长 1;可用 auto480p、720p、1080padaptive、21:9、16:9、4:3、1:1、3:4、9:16on、offreference_image、reference_video、reference_audio
wan3.0-video-primetext_to_video2–30,步长 1;可用 auto480p、720p、1080padaptive、21:9、16:9、4:3、1:1、3:4、9:16on、off无
wan3.0-videoimage_to_video2–30,步长 1;可用 auto480p、720p、1080padaptive、21:9、16:9、4:3、1:1、3:4、9:16on、offfirst_frame、last_frame
wan3.0-videoreference_to_video2–30,步长 1;可用 auto480p、720p、1080padaptive、21:9、16:9、4:3、1:1、3:4、9:16on、offreference_image、reference_video、reference_audio
wan3.0-videotext_to_video2–30,步长 1;可用 auto480p、720p、1080padaptive、21:9、16:9、4:3、1:1、3:4、9:16on、off无

图生(wan2.7-i2v,以及比例为 adaptive 时的 wan3.0-video、wan3.0-video-prime)与比例为 adaptive 的参考生视频,成片比例跟随输入图片;输出档位决定画面像素总量,而不是固定宽高。例如本页 1:1 示例图:720p 实测输出 960×960,480p 实测输出 640×640。需要固定横屏或竖屏时,请显式传 output.aspect_ratio(wan2.7-i2v 不支持该字段,请使用对应比例的输入图片)。

示例素材

图生与图片参考示例使用白色桌面上的蓝色陶瓷杯。你可以保留样图试用,也可以先替换为自己有权使用且符合本页限制的公网 HTTPS 素材。

视频生成参考图:白色桌面上的蓝色陶瓷杯

编辑示例使用男孩在城市广场中的视频,约 5.04 秒,1280 × 720,24 fps。它以 base_video 传入,不是参考图片。

文生视频

wan2.7-t2v

你只有文字描述时,使用本操作生成视频。

把 model 设为本小节的 Model ID,把 operation 设为 text_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否provider_defaultprovider_default
duration.modestring否fixedfixed
duration.secondsinteger否2–15,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否16:9、9:16、1:1、4:3、3:416:9
output.formatstring否mp4mp4
output.resolutionstring否720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
driving_audioaudio,可选,最多 1 个wav、mp3大小不超过 15 MB;时长 2–30 秒

素材是否必需还需满足下方组合约束。

可选的 driving_audio 是驱动音频,使用 type="audio"。它与参考生成中的 reference_audio 是不同的素材角色。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan2.7-t2v",
"operation": "text_to_video",
"prompt": "A blue ceramic mug on a white table. Slowly move the camera closer in soft daylight.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "16:9"
}
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

wan3.0-video-prime

你只有文字描述时,使用本操作生成视频。

把 model 设为本小节的 Model ID,把 operation 设为 text_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否on、offon
duration.modestring否fixed、autofixed
duration.secondsinteger否2–30,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否adaptive、21:9、16:9、4:3、1:1、3:4、9:16adaptive
output.formatstring否mp4mp4
output.resolutionstring否480p、720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

本操作不接收素材。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan3.0-video-prime",
"operation": "text_to_video",
"prompt": "A blue ceramic mug on a white table. Slowly move the camera closer in soft daylight.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "16:9"
}
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。

wan3.0-video

你只有文字描述时,使用本操作生成视频。

把 model 设为本小节的 Model ID,把 operation 设为 text_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否on、offon
duration.modestring否fixed、autofixed
duration.secondsinteger否2–30,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否adaptive、21:9、16:9、4:3、1:1、3:4、9:16adaptive
output.formatstring否mp4mp4
output.resolutionstring否480p、720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

本操作不接收素材。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan3.0-video",
"operation": "text_to_video",
"prompt": "A blue ceramic mug on a white table. Slowly move the camera closer in soft daylight.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "16:9"
}
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。

图生视频

wan2.7-i2v

你希望以图片确定起始画面或首尾画面时,使用本操作。

把 model 设为本小节的 Model ID,把 operation 设为 image_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否provider_defaultprovider_default
duration.modestring否fixedfixed
duration.secondsinteger否2–15,步长 1 秒;仅固定时长使用5
output.formatstring否mp4mp4
output.resolutionstring否720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
first_frameimage,1 个(必填)jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
last_frameimage,可选,最多 1 个jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
driving_audioaudio,可选,最多 1 个wav、mp3大小不超过 15 MB;时长 2–30 秒

素材是否必需还需满足下方组合约束。

可选的 driving_audio 是驱动音频,使用 type="audio"。它与参考生成中的 reference_audio 是不同的素材角色。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 必须提供 first_frame。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan2.7-i2v",
"operation": "image_to_video",
"prompt": "Slowly move the camera closer to the blue ceramic mug. Preserve its shape and the white table.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p"
},
"media": [
{
"id": "first",
"type": "image",
"role": "first_frame",
"source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

wan3.0-video-prime

你希望以图片确定起始画面或首尾画面时,使用本操作。

把 model 设为本小节的 Model ID,把 operation 设为 image_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否on、offon
duration.modestring否fixed、autofixed
duration.secondsinteger否2–30,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否adaptive、21:9、16:9、4:3、1:1、3:4、9:16adaptive
output.formatstring否mp4mp4
output.resolutionstring否480p、720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
first_frameimage,1 个(必填)jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
last_frameimage,可选,最多 1 个jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px

素材是否必需还需满足下方组合约束。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。
  • 至少提供以下角色之一:first_frame、last_frame。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan3.0-video-prime",
"operation": "image_to_video",
"prompt": "Slowly move the camera closer to the blue ceramic mug. Preserve its shape and the white table.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "adaptive"
},
"media": [
{
"id": "first",
"type": "image",
"role": "first_frame",
"source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

wan3.0-video

你希望以图片确定起始画面或首尾画面时,使用本操作。

把 model 设为本小节的 Model ID,把 operation 设为 image_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否on、offon
duration.modestring否fixed、autofixed
duration.secondsinteger否2–30,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否adaptive、21:9、16:9、4:3、1:1、3:4、9:16adaptive
output.formatstring否mp4mp4
output.resolutionstring否480p、720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
first_frameimage,1 个(必填)jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
last_frameimage,可选,最多 1 个jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px

素材是否必需还需满足下方组合约束。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。
  • 至少提供以下角色之一:first_frame、last_frame。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan3.0-video",
"operation": "image_to_video",
"prompt": "Slowly move the camera closer to the blue ceramic mug. Preserve its shape and the white table.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "adaptive"
},
"media": [
{
"id": "first",
"type": "image",
"role": "first_frame",
"source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

参考生成

wan2.7-r2v

你希望用参考素材保持主体或动作特征时,使用本操作。

把 model 设为本小节的 Model ID,把 operation 设为 reference_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否provider_defaultprovider_default
duration.modestring否fixedfixed
duration.secondsinteger否2–15,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否16:9、9:16、1:1、4:3、3:416:9
output.formatstring否mp4mp4
output.resolutionstring否720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
reference_imageimage,可选,最多 10 个jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
reference_videovideo,可选,最多 5 个mp4、mov大小不超过 100 MB;宽 240–4096 px;高 240–4096 px;时长 1–15 秒;帧率不低于 16 fps;本角色合计不超过 15 秒

素材是否必需还需满足下方组合约束。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 至少提供以下角色之一:reference_image、reference_video。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan2.7-r2v",
"operation": "reference_to_video",
"prompt": "Create a product video of the blue ceramic mug in the reference image. Keep its shape and color.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "16:9"
},
"media": [
{
"id": "reference",
"type": "image",
"role": "reference_image",
"source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

wan3.0-video-prime

你希望用参考素材保持主体或动作特征时,使用本操作。

把 model 设为本小节的 Model ID,把 operation 设为 reference_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否on、offon
duration.modestring否fixed、autofixed
duration.secondsinteger否2–30,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否adaptive、21:9、16:9、4:3、1:1、3:4、9:16adaptive
output.formatstring否mp4mp4
output.resolutionstring否480p、720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
reference_imageimage,可选,最多 10 个jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
reference_videovideo,可选,最多 5 个mp4、mov大小不超过 100 MB;宽 240–4096 px;高 240–4096 px;时长 1–15 秒;帧率不低于 16 fps;本角色合计不超过 15 秒
reference_audioaudio,可选,最多 5 个wav、mp3大小不超过 15 MB;时长 1–15 秒;本角色合计不超过 15 秒

素材是否必需还需满足下方组合约束。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。
  • 至少提供以下角色之一:reference_image、reference_video、reference_audio。
  • 带参考视频时,输入视频总时长与输出时长之和不能超过 30 秒。使用自动时长时,输出上限也受这个剩余额度限制。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan3.0-video-prime",
"operation": "reference_to_video",
"prompt": "Create a product video of the blue ceramic mug in the reference image. Keep its shape and color.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "adaptive"
},
"media": [
{
"id": "reference",
"type": "image",
"role": "reference_image",
"source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。
sum_lte缩短参考视频总时长或输出时长,使合计不超过 30 秒。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

wan3.0-video

你希望用参考素材保持主体或动作特征时,使用本操作。

把 model 设为本小节的 Model ID,把 operation 设为 reference_to_video。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否on、offon
duration.modestring否fixed、autofixed
duration.secondsinteger否2–30,步长 1 秒;仅固定时长使用5
output.aspect_ratiostring否adaptive、21:9、16:9、4:3、1:1、3:4、9:16adaptive
output.formatstring否mp4mp4
output.resolutionstring否480p、720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
reference_imageimage,可选,最多 10 个jpeg、jpg、png、bmp、webp大小不超过 20 MB;宽 240–8000 px;高 240–8000 px
reference_videovideo,可选,最多 5 个mp4、mov大小不超过 100 MB;宽 240–4096 px;高 240–4096 px;时长 1–15 秒;帧率不低于 16 fps;本角色合计不超过 15 秒
reference_audioaudio,可选,最多 5 个wav、mp3大小不超过 15 MB;时长 1–15 秒;本角色合计不超过 15 秒

素材是否必需还需满足下方组合约束。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。
  • 至少提供以下角色之一:reference_image、reference_video、reference_audio。
  • 带参考视频时,输入视频总时长与输出时长之和不能超过 30 秒。使用自动时长时,输出上限也受这个剩余额度限制。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan3.0-video",
"operation": "reference_to_video",
"prompt": "Create a product video of the blue ceramic mug in the reference image. Keep its shape and color.",
"duration": {
"mode": "fixed",
"seconds": 5
},
"output": {
"resolution": "720p",
"aspect_ratio": "adaptive"
},
"media": [
{
"id": "reference",
"type": "image",
"role": "reference_image",
"source": "https://docs.bettertoken.ai/images/nano-banana-guide/sample-07.png"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。
sum_lte缩短参考视频总时长或输出时长,使合计不超过 30 秒。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

视频编辑

wan2.7-videoedit

你希望修改已有视频的画面时,使用本操作。先准备一段符合限制的源视频。

把 model 设为本小节的 Model ID,把 operation 设为 video_edit。仅使用下表列出的生成字段;素材放在 media 数组中。

字段类型必填可选值或范围默认值
audio.modestring否provider_defaultprovider_default
duration.modestring否fixed、autoauto
duration.secondsinteger否2–15,步长 1 秒;仅固定时长使用无
output.formatstring否mp4mp4
output.resolutionstring否720p、1080p1080p
promptstring是字符串无
provider_options.alibaba.prompt_extendboolean否true / false;控制提示词扩展true
seedinteger否0–2147483647,步长 1;随机种子,可为 0无
watermarkboolean否false、truefalse

素材要求

素材角色类型与数量格式单文件限制
base_videovideo,1 个(必填)mp4、mov大小不超过 100 MB;宽 240–4096 px;高 240–4096 px;时长 1–15 秒;帧率不低于 16 fps;本角色合计不超过 15 秒

素材是否必需还需满足下方组合约束。

组合约束

  • 使用 duration.mode="fixed" 时必须有 duration.seconds。显式填写 fixed 时请同时填写秒数。
  • 必须提供 base_video。
  • 使用 duration.mode="auto" 时不要传 duration.seconds。

请求示例

将下方 JSON 保存为 request.json,然后按通用流程先报价、确认后创建。

{
"model": "wan2.7-videoedit",
"operation": "video_edit",
"prompt": "Keep the boy and his motion in the source video. Give the city plaza warmer evening lighting.",
"duration": {
"mode": "auto"
},
"output": {
"resolution": "720p"
},
"media": [
{
"id": "base",
"type": "video",
"role": "base_video",
"source": "https://bettertoken.ai/video-api/shared/kling-hero-3.0.mp4"
}
]
}

常见 422 错误

422 错误码处理方法
enum / range / step按本节字段表调整取值与步长。
unsupported_field删除本操作字段表中没有的字段。
requires按本节组合约束补齐秒数、比例、音频设置或素材。
excludes删除与自动时长或尾帧冲突的字段。
count / media_role按本节素材表调整角色与数量。
video_input_unsupported检查公网 HTTPS 地址、Content-Type 与文件格式,再重新报价。

官方资料

调用 BetterToken 时,使用本页字段与实时模型目录中的对应操作。