> ## Documentation Index
> Fetch the complete documentation index at: https://docs.token.poryf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 万相 2.7

> 万相 2.7 视频生成：文生视频与首尾帧图生视频的参数、示例与计费。

阿里通义万相 2.7 视频模型：`wan2.7-t2v` 文生视频，`wan2.7-i2v` 首帧 / 首尾帧图生视频（必须传首帧）。

* 模型 ID：`wan2.7-t2v`、`wan2.7-i2v`（参数与用法相同）
* 接口：`POST https://token.poryf.com/v1/videos`（异步任务）
* [查看价格](https://token.poryf.com/pricing/wan2.7-t2v) · [在线试用](https://token.poryf.com/model-guide/wan2.7-t2v)（登录后，按自己的余额扣费）

## 请求参数

**Authorization** `string` *required*

`Bearer YOUR_API_KEY`，在 [控制台的 API 密钥页](https://token.poryf.com/keys) 创建。

**model** `string` *required*

`wan2.7-t2v`、`wan2.7-i2v`

**prompt** `string`

画面与运动描述。文生视频必填；图生视频建议填写。

**seconds** `integer` (default: 5)

时长：2–15 秒的整数，默认 5。

**resolution** `string` (default: 1080P)

`720P`、`1080P`。不传默认 `1080P`，在线试用默认 `720P`。

**ratio** `string` (default: 16:9)

画面比例：`16:9`、`9:16`、`1:1`、`4:3`、`3:4`。只对 `wan2.7-t2v` 生效；`wan2.7-i2v` 的比例跟随首帧图片。

**images** `string[]` *required*

首帧 / 首尾帧图片的公网 URL：第一张为首帧，第二张为尾帧。仅 `wan2.7-i2v` 使用，且至少传首帧。

**negative\_prompt** `string`

不希望出现的内容。

**seed** `integer`

随机种子。

**prompt\_extend** `boolean` (default: true)

是否由模型自动改写、扩充提示词。

> [!WARNING]
>
> * 图片、视频、音频请使用公网可访问的 `http(s)` URL，不要上传文件或使用 Base64。
> * 视频生成通常需要 1–3 分钟，请轮询查询任务状态。

## 示例：文生视频

```bash theme={null}
curl https://token.poryf.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-t2v",
    "prompt": "清晨的海边，一只柯基在沙滩上奔跑，镜头缓慢跟随",
    "seconds": 5,
    "resolution": "720P",
    "ratio": "16:9"
  }'
```

## 示例：首尾帧图生视频

```bash theme={null}
curl https://token.poryf.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-i2v",
    "prompt": "花朵从含苞到完全绽放",
    "seconds": 5,
    "resolution": "720P",
    "images": [
      "https://example.com/first.jpg",
      "https://example.com/last.jpg"
    ]
  }'
```

只传一张图即为首帧图生视频。

## 响应

提交成功后返回任务对象（示例结构）：

```json theme={null}
{
  "id": "task_xxxxxxxx",
  "object": "video",
  "status": "queued",
  "progress": 0
}
```

查询进度、下载视频的方法见 [视频通用说明](https://docs.token.poryf.com/api/videos/overview.md#查询进度)。

## 计费

按秒计费，单价按输出分辨率（720P / 1080P）分档。实时单价见 [模型广场](https://token.poryf.com/pricing)。

提交时按请求的时长和分辨率预扣，任务完成后按实际时长多退少补；任务失败自动全额退回。

## 常见错误

| 出现时机 | 错误 | 原因 |
| - | - | - |
| 提交时返回错误 | `wan2.7-t2v duration must be an integer between 2 and 15` | `seconds` 超出范围 |
| 提交时返回错误 | `wan2.7-t2v resolution must be one of 720P, 1080P` | 分辨率写成了其他档位 |
| 提交时返回错误 | `wan2.7-i2v requires first_frame or first_clip with a supported media combination` | `wan2.7-i2v` 没有传首帧图片 |

其他错误见 [视频通用说明](https://docs.token.poryf.com/api/videos/overview.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.