> ## 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 Animate LoRA API：将动作迁移到目标角色

> 使用 Wan Animate LoRA API 从源图像和运动视频驱动角色动画，支持风格化运动传输和异步任务轮询。

## 概览

Wan Animate LoRA 是一个异步角色动画模型，使用一张源图像作为角色参考、一个运动视频作为运动参考，生成并返回 MP4 视频。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-animate-LoRA` |
| 模式 | `animate`（必填） |
| 源图片 | `image_urls` 中必须恰好包含 1 个 URL |
| 动态视频 | `video_urls` 中必须恰好包含 1 个公开的 HTTPS 视频 URL |
| 分辨率 | `480p`, `720p` |
| 计费时长 | 从 `video_urls[0]` 检测，计费精确到小数点后 3 位，最低计费时长为 5 秒 |
| 种子 | 从 `0` 到 `2147483647` 的可选整数 |

## 接口与身份验证

API 基础地址：

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

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-animate-LoRA` | 提交动画任务 |
| `GET` | `/statusTask/wan-animate-LoRA?taskId={taskId}` | 查询任务状态并获取结果 |

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

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

提交任务时，还需要设置以下请求头：

```http theme={null}
Content-Type: application/json
```

## 异步请求示例

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-animate-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "animate",
      "image_urls": [
        "https://example.com/character.png"
      ],
      "video_urls": [
        "https://example.com/motion.mp4"
      ],
      "prompt": "animate the character following the reference motion",
      "resolution": "720p",
      "seed": 12345
    }
  }'
```

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

## 请求体

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "animate",
    "image_urls": [
      "https://example.com/character.png"
    ],
    "video_urls": [
      "https://example.com/motion.mp4"
    ],
    "prompt": "keep the face stable and follow the reference motion naturally",
    "resolution": "480p",
    "seed": 42
  }
}
```

## 参数

**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 Animate LoRA 的输入参数。

**属性**

**mode** `string` *required*

生成模式。可选值为 `animate`。

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

源图像 URL。准确提供 1 公开 HTTP/HTTPS 图像 URL。源图像不应大于 50 MB。

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

动作参考视频 URL。准确提供 1 公开 HTTPS 视频 URL。视频大小不得大于 200 MB。APIXO 在提交任务之前探测 `video_urls[0]` 以检测计费持续时间。

**prompt** `string`

可选提示指导。如果提供，它必须是非空字符串。

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

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

**seed** `integer`

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

## 轮询结果

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

任务处理中的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing"
  }
}
```

成功响应：

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

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

## Webhook 回调模式

如果希望服务端自动收到最终结果，可以使用回调模式，无需轮询。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-animate-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "animate",
      "image_urls": [
        "https://example.com/character.png"
      ],
      "video_urls": [
        "https://example.com/motion.mp4"
      ],
      "prompt": "animate the character following the reference motion",
      "resolution": "720p"
    }
  }'
```

Webhook 接收要求和重试规则见 [Webhook 文档](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

## 计费

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

Wan Animate LoRA 按生成的视频秒数计费。所选的 `resolution` 确定单价，并从 `video_urls[0]` 检测计费持续时间。

| 分辨率 | 计费输入 | APIXO 价格 |
| - | - | - |
| `480p` | 检测到的参考视频时长，最短 5 秒，计费至小数点后 3 位 | `$0.064 / second` |
| `720p` | 检测到的参考视频时长，最短 5 秒，计费至小数点后 3 位 | `$0.132 / second` |

如果参考视频短于 5 秒，则计费使用 5 秒。较长的视频按检测到的时长计费。

最新的美元费率见 [API 价目表](https://apixo.ai/pricing/api)。

## 延迟与轮询

实际延迟可能因参考视频时长、分辨率、队列负载及当前路由健康状况而异。

| 请求结构 | 通常生成耗时 | 建议首次查询时间 | 轮询间隔 |
| - | - | - | - |
| 短片 `480p` 动画 | 随参考视频时长和队列负载变化 | 任务创建 60 秒后 | 5s-10s |
| 短片 `720p` 动画 | 随参考视频时长和队列负载变化 | 任务创建 60 秒后 | 5s-10s |
| 较长的参考视频 | 随参考视频时长和队列负载变化 | 任务创建 60 至 120 秒后 | 10s |

> [!TIP]
>
> 视频生成可能需要几分钟。对于生产环境，请使用回调模式以避免频繁轮询。

## 错误与排查

| 原因 | 需要检查什么 |
| - | - |
| 无效模式 | 使用 `mode: "animate"` |
| 介质形状无效 | 准确提供 1 `image_urls` 项和 1 `video_urls` 项 |
| 无法探测视频 URL | 使用支持范围读取或完整下载的直接公开 HTTPS 视频 URL |
| 分辨率无效 | 使用`480p`或`720p` |
| 无效种子 | 使用 `0` 到 `2147483647` 之间的整数 |
| 速率限制或任务超时 | 使用退避重试或切换到回调模式 |

完整列表见[错误码](https://apixo.ai/docs/zh/api-reference/errors.md)。

## MCP 集成

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

## 相关链接

* [生成 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)
* [参数规范](https://apixo.ai/docs/zh/api-reference/parameters.md)
* [API定价](https://apixo.ai/pricing/api)


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