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

# Wan 2.2 Video LoRA API：控制视频首帧和尾帧

> 图生视频 API，具有可选的第一帧和最后一帧控制、基于 LoRA 的样式以及短剪辑的灵活持续时间

## 概览

Wan 2.2 Video LoRA 是异步图生视频模型。它可以为起始图像生成动画，或在第一帧和最后一帧之间创建过渡。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-2-2-video-LoRA` |
| 模式 | `image-to-video`（必填） |
| 图片 | 1 第一帧图像，加上 1 可选的最后一帧图像 |
| 时长 | `5` 或 `8` 秒 |
| 分辨率 | `480p`或`720p` |
| 输出 | MP4 视频 URL 数组位于 `resultJson.resultUrls` 字段中 |

## 接口与身份验证

API 基础地址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-2-2-video-LoRA` | 提交图像转视频任务 |
| `GET` | `/statusTask/wan-2-2-video-LoRA?taskId={taskId}` | 查询任务状态并获取结果 |

每个请求都必须携带 APIXO API 密钥：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## 异步请求示例

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-2-2-video-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-video",
      "prompt": "a cinematic camera move through a rainy neon street",
      "image_urls": ["https://example.com/first-frame.png"],
      "duration": 5,
      "resolution": "480p",
      "prompt_extend": true
    }
  }'
```

响应包含 `taskId`。保存它并轮询状态端点，直到 `state` 变为 `success` 或 `failed`。

## 第一帧和最后一帧请求

按顺序传递两个图像 URL：第一帧，然后是最后一帧。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "move smoothly from sunrise to a starry night",
    "image_urls": [
      "https://example.com/first-frame.png",
      "https://example.com/last-frame.png"
    ],
    "duration": 8,
    "resolution": "720p",
    "prompt_extend": true,
    "seed": 12345
  }
}
```

## 参数

**request\_type** `string` (default: async)

结果获取方式。选择 `async` 时，通过 `statusTask` 轮询结果；选择 `callback` 时，通过 Webhook 接收结果。

**callback\_url** `string`

当 `request_type` 为 `callback` 时必填。请提供公网可访问的 HTTPS 地址，用于接收任务的最终结果。详见 [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

**input** `object` *required*

Wan 2.2 Video LoRA 的输入参数。

**属性**

**mode** `string` *required*

生成模式。可选值为 `image-to-video`。

**prompt** `string` *required*

描述所需视频的非空文本。

**image\_urls** `string[]` *required*

一两个可公开访问的图像 URL。第一个URL为第一帧；可选的第二个 URL 是最后一帧。

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

输出时长，单位为秒。可选值为 `5`、`8`。

**resolution** `string` (default: 480p)

输出分辨率。可选值为 `480p`、`720p`。

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

是否重写并丰富生成前的提示。此选项不会产生额外费用。

**seed** `integer`

从 `0` 到 `2147483647` 的可选随机种子。

## 轮询结果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/wan-2-2-video-LoRA?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

`state`变为`success`后，解析`resultJson`并读取其`resultUrls`数组。

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/video.mp4\"]}"
  }
}
```

## 计费

新提交的非 LLM 请求按 **1 积分 = `$0.001`** 计费。先按用量和附加项目计算总额，再应用账号折扣，最后将请求总额向上取整到整数积分。如果约定了固定单价，则按该单价的原始精度计算，不再使用标准价或另行打折；最终积分仍向上取整。详见[积分换算与取整](https://apixo.ai/docs/zh/pricing.md#credit-conversion-and-rounding)。

计费基于输出持续时间：`480p` 成本 `$0.044/second`；`720p` 成本 `$0.088/second`。`prompt_extend`不另加单独费用。

## 提示

* 所有媒体 URL 必须对 API 公开可访问。
* 任务创建后约 60 秒开始轮询，然后每 10 秒轮询一次。
* 建议使用回调机制处理长时间运行的生产工作流。

## MCP 集成

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/wan-2-2-video-lora.json) 中的 `mcp.result` 指定了结果的解析方式，`mcp.attachments` 列出支持绑定文件的字段。这些元数据供客户端集成使用，无需作为生成参数提交。附件字段为 `image_urls`。请保留用户指定的文件顺序。API 负责校验模型参数。

## 相关链接

* [视频模型](https://apixo.ai/docs/zh/models/video)
* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)
* [错误码](https://apixo.ai/docs/zh/api-reference/errors.md)
* [API定价](https://apixo.ai/pricing/api)


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