curl --request POST \
--url "https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis" \
--header "Authorization: Bearer $ANTI_API_KEY" \
--header "Content-Type: application/json" \
--data '
{
"model": "w3.0-video",
"input": {
"prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light."
},
"parameters": {
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"audio": true,
"prompt_extend": true
}
}
'
import json
import os
from urllib.request import Request, urlopen
payload = {
"model": "w3.0-video",
"input": {
"prompt": (
"A paper boat floats along a quiet stream at sunrise. "
"Slow tracking shot, soft natural light."
),
},
"parameters": {
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"audio": True,
"prompt_extend": True,
},
}
request = Request(
"https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis",
data=json.dumps(payload).encode(),
headers={
"Authorization": "Bearer " + os.environ["ANTI_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
with urlopen(request, timeout=120) as response:
result = json.load(response)
print(result["output"]["task_id"])
{
"request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
"output": {
"task_id": "example-task-id",
"task_status": "PENDING"
}
}
{
"error": "insufficient_balance",
"message": "insufficient available balance"
}
Wan3.0
创建 Wan3.0 视频任务
提交文本、图片或参考媒体生成 Wan3.0 视频,了解请求参数、媒体限制、预扣费用、任务 ID 和常见错误。
POST
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
curl --request POST \
--url "https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis" \
--header "Authorization: Bearer $ANTI_API_KEY" \
--header "Content-Type: application/json" \
--data '
{
"model": "w3.0-video",
"input": {
"prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light."
},
"parameters": {
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"audio": true,
"prompt_extend": true
}
}
'
import json
import os
from urllib.request import Request, urlopen
payload = {
"model": "w3.0-video",
"input": {
"prompt": (
"A paper boat floats along a quiet stream at sunrise. "
"Slow tracking shot, soft natural light."
),
},
"parameters": {
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"audio": True,
"prompt_extend": True,
},
}
request = Request(
"https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis",
data=json.dumps(payload).encode(),
headers={
"Authorization": "Bearer " + os.environ["ANTI_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
with urlopen(request, timeout=120) as response:
result = json.load(response)
print(result["output"]["task_id"])
{
"request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
"output": {
"task_id": "example-task-id",
"task_status": "PENDING"
}
}
{
"error": "insufficient_balance",
"message": "insufficient available balance"
}
使用 AntiRouter 的 Wan3.0 生成接口,将提示词和可选媒体素材提交为异步视频任务。请求受理后返回任务 ID,请保存该 ID 并调用Query Task获取状态和成片。
建议在首尾帧模式和参考素材模式之间选择一种。素材由服务端读取,请确保 URL 在任务执行期间持续可访问。图片、视频和音频必须支持 HTTP byte-range 请求,并提供可确定的文件大小;不能使用本地文件路径、Base64、data URI、私网地址或直播流。
参考视频的 15 秒限制检查原始时长,不是取整后的计费秒数。
本文中的请求使用推理密钥。生成会预扣账户余额;固定输出时长为 3–14 秒,或传入
-1 使用智能时长。示例 ID 和资源地址仅用于说明响应格式。请求参数
模型 ID,例如
w3.0-video。其他 Wan3.0 型号见Models,请以实时可用模型列表为准。生成参数。请明确设置时长、分辨率、宽高比和所需的音频、提示词扩展选项。
显示 parameters 字段
显示 parameters 字段
媒体类型
type | 用途 | 使用方式 |
|---|---|---|
first_frame | 首帧图像 | 最多 1 项。 |
last_frame | 尾帧图像 | 最多 1 项,配合首帧使用。 |
reference_image | 参考图片 | 与参考视频、参考音频合计最多 5 项。 |
reference_video | 参考视频 | 所有参考视频的原始总时长严格小于 15 秒。 |
reference_audio | 参考音频 | 与其他参考素材共享 5 项上限。 |
file | 文档素材 URL | 最多 1 项,不能与 link 或参考素材组合。 |
link | 公开网页 URL | 最多 1 项,不能与 file 或参考素材组合。 |
| 媒体 | 格式 | 文件大小上限 | 尺寸要求 |
|---|---|---|---|
| 图片 | JPEG/JPG、PNG、BMP、WebP | 10 MiB | 宽高分别为 240–8000 像素,任一方向宽高比不超过 8:1。 |
| 视频 | MP4/MOV 容器系列 | 100 MiB | 与图片相同。 |
| 音频 | WAV、MP3 | 15 MiB | 无图像尺寸要求。 |
file 文档素材应不超过 100 MB;file 和 link 是内容输入,不是文件上传接口。
图生视频示例
将下面input 替换到完整请求中,url 请换成你自己的公网图片地址:
{
"input": {
"prompt": "The camera slowly moves toward the subject. Preserve the composition and lighting of the first frame.",
"media": [
{
"type": "first_frame",
"url": "https://example.com/first-frame.jpg"
}
]
}
}
成功响应
受理成功返回 HTTP200,响应头包含 X-Request-ID。创建接口只返回标识和状态,不返回成片地址或最终用量。
计费与重试
生成前预扣费用,详情见Models。duration: -1 会按 30 秒输出加参考视频计费秒数预扣;完成后以实际用量结算。不要将预扣秒数当作最终输出时长承诺。
请仅提交一次生成请求并保存任务 ID。连接超时不代表任务创建失败;先查看控制台任务记录,已有任务继续查询,避免重复提交产生多个计费任务。
常见错误
| HTTP | error | 处理方式 |
|---|---|---|
400 | invalid_model_request | 检查时长是否为 3–14 或 -1,及媒体参数是否有效。 |
400 | duplicate_media | 首帧、尾帧、file、link 各最多 1 项。 |
400 | conflicting_file_and_link | file 和 link 只保留一种。 |
400 | conflicting_frames_and_references | 使用单一素材模式,移除冲突输入。 |
400 | too_many_reference_media | 将参考图片、视频和音频总数减少到 5 项以内。 |
400 | reference_video_duration_limit_exceeded | 将参考视频总时长缩短至严格小于 15 秒。 |
400 | streaming_media_unsupported | 使用支持 Range 且文件大小明确的直链。 |
400 | invalid_video_media / media_metadata_unavailable | 检查素材类型、URL 和文件是否可读取。 |
400 | image_too_large / video_too_large / audio_too_large | 减小文件大小。 |
400 | unsupported_image_format / unsupported_video_format / unsupported_audio_format | 转换为支持的媒体格式。 |
400 | invalid_media_resolution / invalid_media_aspect_ratio | 调整素材尺寸或宽高比。 |
401 | unauthorized | 使用有效且启用的推理密钥。 |
402 | insufficient_balance | 充值以覆盖本次预扣。 |
404 | not_found | 确认模型 ID 存在且已启用。 |
502 | upstream_unavailable | 查看任务记录后再决定是否重试生成。 |
503 | metering_unavailable | 暂时无法计价,稍后重试。 |
curl --request POST \
--url "https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis" \
--header "Authorization: Bearer $ANTI_API_KEY" \
--header "Content-Type: application/json" \
--data '
{
"model": "w3.0-video",
"input": {
"prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light."
},
"parameters": {
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"audio": true,
"prompt_extend": true
}
}
'
import json
import os
from urllib.request import Request, urlopen
payload = {
"model": "w3.0-video",
"input": {
"prompt": (
"A paper boat floats along a quiet stream at sunrise. "
"Slow tracking shot, soft natural light."
),
},
"parameters": {
"resolution": "720p",
"ratio": "16:9",
"duration": 5,
"audio": True,
"prompt_extend": True,
},
}
request = Request(
"https://anti.rs/api/v1/services/aigc/video-generation/video-synthesis",
data=json.dumps(payload).encode(),
headers={
"Authorization": "Bearer " + os.environ["ANTI_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
with urlopen(request, timeout=120) as response:
result = json.load(response)
print(result["output"]["task_id"])
{
"request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
"output": {
"task_id": "example-task-id",
"task_status": "PENDING"
}
}
{
"error": "insufficient_balance",
"message": "insufficient available balance"
}