> ## 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 API：生成 768p 或 2K 视频

> MiniMax H3 768p 和 2k 视频生成 API 支持文生视频、图生视频和参考生视频工作流。

## 概览

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

| 功能 | 值 |
| - | - |
| 模型 ID | `minimax-h3` |
| 模式 | `text-to-video`, `image-to-video`, `reference-to-video` |
| 提示词 | 必需的非空字符串，最多 4,000 个字符 |
| 输出分辨率 | `768p` 或 `2k`；默认为 `2k` |
| 输出持续时间 | 从 `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` 中 |

## 接口与身份验证

API 基础地址：

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

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/minimax-h3` | 提交生成任务 |
| `GET` | `/statusTask/minimax-h3?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" \
  -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?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": "2k",
    "duration": 10
  }
}
```

### 图生视频

```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": "2k",
    "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/ref-01.png",
      "https://example.com/ref-02.png",
      "https://example.com/ref-03.png",
      "https://example.com/ref-04.png",
      "https://example.com/ref-05.png",
      "https://example.com/ref-06.png"
    ],
    "video_urls": [
      "https://example.com/motion-reference.mp4"
    ],
    "aspect_ratio": "16:9",
    "resolution": "2k",
    "duration": 8
  }
}
```

## 参数

**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*

MiniMax H3 的输入参数。

**属性**

**mode** `string` *required*

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

**prompt** `string` *required*

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

**resolution** `string` (default: 2k)

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

**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 图像。

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

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

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

> [!TIP]
>
> 所有参考媒体需使用公共、可直接访问的 HTTPS URL。在任务提交前将校验参考视频的时长。

## 响应格式

### 提交任务时的响应

任务受理后，`POST /generateTask/minimax-h3` 会返回任务 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" \
  -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": "2k",
      "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 按所选分辨率按输出秒计费。在`reference-to-video`中，还对参考视频的实际时长进行计费。最多包含六张参考图像，无需额外付费。

| 项目 | APIXO 价格 | 计费规则 |
| - | - | - |
| 输出视频，`768p` | `$0.10 / second` | `duration * $0.10` |
| 输出视频，`2k` | `$0.14 / second` | `duration * $0.14` |
| 参考视频输入，`768p` | `$0.10 / second` | 当`resolution`为`768p`时，`video_urls`中所有视频的总实际秒数 |
| 参考视频输入，`2k` | `$0.14 / second` | 当`resolution`为`2k`时，`video_urls`中所有视频的总实际秒数 |

当`resolution`为`768p`时，使用`resolution_rate = $0.10`；当`resolution`为`2k`时，使用`resolution_rate = $0.14`。

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

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

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

```text theme={null}
total cost = (output duration + total reference video seconds) * resolution_rate
```

示例：

| 请求 | 收费示例 |
| - | - |
| 8秒`768p`输出，6个参考图像 | `8 * $0.10 = $0.80` |
| 8秒 `2k` 输出，一个 30 秒参考视频，1 参考图像 | `(8 + 30) * $0.14 = $5.32` |

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

## 延迟与轮询

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

| 工作量 | 通常生成耗时 | 建议首次查询时间 | 轮询间隔 |
| - | - | - | - |
| 文本转视频或图像转视频 | 因提示内容和持续时间而异 | 任务创建 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` | 默认值为 `2k`。 |
| 不支持的 `resolution` 值 | 请求会被拒绝，任务不会创建。可选值为 `768p`、`2k`。 |
| 缺少 `duration` | 默认值为 `5`。 |
| `duration` 不在 `5` 到 `15` 范围内或为小数 | 请求会被拒绝，系统不会创建任务。 |
| 缺少 `aspect_ratio` | 默认值为 `16:9`。 |
| 不支持的 `aspect_ratio` 值 | 请求会被拒绝，系统不会创建任务。 |
| 没有 `image_urls` 的图生视频 | 请求会被拒绝，系统不会创建任务。 |
| 图生视频时提供了超过 2 张图片 | 请求会被拒绝，系统不会创建任务。 |
| 参考既没有 `image_urls` 也没有 `video_urls` 的视频 | 请求会被拒绝，系统不会创建任务。 |
| 参考生成视频时，图片超过 6 张或视频超过 1 个 | 请求会被拒绝，系统不会创建任务。 |
| 参考视频时长超出 0.5–60 秒或不可用 | 请求在上游提交之前失败 |

### 任务失败错误码

`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.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](https://apixo.ai/models/minimax-h3)
* [API定价](https://apixo.ai/pricing/api)


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