# Wan 3.0 视频 API（自部署）

视频分组 **#155「【视频】多模型按秒计费」**，模型名 `wan3.0-video-自部署`。基础地址 `https://yyds.seqnode.com/v1`，创建 `POST /v1/videos`，查询 `GET /v1/videos/TASK_ID`。

## 模型与价格

| 分辨率 | 售价 | 5 秒 | 30 秒 |
|---|---|---|---|
| 480p | $0.30 / 秒 | $1.50 | $9.00 |
| 720p | $0.58 / 秒 | $2.90 | $17.40 |
| 1080p | $1.18 / 秒 | $5.90 | $35.40 |

只按输出视频秒数 × 档位单价计费；参考素材不另收费。价格以模型广场为准。

## 请求参数

| 字段 | 类型 | 是否必填 | 取值与说明 |
|---|---|---|---|
| model | string | 必填 | wan3.0-video-自部署 |
| prompt | string | 必填 | 视频描述，不能为空 |
| resolution | string | 必填 | 480p、720p、1080p（大小写均可）；本站按此档位计费 |
| duration_seconds | integer | 必填 | 2–30 秒的整数；也可写 seconds 或 duration，三者不能互相矛盾；本站按此秒数计费 |
| aspect_ratio | string | 可选 | 16:9、9:16、1:1、4:3、3:4 |
| reference_images | string[] | 可选 | 参考图片，公网可访问的 HTTPS 直链 |
| reference_videos | string[] | 可选 | 参考视频，公网可访问的 HTTPS 直链 |
| reference_audios | string[] | 可选 | 参考音频，公网可访问的 HTTPS 直链 |
| seed | integer | 可选 | 随机种子，相同参数配合相同种子便于复现 |

不支持（422）：`media_inputs`、`images`、`first_frame_url`、`input_reference`、`negative_prompt`。素材必须是公网 HTTPS 直链，不支持 base64。

## 文生视频

```bash
curl --fail-with-body 'https://yyds.seqnode.com/v1/videos' \
  -H 'Authorization: Bearer YOUR_GROUP_155_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "wan3.0-video-自部署",
  "prompt": "一只橘猫在窗台上伸懒腰，阳光洒进房间，镜头缓慢推近。",
  "resolution": "720p",
  "aspect_ratio": "16:9",
  "duration_seconds": 5
}'
```

## 参考图生视频

```bash
curl --fail-with-body 'https://yyds.seqnode.com/v1/videos' \
  -H 'Authorization: Bearer YOUR_GROUP_155_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "wan3.0-video-自部署",
  "prompt": "让参考图里的人物在海边慢慢转身，海风吹动头发。",
  "resolution": "1080p",
  "aspect_ratio": "9:16",
  "duration_seconds": 8,
  "reference_images": ["https://example.com/person.jpg"]
}'
```

## 查询与下载

完成后 `delivery_status` 为 `ready`，播放地址 `video.url`，下载地址 `video.download_url`，转存完成后 1 小时有效。

```bash
curl --fail-with-body 'https://yyds.seqnode.com/v1/videos/TASK_ID' \
  -H 'Authorization: Bearer YOUR_GROUP_155_API_KEY'
```

## Python 完整示例

```python
import time, requests

BASE = "https://yyds.seqnode.com/v1"
HEAD = {"Authorization": "Bearer YOUR_GROUP_155_API_KEY"}

task = requests.post(f"{BASE}/videos", headers=HEAD, json={
    "model": "wan3.0-video-自部署",
    "prompt": "一只橘猫在窗台上伸懒腰，阳光洒进房间。",
    "resolution": "720p",
    "duration_seconds": 5,
}, timeout=60)
task.raise_for_status()
tid = task.json()["id"]

for _ in range(180):                      # 最多等约 30 分钟
    r = requests.get(f"{BASE}/videos/{tid}", headers=HEAD, timeout=60).json()
    if r.get("status") == "failed":
        raise SystemExit(r)
    if r.get("delivery_status") == "ready":
        url = r["video"]["download_url"]
        open(f"{tid}.mp4", "wb").write(requests.get(url, timeout=300).content)
        print("saved", tid, url)
        break
    time.sleep(10)
```

## 常见错误

| 状态码 | 报错 | 原因与处理 |
|---|---|---|
| 400 | resolution is required for … | 没传 resolution，或档位不是 480p / 720p / 1080p |
| 422 | Field seconds is below the minimum / above the maximum | 时长不在 2–30 秒 |
| 422 | Field aspect_ratio is not among the allowed enum values | 比例不在上表 |
| 422 | The request contains a field the model does not support: … | 传了本模型不认识的字段，例如 media_inputs、images、negative_prompt、first_frame_url |
| 422 | Failed to download the input material | 参考素材链接无法下载：确认是公网 HTTPS 直链、不需要登录、没有防盗链 |
| 401 | INVALID_API_KEY | Key 不对，或不属于 #155 分组 |

## 验证记录

2026-10-30：经本站公网逐项校验了全部字段、三个分辨率档位、五种比例和 2–30 秒时长范围。

