---
title: "HappyWan API:阿里限时预览视频模型,$0.074/秒起｜APIMODELS"
description: "HappyWan API 参数文档:阿里限时预览视频模型,开放到 12 月 7 日。文生、首尾帧或最多 50 张参考图,支持视频编辑与延长,2–45 秒带音轨。$0.074/秒起,失败不扣费。附 cURL / Python / Node 示例。"
canonical: https://apimodels.app/zh/docs/happywan
markdown: https://apimodels.app/zh/docs/happywan.md
language: zh
source: "Generated from the HTML docs page at the canonical URL; the HTML page is the source of truth. Docs index: https://apimodels.app/llms.txt"
---

# HappyWan API

HappyWan 是阿里的限时预览视频模型,在 apimodels.app 开放到 2026-12-07 23:59(北京时间)。一个模型名覆盖文生视频、首帧 / 尾帧 / 首尾帧生视频,以及「全能参考」—— 最多 50 张参考图、10 段参考视频、10 段参考音频;配合 reference_task_type 还能编辑或延长一段参考视频。时长 2 到 45 秒(或 -1 由模型决定),480P / 720P / 1080P,七种画幅,自带音轨。按秒计费,$0.074/秒起,失败不扣费。走 apimodels.app 统一视频端点。

## 限时预览

- 开放到 2026-12-07 23:59(北京时间,即 2026-12-07 15:59 UTC)。之后新建任务直接返回 400,不冻结余额、不扣费。
- 预览期的上游并发有限,高峰时任务可能排队更久;建议用 callback_url 代替高频轮询。

## 价格(按秒)

按上游实际回报的秒数计费:输出秒数,加上参考视频的秒数(同一单价)。参考图、参考音频不额外收费,音轨开关不影响价格。

| 分辨率   | 单价       | 5 秒    | 15 秒   | 45 秒    |
| ----- | -------- | ------ | ------ | ------- |
| 480P  | $0.074/s | $0.37  | $1.11  | $3.33   |
| 720P  | $0.148/s | $0.74  | $2.22  | $6.66   |
| 1080P | $0.295/s | $1.475 | $4.425 | $13.275 |

- 费用 = 单价 × 计费秒数。例:5 秒 720P 是 $0.74;对一段 10 秒的参考视频做 10 秒延长,按 20 秒计,$2.96。
- duration 传 -1 或不传时,模型自己决定时长:我们按 45 秒的最坏情况冻结额度,拿到真实秒数后按实际扣费、差额退回。
- 失败不扣费,被审核拒掉的任务同样不扣费。

## 创建任务

`POST /api/v1/video/generations` —— 异步:创建后轮询同一个端点取结果。

```bash
# Step 1: Create task (text-to-video)
curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happywan",
    "prompt": "A red paper boat drifting down a rain-soaked city street at dusk, neon reflections, gentle camera follow",
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 5
  }'

# Edit a reference video (duration must be -1: editing follows the source length)
curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happywan",
    "prompt": "Turn the scene in video 1 into a snowy winter night, keep the motion and camera",
    "reference_video_urls": ["https://example.com/your-clip.mp4"],
    "reference_task_type": "edit",
    "ratio": "adaptive",
    "duration": -1
  }'

# Step 2: Poll status
curl "https://api.apimodels.app/v1/video/generations?task_id=TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```python
import requests, time

API_KEY = "YOUR_API_KEY"
ENDPOINT = "https://api.apimodels.app/v1/video/generations"

# Step 1: Create task.
#   text-to-video       -> prompt only
#   first / last frame  -> first_frame_url [+ last_frame_url]
#   all-in-one reference -> reference_image_urls / reference_video_urls / reference_audio_urls
#   NOTE: frame mode and reference mode are mutually exclusive.
res = requests.post(ENDPOINT,
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={
        "model": "happywan",
        "prompt": "A red paper boat drifting down a rain-soaked city street at dusk",
        "resolution": "720P",              # 480P / 720P / 1080P — we default to 720P
        "ratio": "16:9",                   # adaptive / 21:9 / 16:9 / 4:3 / 1:1 / 3:4 / 9:16
        "duration": 5,                     # 2-45, or -1 to let the model choose
        "audio": True,                     # audio track on (default)
    }
)
task_id = res.json()["data"]["taskId"]
print(f"Task created: {task_id}")

# Step 2: Poll for result
while True:
    status = requests.get(f"{ENDPOINT}?task_id={task_id}",
        headers={"Authorization": f"Bearer {API_KEY}"}).json()
    state = status["data"]["state"]
    print(f"Status: {state}")
    if state == "completed":
        print(f"Video: {status['data']['resultUrls'][0]}")
        break
    elif state == "failed":
        print(f"Failed: {status['data']['failMsg']}")
        break
    time.sleep(10)
```

```javascript
const API_KEY = 'YOUR_API_KEY';
const ENDPOINT = 'https://api.apimodels.app/v1/video/generations';

async function generate() {
  // Step 1: Create task
  const res = await fetch(ENDPOINT, {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({
      model: 'happywan',
      prompt: 'A red paper boat drifting down a rain-soaked city street at dusk',
      resolution: '720P',            // 480P / 720P / 1080P — we default to 720P
      ratio: '16:9',
      duration: 5,                   // 2-45, or -1 for automatic duration
    }),
  });
  const { data } = await res.json();
  console.log('Task created:', data.taskId);

  // Step 2: Poll for result
  while (true) {
    const r = await fetch(`${ENDPOINT}?task_id=${data.taskId}`, {
      headers: { 'Authorization': `Bearer ${API_KEY}` },
    });
    const s = (await r.json()).data;
    console.log('Status:', s.state);
    if (s.state === 'completed') { console.log('Video:', s.resultUrls[0]); break; }
    if (s.state === 'failed') { console.log('Failed:', s.failMsg); break; }
    await new Promise(r => setTimeout(r, 10000));
  }
}
generate();
```

## 用法

| 用法            | 传什么                                                                                                       |
| ------------- | --------------------------------------------------------------------------------------------------------- |
| 文生视频          | 只传 prompt                                                                                                 |
| 首帧 / 尾帧 / 首尾帧 | first_frame_url / last_frame_url                                                                          |
| 全能参考          | reference_image_urls / reference_video_urls / reference_audio_urls,reference_task_type 为 auto 或 reference |
| 视频编辑          | reference_video_urls \+ reference_task_type: "edit",ratio 为 adaptive,duration 为 -1                        |
| 视频延长          | reference_video_urls \+ reference_task_type: "extend",ratio 为 adaptive;只返回新增片段                            |
| 人物替换          | reference_video_urls \+ reference_image_urls \+ reference_task_type: "edit",提示词写「把视频1 里的人换成图1 的角色」        |

首帧 / 尾帧与参考类素材互斥,不能在同一个请求里混用。全能参考模式下,提示词里用「图1」「视频1」「音频1」按顺序指代素材(图、视频、音频各自独立编号)。reference_task_type 默认 auto,由模型按提示词判断是参考生成、编辑还是延长;想要确定的行为就显式传 reference / edit / extend。

## 请求参数

| 字段                   | 必填 | 类型         | 说明                                                                                |
| -------------------- | -- | ---------- | --------------------------------------------------------------------------------- |
| model                | 是  | string     | "happywan"(别名 "happywan-preview")                                                 |
| prompt               | 否  | string     | 视频描述,最长 20000 字符。prompt 与素材至少传一个                                                  |
| first_frame_url      | 否  | string     | 首帧图。与参考类素材互斥                                                                      |
| last_frame_url       | 否  | string     | 尾帧图,可单独传,也可与首帧一起传                                                                 |
| reference_image_urls | 否  | string\[\] | 参考图,最多 50 张。提示词里按顺序称「图1」「图2」                                                      |
| reference_video_urls | 否  | string\[\] | 参考视频,最多 10 段;秒数按同一单价计费。编辑和延长必须传                                                   |
| reference_audio_urls | 否  | string\[\] | 参考音频,最多 10 段                                                                      |
| reference_task_type  | 否  | string     | "auto"(默认)/ "reference" / "edit" / "extend"。非 auto 时必须带参考素材;edit / extend 必须带参考视频 |
| resolution           | 否  | string     | "480P" / "720P" / "1080P"。省略时默认 720P                                              |
| ratio                | 否  | string     | "adaptive"、"21:9"、"16:9"、"4:3"、"1:1"、"3:4"、"9:16"。编辑和延长只能用 adaptive(保持原片画幅)       |
| duration             | 否  | number     | 2-45 的整数秒;-1 或不传由模型决定(按 45 秒冻结、按实际结算)。编辑必须是 -1                                    |
| audio                | 否  | boolean    | 输出是否含音轨。关掉不降价                                                                     |
| return_last_frame    | 否  | boolean    | true 时额外返回成片最后一帧的图片,在任务结果的 resultJson.lastFrameUrl 里                              |
| output_format        | 否  | string     | "mp4"(默认)或 "mov"                                                                  |
| watermark            | 否  | boolean    | 是否加水印                                                                             |
| callback_url         | 否  | string     | 任务完成后的回调 URL                                                                      |

这个模型不支持 seed 和 prompt_extend,传了会直接返回 400,而不是悄悄忽略。

## 取回结果

创建接口立即返回 data.taskId,视频在后台生成。带上 task_id 向同一个端点发 GET,读 data.state:pending 表示还在跑,completed 时 data.resultUrls\[0\] 是视频地址,failed 时 data.failMsg 是原因。不想轮询就传 callback_url。

- 本站实测(2026-12-05,720P):5 秒文生视频 82 秒出片;对一段 4.7 秒原片做人物替换 185 秒、场景编辑 137 秒、延长 5 秒 540 秒(9 分钟)。延长明显更慢,轮询超时至少留 15 分钟,或者用 callback_url。建议 10-15 秒轮询一次。
- 延长(extend)返回的只是新生成的那一段,不包含原片。它的第一帧接着原片的最后一帧,需要你自己把它拼在原片后面(例如 ffmpeg concat)。编辑(edit)返回的是与原片等长的完整新视频,原片的说话声会保留。
- 结果视频保存 30 天后自动删除,请及时下载或转存。

## 相关

- [HappyWan 模型页 / 在线试用 / 实测样片](https://apimodels.app/zh/models/happywan)
- [万相 3.0 视频 API](https://apimodels.app/zh/docs/wan-3-0-video)
- [视频 API 总览](https://apimodels.app/zh/docs)

## 常见问题

**HappyWan API 多少钱?**

按输出秒数计费:480P $0.074/秒、720P $0.148/秒、1080P $0.295/秒,5 秒 720P 是 $0.74。参考视频的秒数按同一单价计费,参考图和参考音频不收费。失败或被拒的任务不扣费。

**HappyWan 能用到什么时候?**

HappyWan 是限时预览,开放到 2026-12-07 23:59(北京时间,即 15:59 UTC)。之后新请求直接返回 400,不冻结、不扣费。

**HappyWan 能编辑或延长已有视频吗?**

能。把视频放进 reference_video_urls,reference_task_type 设成 edit 或 extend。两者都保持原片画幅,ratio 只能是 adaptive;编辑跟随原片时长,duration 必须是 -1。参考视频的秒数和输出一起计费。延长只返回新增的那一段、不含原片,需要自己拼在原片后面;编辑返回与原片等长的完整视频,并保留原片的说话声。我们用 4.7 秒原片在 720P 实测:人物替换 185 秒、场景编辑 137 秒、延长 5 秒 540 秒。

**HappyWan 一次能生成多长?**

2 到 45 秒的整数秒,或传 -1 让模型自己决定。传 -1 时先按 45 秒冻结,拿到真实时长后退回差额。我们实测 5 秒 720P 82 秒出片。
