> ## 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.

# MiniMax H3 LoRA API：生成 480p 或 768p 视频

> MiniMax H3 LoRA 480p 和 768p 视频生成 API，支持文生视频、图生视频和参考生视频工作流

## 概览

MiniMax H3 LoRA 可生成 480p 或 768p 视频。支持文字提示词、首帧图或首尾帧图，也可使用图片或视频作为参考。在 APIXO Playground 试用后，可以按本页示例调用 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `minimax-h3-LoRA` |
| 模式 | `text-to-video`, `image-to-video`, `reference-to-video` |
| 提示词 | 必需的非空字符串，最多 4,000 个字符 |
| 输出分辨率 | `480p` 或 `768p`；默认为 `480p` |
| 输出持续时间 | 从 `5` 到 `15` 秒的任何整数；默认为 `5` |
| 纵横比 | `21:9`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16` 适用于所有模式 |
| 图生视频图像 | 1-2 图像 URL；第二张图像是可选的最后一帧 |
| 参考输入 | 最多 6 个 HTTPS 图像 URL 和 1 个 HTTPS 视频 URL 用于参考到视频 |
| 参考视频限制 | 0.5–60 秒，最多 100 MiB |
| 结果格式 | MP4 URL 数组位于 `resultJson.resultUrls` 中 |

> [!NOTE]
>
> `minimax-h3-LoRA` 是公共模型名称。它不接受自定义 LoRA 配置参数。

## 接口与身份验证

API 基础地址：

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

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

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

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

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

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

## 异步请求示例

以下示例提交一个最简单的文生视频任务，响应中会返回 `taskId`。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/minimax-h3-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic product reveal with smooth camera movement and premium studio lighting",
      "aspect_ratio": "16:9",
      "resolution": "768p",
      "duration": 8
    }
  }'
```

成功响应：

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

保存 `taskId`，后续轮询结果时需要用到它。

## 轮询结果

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

任务处理中的响应示例：

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

成功响应：

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

任务失败时的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "UPSTREAM_ERROR",
    "failMsg": "Generation failed",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
```

等 `state` 变为 `success` 后，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;
```

## 请求体

### 文生视频

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-video",
    "prompt": "a cinematic night street in Tokyo with rain reflections and slow camera movement",
    "aspect_ratio": "16:9",
    "resolution": "768p",
    "duration": 10,
    "seed": -1
  }
}
```

### 图生视频

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "animate this portrait with subtle head movement and cinematic lighting",
    "image_urls": [
      "https://example.com/first-frame.png",
      "https://example.com/last-frame.png"
    ],
    "resolution": "480p",
    "duration": 8
  }
}
```

### 参考生成视频

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "reference-to-video",
    "prompt": "create a polished product launch video using the visual references and camera motion",
    "image_urls": [
      "https://example.com/product.png",
      "https://example.com/brand-style.png"
    ],
    "video_urls": [
      "https://example.com/motion-reference.mp4"
    ],
    "aspect_ratio": "16:9",
    "resolution": "480p",
    "duration": 8
  }
}
```

## 参数

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

Result交付方式。支持的值：`async`、`callback`。使用 `async` 时通过 `statusTask` 轮询获取结果，使用 `callback` 时通过 Webhook 传递结果。

**callback\_url** `string`

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

**input** `object` *required*

MiniMax H3 LoRA 的输入参数。

**属性**

**mode** `string` *required*

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

**prompt** `string` *required*

描述所需视频的文本提示。后端会修剪空格、拒绝空提示，并限制最多 4,000 个字符。

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

输出分辨率。可选值为 `480p`、`768p`。默认值为 `480p`。

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

输出持续时间（以秒为单位）。支持从 `5` 到 `15` 的整数，包括数字字符串，例如 `"8"`。小数值被拒绝。

**aspect\_ratio** `string` (default: 16:9)

所有模式的输出宽高比。默认为 16:9。支持的值：21:9、16:9、4:3、1:1、3:4、9:16。

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

公开的 HTTPS 图像 URL。`image-to-video` 模式下需提供 1-2 张图像，其中 `image_urls[0]` 为第一帧，`image_urls[1]` 为可选的最后一帧；`reference-to-video` 模式下最多支持 6 张图像，可选；若使用参考视频，至少需提供一个 `image_urls` 或 `video_urls` 的参考链接。

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

一个公开的 HTTPS 参考视频 URL，用于视频参考。持续时间必须为 0.5–60 秒，文件大小不得超过 100 MiB。实际输入视频时长按所选输出分辨率的参考视频速率计费。

**seed** `integer|string`

可选的整数种子，用于生成可重复的输出。支持数字字符串；小数值将被拒绝。

| 模式 | 所需媒体 | 可选的媒体 | 计费说明 |
| - | - | - | - |
| `text-to-video` | 无 | 无 | 输出时长按所选分辨率每秒计费。 |
| `image-to-video` | `image_urls` 字段包含 1 到 2 张图像 | 无 | 输出时长按所选分辨率每秒计费。 |
| `reference-to-video` | 至少提供一张参考图或一个参考视频 | `image_urls` 与 `video_urls` | 输出时长、参考图片数量和参考视频时长分别计费。 |

> [!TIP]
>
> 对所有参考媒体使用公共、可直接访问的 HTTPS URL。在提交任务前会检查参考视频。

## 响应格式

### 提交任务时的响应

任务受理后，`POST /generateTask/minimax-h3-LoRA` 会返回任务 ID：

**code** `integer`

API 状态码。`200` 表示任务已受理。

**message** `string`

状态说明。

**data.taskId** `string`

任务的唯一 ID，用于查询任务状态。

### 状态响应字段

**taskId** `string`

任务的唯一标识符。

**state** `string`

当状态为 `processing` 时进行轮询。达到 `success` 或 `failed` 时停止。被取消的生成以 `failed` 结束。

**resultJson** `string`

当 `state` 为 `success` 时返回。解析此 JSON 字符串后，可从 `resultUrls` 读取生成的视频链接。

**failCode** `string`

供程序处理的错误码，仅在 `state` 为 `failed` 时返回。

**failMsg** `string`

失败原因说明，仅在 `state` 为 `failed` 时返回。

**createTime** `integer`

任务创建时的 Unix 时间戳，单位为毫秒。

**completeTime** `integer`

任务完成时的 Unix 时间戳，单位为毫秒。任务完成后返回。

**costTime** `integer`

处理耗时，以毫秒为单位。任务完成且有计时数据时返回。

## Webhook 回调模式

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

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/minimax-h3-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": "reference-to-video",
      "prompt": "create an 8-second cinematic product video using these visual references",
      "image_urls": [
        "https://example.com/ref-01.png",
        "https://example.com/ref-02.png"
      ],
      "aspect_ratio": "16:9",
      "resolution": "480p",
      "duration": 8
    }
  }'
```

回调数据与轮询响应具有相同的顶层字段：`code`、`message` 和 `data`。任务成功时，回调还会包含最终的 `state` 和 `resultJson`。接收要求与重试规则见 [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)。

MiniMax H3 LoRA 按所选模式和分辨率按输出秒计费。`reference-to-video` 有独立的输出速率，并对参考图像和参考视频秒数计费。

| 项目 | APIXO 价格 | 计费规则 |
| - | - | - |
| 文本/图生视频输出，`480p` | `$0.04 / second` | `duration * $0.04` |
| 文本/图生视频输出，`768p` | `$0.08 / second` | `duration * $0.08` |
| 参考视频输出，`480p` | `$0.05 / second` | `duration * $0.05` |
| 参考视频输出，`768p` | `$0.10 / second` | `duration * $0.10` |
| 参考图像输入 | `$0.02 / image` | `image_urls.length * $0.02` |
| 带 `480p` 输出的参考视频输入 | `$0.05 / second` | `video_urls` 所有视频的总实际秒数乘以 `$0.05` |
| 带 `768p` 输出的参考视频输入 | `$0.10 / second` | `video_urls` 所有视频的总实际秒数乘以 `$0.10` |

对于文本/图生视频，请使用 `output_rate = $0.04` 在 `480p` 或 `$0.08` 在 `768p`；对于参考生视频，生成视频和输入参考视频均使用 `reference_video_rate = $0.05` 在 `480p` 或 `$0.10` 在 `768p`，根据所选输出分辨率确定。

`text-to-video` 和 `image-to-video` 的计算公式为：

```text theme={null}
total cost = output duration * output_rate
```

`reference-to-video` 的计算公式为：

```text theme={null}
total cost = output duration * reference_video_rate
           + reference image count * $0.02
           + total reference video seconds * reference_video_rate
```

示例：

| 请求 | 收费示例 |
| - | - |
| 10秒`768p`文生视频输出 | `10 * $0.08 = $0.80` |
| 8 秒 `480p` 参考视频输出，包含 6 张参考图像和 30 秒参考视频 | `(8 * $0.05) + (6 * $0.02) + (30 * $0.05) = $2.02` |
| 5 秒 `768p` 参考视频输出，附带 5 秒参考视频 | `(5 * $0.10) + (5 * $0.10) = $1.00` |

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

## 延迟与轮询

MiniMax H3 LoRA 任务是长时运行的视频作业。实际延迟可能因提示复杂度、时长、分辨率、参考媒体可访问性、路由队列负载及生成时间而异。

| 工作量 | 通常生成耗时 | 建议首次查询时间 | 轮询间隔 |
| - | - | - | - |
| 文本转视频或图像转视频 | 因提示内容和持续时间而异 | 任务创建 60 秒后 | 10s-15s |
| 基于图像或视频输入的参考视频生成 | 通常比简单生成耗时更长 | 任务创建 60 至 90 秒后 | 10s-15s |

> [!TIP]
>
> 生产环境建议使用回调，避免在视频生成期间频繁轮询。

结果链接有时效。任务完成后，请尽快下载并保存重要文件。

请求频率和并发上限因账号、API 密钥和路由而异。收到 `429` 时，请降低请求频率，逐步延长重试间隔。账号级限制见[系统 API](https://apixo.ai/docs/zh/api-reference/system.md)。

## 错误与排查

### HTTP 错误

| 代码 | 含义 | 处理方式 |
| - | - | - |
| `400` | 请求体无效，缺少 `input` 字段，使用了不支持的 `mode`，缺少 `prompt`，`resolution`、`duration`、`aspect_ratio` 参数无效，或媒体数组无效 | 在重试前修复请求 |
| `401` | 缺少 API 密钥，或密钥无效 | 检查 `Authorization` 请求头 |
| `402` | 余额或配额不足 | 充值或更换账号或API密钥 |
| `403` | 密钥或路由无权访问该模型 | 检查权限和路由策略 |
| `404` | 轮询时未找到任务 | 检查`taskId` |
| `429` | 已达到速率或并发限制 | 按指数退避策略重试 |
| `500` | 服务器错误或未知任务失败 | 逐步延长间隔后重试 |
| `502` | 服务错误 | 逐步延长间隔后重试 |
| `504` | 服务超时 | 重试；耗时较长的任务可改用回调模式 |

### 验证说明

| 条件 | 后端行为 |
| - | - |
| 缺少 `input` | 请求会被拒绝，系统不会创建任务。 |
| 缺失、非字符串或空 `prompt` | 请求会被拒绝，系统不会创建任务。 |
| 提示超过 4,000 个字符 | 请求会被拒绝，系统不会创建任务。 |
| 缺少 `mode` | 请求会被拒绝，系统不会创建任务。 |
| 不支持的 `mode` 值 | 请求会被拒绝，任务不会创建。可选值为 `text-to-video`、`image-to-video`、`reference-to-video`。 |
| 缺少 `resolution` | 默认值为 `480p`。 |
| 不支持的 `resolution` 值 | 请求会被拒绝，任务不会创建。可选值为 `480p`、`768p`。 |
| 缺少 `duration` | 默认值为 `5`。 |
| `duration` 不在 `5` 到 `15` 范围内或为小数 | 请求会被拒绝，系统不会创建任务。 |
| 缺少 `aspect_ratio` | 默认值为 `16:9`。 |
| 不支持的 `aspect_ratio` 值 | 请求会被拒绝，系统不会创建任务。 |
| 没有 `image_urls` 的图生视频 | 请求会被拒绝，系统不会创建任务。 |
| 图生视频时提供了超过 2 张图片 | 请求会被拒绝，系统不会创建任务。 |
| 参考既没有 `image_urls` 也没有 `video_urls` 的视频 | 请求会被拒绝，系统不会创建任务。 |
| 参考生成视频时，图片超过 6 张或视频超过 1 个 | 请求会被拒绝，系统不会创建任务。 |
| 参考视频时长超出 0.5–60 秒或不可用 | 请求在上游提交之前失败 |
| `seed` 是十进制值 | 请求会被拒绝，系统不会创建任务。 |
| 自定义 LoRA 配置字段 | 当前模型的接口不支持此选项。 |

### 任务失败错误码

`failCode` 表示任务失败的原因，常见值如下。

| 错误码 | 含义 | 处理方式 |
| - | - | - |
| `SensitiveContent` | 提示或输入/输出内容被安全检查拒绝 | 更改提示或参考媒体 |
| `PromptInvalid` | 提示词无效或被拒绝 | 修改提示词后重试 |
| `ImageFormatIncorrect` | 无法处理参考图像格式 | 提供公开可访问的图片直链，并使用常见图片格式 |
| `RateLimited` | 请求频率达到上限 | 按指数退避策略重试 |
| `Timeout` | 任务超时 | 稍后重试或使用回调模式 |
| `Unknown error` | 任务因未知原因失败 | 逐步延长间隔后重试，或联系支持团队并提供 `taskId` |

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

## MCP 集成

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

## 相关链接

* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [视频模型](https://apixo.ai/docs/zh/models/video)
* [提交生成任务](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)
* [路由策略](https://apixo.ai/docs/zh/concepts/routing-strategies.md)
* [在 APIXO Playground 尝试 MiniMax H3 LoRA](https://apixo.ai/models/minimax-h3-lora)
* [API定价](https://apixo.ai/pricing/api)


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