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

# MiniMax-H3

> MiniMax H3 多模态视频生成与任务查询 API。

MiniMax-H3 提供异步多模态视频生成能力。使用 `POST /v2/video_generation` 创建任务，再使用 `GET /v2/query/video_generation/{task_id}` 查询任务状态和结果。

<Tabs sync={false}>
  <Tab title="创建视频生成任务">
    ## 创建任务

    `POST /v2/video_generation`

    <div className="kling-api-example-panel happyhorse-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.ai/v2/video_generation \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "MiniMax-H3",
          "content": [
            {
              "type": "text",
              "text": "史诗级太空歌剧院线预告：女舰长独自站在巨大观景窗前，最后一支舰队正在集结并跃迁离去。"
            }
          ],
          "resolution": "2K",
          "duration": 5,
          "ratio": "16:9"
        }'
      ```

      ```json 200 theme={null}
      {
        "task_id": "424010985738629"
      }
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>请求体格式。</ParamField>

    ## 请求参数

    <ParamField body="model" type="string" required>使用 `MiniMax-H3`。</ParamField>
    <ParamField body="content" type="object[]" required>多模态内容数组，每项使用 `text`、`image_url`、`video_url` 或 `audio_url`。</ParamField>
    <ParamField body="content[].type" type="string" required>内容类型：`text`、`image_url`、`video_url` 或 `audio_url`。</ParamField>
    <ParamField body="content[].text" type="string">文本提示词。视频生成必须包含文本内容。</ParamField>
    <ParamField body="content[].role" type="string">媒体用途，例如 `first_frame`、`last_frame`、`reference_image`、`reference_video` 或 `reference_audio`。</ParamField>
    <ParamField body="content[].image_url.url" type="string">公开图片 URL，不支持 Base64。</ParamField>
    <ParamField body="content[].video_url.url" type="string">用于多模态参考输入的公开视频 URL。</ParamField>
    <ParamField body="content[].audio_url.url" type="string">用于多模态参考输入的公开音频 URL。</ParamField>
    <ParamField body="resolution" type="string" required>当前支持 `2K`。</ParamField>
    <ParamField body="duration" type="integer" required>视频时长，4 到 15 秒之间的整数。</ParamField>
    <ParamField body="ratio" type="string">支持 `adaptive`、`21:9`、`16:9`、`4:3`、`1:1`、`3:4` 和 `9:16`。文生视频必须显式指定比例。</ParamField>
    <ParamField body="callback_url" type="string">可选的任务状态回调地址。</ParamField>
    <ParamField body="aigc_watermark" type="boolean" default="false">是否添加 AIGC 水印。</ParamField>

    ### 内容规则

    * 文生视频使用一个文本内容。
    * 图生视频支持首帧、尾帧或首尾帧图片；同时提供首尾帧时使用 `first_frame` 和 `last_frame` 标记。
    * 参考生视频可以组合参考图片、视频和音频，但至少需要一张参考图片或一个参考视频，不能只提供音频。
    * 首尾帧标记不能与参考媒体标记混用。
    * 请求体总大小不超过 64 MB。图片支持 JPG、JPEG、PNG、WEBP、HEIC 和 HEIF，单张图片不超过 30 MB。
    * 参考视频支持 MP4/MOV、H.264/H.265 和 AAC/MP3，单个视频不超过 50 MB、时长为 2 到 15 秒。参考音频支持 WAV/MP3，单个音频不超过 15 MB、时长为 2 到 15 秒。

    ## 响应

    <ResponseField name="task_id" type="string">视频生成任务 ID，用于查询任务状态。</ResponseField>
  </Tab>

  <Tab title="查询视频生成任务">
    ## 查询任务

    `GET /v2/query/video_generation/{task_id}`

    <div className="kling-api-example-panel happyhorse-api-example-panel">
      ```bash cURL theme={null}
      curl --request GET \
        --url https://www.anyfast.ai/v2/query/video_generation/TASK_ID \
        --header 'Authorization: Bearer YOUR_API_KEY'
      ```

      ```json 200 theme={null}
      {
        "task": {
          "id": "424010985738629",
          "model": "MiniMax-H3",
          "status": "succeeded",
          "created_at": 1785125529,
          "updated_at": 1785125946,
          "content": {
            "url": "https://cdn.hailuoai.com/example/video.mp4"
          },
          "resolution": "2K",
          "duration": 5,
          "usage": {
            "total_seconds": 5,
            "input_seconds": 0,
            "output_seconds": 5,
            "image_count": 0
          },
          "ratio": "16:9",
          "task_type": "generation"
        }
      }
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>

    ## 路径参数

    <ParamField path="task_id" type="string" required>创建任务接口返回的视频生成任务 ID。</ParamField>

    ## 响应字段

    <ResponseField name="task" type="object">查询到的视频生成任务。</ResponseField>
    <ResponseField name="task.id" type="string">任务 ID。</ResponseField>
    <ResponseField name="task.model" type="string">任务使用的模型。</ResponseField>
    <ResponseField name="task.status" type="string">任务状态：`queued`、`running`、`succeeded`、`failed` 或 `expired`。</ResponseField>
    <ResponseField name="task.created_at" type="integer">任务创建时间，Unix 时间戳。</ResponseField>
    <ResponseField name="task.updated_at" type="integer">任务更新时间，Unix 时间戳。</ResponseField>
    <ResponseField name="task.content.url" type="string">任务成功时生成的视频 URL。</ResponseField>
    <ResponseField name="task.resolution" type="string">输出分辨率。</ResponseField>
    <ResponseField name="task.duration" type="integer">输出视频时长，单位为秒。</ResponseField>
    <ResponseField name="task.usage" type="object">任务用量信息。</ResponseField>
    <ResponseField name="task.usage.total_seconds" type="number">总计费或处理时长。</ResponseField>
    <ResponseField name="task.usage.input_seconds" type="number">输入媒体时长，单位为秒。</ResponseField>
    <ResponseField name="task.usage.output_seconds" type="number">输出视频时长，单位为秒。</ResponseField>
    <ResponseField name="task.usage.image_count" type="integer">输入图片数量。</ResponseField>
    <ResponseField name="task.ratio" type="string">输出宽高比。</ResponseField>
    <ResponseField name="task.task_type" type="string">任务类型，例如 `generation`。</ResponseField>
  </Tab>
</Tabs>

<script src="/public/feedback.js" />
