> ## 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.7 Video LoRA API：生成视频时可选配声音

> 图生视频 API，支持可选生成声音或提供音频、基于 LoRA 的样式控制，以及短剪辑的第一帧控制。

## 概览

Wan 2.7 Video LoRA 是一种异步图生视频模型，可对单张起始图像进行动画生成，并支持生成声音或使用提供的音频轨道。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-2-7-video-LoRA` |
| 模式 | `image-to-video`（必填） |
| 图片 | 必须提供且仅提供 1 张第一帧图像 |
| 音频 | 最多可提供 1 个可选音频 URL |
| 时长 | 从 `2` 到 `15` 秒的任何整数 |
| 分辨率 | `720p`或`1080p` |
| 输出 | MP4 视频 URL 数组位于 `resultJson.resultUrls` 字段中 |

## 接口与身份验证

API 基础地址：

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

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-2-7-video-LoRA` | 提交图像转视频任务 |
| `GET` | `/statusTask/wan-2-7-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-7-video-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-video",
      "prompt": "a dancer performs under dramatic stage lighting",
      "image_urls": ["https://example.com/first-frame.png"],
      "sound": true,
      "duration": 8,
      "resolution": "720p",
      "prompt_extend": true
    }
  }'
```

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

## 在请求中提供音频

当存在 `audio_urls` 时，`sound` 必须为 `true` 或省略

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "subtle natural movement synchronized with the music",
    "negative_prompt": "blurry, unstable motion",
    "image_urls": ["https://example.com/first-frame.png"],
    "audio_urls": ["https://example.com/music.mp3"],
    "sound": true,
    "duration": 10,
    "resolution": "1080p",
    "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.7 Video LoRA 的输入参数。

**属性**

**mode** `string` *required*

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

**prompt** `string` *required*

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

**negative\_prompt** `string`

可选的内容避免描述。空文本将被忽略

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

恰好一个公共第一帧图像 URL。支持的格式为不透明的 JPEG、JPG、PNG、BMP 和 WEBP。文件大小不得大于 20 MB，每边必须为 240-8000 像素，宽度除以高度必须为 0.125-8

**audio\_urls** `string[]`

最多 1 个公共音频 URL。提供时，`sound` 必须为 `true` 或省略

**sound** `boolean` (default: true)

输出是否应包含声音。`sound: false` 不能与 `audio_urls` 一起使用

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

输出持续时间（以秒为单位）。支持从 `2` 到 `15` 的任何整数

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

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

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

是否重写并丰富生成前的提示。

**seed** `integer`

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

## 轮询结果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/wan-2-7-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)。

计费基于输出持续时间：`720p` 成本 `$0.143/second`； `1080p` 成本 `$0.22/second`。

## 提示

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

## MCP 集成

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/wan-2-7-video-lora.json) 中的 `mcp.result` 指定了结果的解析方式，`mcp.attachments` 列出支持绑定文件的字段。这些元数据供客户端集成使用，无需作为生成参数提交。附件字段为 `image_urls`, `audio_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.