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

# 视频生成（H3 / H3-Max / v2）

> MiniMax-H3 与 H3-Max v2 视频任务的 OneHub 代理接口

## 接口范围

MiniMax 官方 H3/H3-Max v2 能力使用 `POST /v2/video_generation` 创建任务，并使用
`GET /v2/query/video_generation/{task_id}` 查询任务。它支持 URL、`mm_file` 和
data URI 形式的媒体输入。H3 为 `768P`/`2K`、4–15 秒；H3-Max 为 `480P`/`768P`、5–15 秒。

OneHub 将该能力代理为以下鉴权接口；两者都必须带 Bearer Token：

| 操作 | OneHub 路径                                           |
| -- | --------------------------------------------------- |
| 创建 | `POST /minimaxi/v2/video_generation`                |
| 查询 | `GET /minimaxi/v2/query/video_generation/{task_id}` |

```http theme={null}
Authorization: Bearer $TOKEN
```

`model` 可为 `MiniMax-H3` 或 `MiniMax-H3-Max`。H3-Max 只接受文本和首/尾帧图片，
不接受参考素材；`minimax-h3-768p-second`、
`minimax-h3-2k-second` 和 `minimax-h3-extra-input-image` 是 OneHub 内部计费组件
SKU；`minimax-h3-max-480p-second` 和 `minimax-h3-max-768p-second` 是 H3-Max 内部
计费组件 SKU。它们不能作为 `model` 值，也不是可配置的模型 allowlist 条目。

## 创建请求

```json theme={null}
{
  "model": "MiniMax-H3-Max",
  "content": [
    {"type": "text", "text": "A cat walking on the beach at sunset"}
  ],
  "duration": 5,
  "resolution": "768P",
  "ratio": "16:9"
}
```

* `duration` 必填；H3 为 4–15 秒，H3-Max 为 5–15 秒。
* `resolution` 可省略（默认 `768P`）；H3 只能为 `768P`/`2K`，H3-Max 只能为 `480P`/`768P`。
* `content` 必须恰好有一个非空 `text` 项，提示词最多 7000 个 Unicode 字符；
  `text` 项不能设置 `role`。
* 媒体项总数最多 12：`image_url` 最多一个 `first_frame`、一个 `last_frame`、9 个
  `reference_image`；`video_url` 最多 3 个 `reference_video`；`audio_url` 最多 3 个
  `reference_audio`。`image_url` 未提供 `role` 时会按 `first_frame` 处理。
* 首/尾帧模式不能与任何参考素材混用；只有 `reference_audio` 时，必须同时提供
  `reference_image` 或 `reference_video`。

### 比例与模式

* **文生视频**：没有媒体项时，`ratio` 必填，且必须是具体比例，不能为 `adaptive`。
* **首/尾帧**：包含 `first_frame` 或 `last_frame` 时，OneHub 使用 `adaptive`。
* **参考素材**：包含任一 `reference_*` 项时，`ratio` 可省略（会使用 `adaptive`），
  也可以传 `adaptive` 或具体比例。

H3-Max 只支持上述首/尾帧模式，不支持参考素材。

可用比例为 `adaptive`、`21:9`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16`；前述模式规则会
进一步限制其可用性。

### 媒体 locator 与大小限制

每个 `image_url.url`、`video_url.url` 和 `audio_url.url` 只能使用下列 locator：

* 公网 `https://` URL。OneHub 会对 URL 做 DNS fail-closed 和私网/回环地址拦截；
  不接受 HTTP、`file:`、`ftp:`、`blob:`、`javascript:` 或协议相对 URL。
* 严格的 `data:<mime>;base64,<payload>`。metadata 必须恰为 `<mime>;base64`，不能有
  空白字符，payload 必须是非空严格 Base64。
* authority-only 的 `mm_file://<positive-int64>`。只允许正十进制 int64 authority，
  不能包含用户信息、端口、路径、query 或 fragment。

对 data URI，OneHub 会验证解码后单文件大小与 MIME：

| 输入类型        | 允许的 MIME                                                                    | 解码后上限  |
| ----------- | --------------------------------------------------------------------------- | ------ |
| `image_url` | `image/jpeg`、`image/jpg`、`image/png`、`image/webp`、`image/heic`、`image/heif` | 30 MiB |
| `video_url` | `video/mp4`                                                                 | 50 MiB |
| `audio_url` | `audio/wav`、`audio/mp3`                                                     | 15 MiB |

公网 HTTPS URL 和 `mm_file` 引用不会由 OneHub 拉取或在本地检查媒体内容，媒体格式等
官方约束由上游校验。完整 JSON 请求体最大为 64 MiB；data URI 的 Base64 膨胀和其他
字段也计入该限制，因此实际可用的解码后大小会低于单文件上限。

### 创建示例

```bash theme={null}
curl -X POST "https://xuwuai.com/minimaxi/v2/video_generation" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3-Max",
    "content": [{"type": "text", "text": "A cat walking on the beach at sunset"}],
    "duration": 5,
    "resolution": "768P",
    "ratio": "16:9"
  }'
```

创建成功只返回 OneHub 的稳定公共标识：

```json theme={null}
{
  "task_id": "upstream-task-id",
  "platform_id": "video_01JSGXXXXXXXXXXXXXXXXXX"
}
```

## 查询任务

将创建响应的 `task_id`（或 `platform_id`）放入路径参数：

```bash theme={null}
curl "https://xuwuai.com/minimaxi/v2/query/video_generation/$TASK_ID" \
  -H "Authorization: Bearer $TOKEN"
```

查询响应保持上游 `task` 对象，并在顶层附加 `platform_id`；`base_resp` 也可能出现。
`task` 可包含 `id`、`status`、`model`、`task_type`、`resolution`、`duration`、
`created_at`、`updated_at`、`content.url`、`usage` 和 `error`。`status` 与时间字段以
上游实际返回为准。

```json theme={null}
{
  "task": {
    "id": "upstream-task-id",
    "status": "succeeded",
    "content": {"url": "https://..."},
    "usage": {
      "input_seconds": 0,
      "output_seconds": 5,
      "total_seconds": 5,
      "input_image_count": 0
    }
  },
  "platform_id": "video_01JSGXXXXXXXXXXXXXXXXXX",
  "base_resp": {"status_code": 0, "status_msg": "success"}
}
```

成功结果中的 `task.content.url` 是上游签名 URL。它会过期，具体有效期以该 URL 与上游
返回为准；请在收到后及时使用，不要把完整签名 URL 写入日志或长期存储。

本文档不对创建失败、任务失败或取消时的计费结果作额外承诺；计费与额度以 OneHub 账户
和实际任务结算记录为准。


## OpenAPI

````yaml POST /minimaxi/v2/video_generation
openapi: 3.0.3
info:
  title: Xuwu Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the Xuwu user
    docs.
servers:
  - url: https://xuwuai.com
security:
  - BearerAuth: []
paths:
  /minimaxi/v2/video_generation:
    post:
      tags:
        - MiniMaxi
      summary: Create a MiniMax-H3/H3-Max v2 video task
      description: >-
        OneHub proxy for MiniMax H3 v2. MiniMax-H3 and MiniMax-H3-Max are
        accepted. H3-Max accepts 480P/768P and 5-15 seconds with text plus
        first/last-frame images only; H3 keeps its existing limits. The body is
        limited to 64 MiB. Media locators may be public HTTPS URLs, strict data
        URIs, or authority-only mm_file references; see the MiniMax H3 v2 guide
        for MIME, decoded-size, content-role, count, and ratio constraints.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MiniMaxH3CreateRequest'
      responses:
        '200':
          description: Created task identifiers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MiniMaxH3CreateResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    MiniMaxH3CreateRequest:
      type: object
      required:
        - model
        - content
        - duration
      properties:
        model:
          type: string
          enum:
            - MiniMax-H3
            - MiniMax-H3-Max
        content:
          type: array
          minItems: 1
          maxItems: 13
          description: Exactly one text item and at most 12 media items.
          items:
            $ref: '#/components/schemas/MiniMaxH3ContentItem'
        duration:
          type: integer
          minimum: 4
          maximum: 15
          description: 'Output duration in seconds (H3: 4-15; H3-Max: 5-15).'
        resolution:
          type: string
          default: 768P
          description: H3 supports 768P/2K; H3-Max supports 480P/768P.
          enum:
            - 480P
            - 768P
            - 2K
        ratio:
          type: string
          enum:
            - adaptive
            - '21:9'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
          description: >-
            Required and concrete for text-only generation; adaptive is used for
            first/last-frame mode and is the default for reference mode.
        callback_url:
          type: string
    MiniMaxH3CreateResponse:
      type: object
      required:
        - task_id
        - platform_id
      properties:
        task_id:
          type: string
          description: Upstream task identifier.
        platform_id:
          type: string
          description: OneHub platform task identifier.
    MiniMaxH3ContentItem:
      oneOf:
        - $ref: '#/components/schemas/MiniMaxH3TextContent'
        - $ref: '#/components/schemas/MiniMaxH3ImageContent'
        - $ref: '#/components/schemas/MiniMaxH3VideoContent'
        - $ref: '#/components/schemas/MiniMaxH3AudioContent'
    MiniMaxH3TextContent:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
          minLength: 1
          maxLength: 7000
          description: Exactly one non-empty text item is required in content.
    MiniMaxH3ImageContent:
      type: object
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          enum:
            - image_url
        image_url:
          $ref: '#/components/schemas/MiniMaxH3MediaURL'
        role:
          type: string
          default: first_frame
          enum:
            - first_frame
            - last_frame
            - reference_image
    MiniMaxH3VideoContent:
      type: object
      required:
        - type
        - video_url
        - role
      properties:
        type:
          type: string
          enum:
            - video_url
        video_url:
          $ref: '#/components/schemas/MiniMaxH3MediaURL'
        role:
          type: string
          enum:
            - reference_video
    MiniMaxH3AudioContent:
      type: object
      required:
        - type
        - audio_url
        - role
      properties:
        type:
          type: string
          enum:
            - audio_url
        audio_url:
          $ref: '#/components/schemas/MiniMaxH3MediaURL'
        role:
          type: string
          enum:
            - reference_audio
    MiniMaxH3MediaURL:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          description: >-
            Public HTTPS URL, strict data:<mime>;base64,<payload>, or
            authority-only mm_file://<positive-int64> locator.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer <token>'

````