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

# 创建 H3 Context IR 任务

> 分析文本与素材，生成增强后的结构化视频提示词，不生成视频。返回的 `task_id` 用查询任务接口查询，成功后从 `content.prompt` 读取提示词。



## OpenAPI

````yaml /openapi/zh/minimax-h3.json post /v2/h3_context_ir
openapi: 3.1.0
info:
  description: MiniMax H3 视频生成：创建视频生成、视频再生成（768P → 2K）和 H3 Context IR 任务，并查询任务结果。
  title: MiniMax H3 视频生成 API
  version: v2
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: MiniMax H3
paths:
  /v2/h3_context_ir:
    post:
      tags:
        - MiniMax H3
      summary: 创建 H3 Context IR 任务
      description: >-
        分析文本与素材，生成增强后的结构化视频提示词，不生成视频。返回的 `task_id` 用查询任务接口查询，成功后从
        `content.prompt` 读取提示词。
      operationId: minimaxCreateContextIR
      requestBody:
        content:
          application/json:
            examples:
              Context IR · 文生视频:
                description: 增强一段纯文本提示词。
                summary: Context IR · 文生视频
                value:
                  model: MiniMax-H3
                  content:
                    - type: text
                      text: 雨夜霓虹街头，一只橘猫在积水中奔跑。
                  duration: 5
                  ratio: '16:9'
              Context IR · 图生视频:
                description: 结合首帧图片增强提示词。
                summary: Context IR · 图生视频
                value:
                  model: MiniMax-H3
                  content:
                    - type: text
                      text: 人物转身看向镜头。
                    - type: image_url
                      image_url:
                        url: https://your-cdn.example.com/first-frame.jpg
                      role: first_frame
                  duration: 5
                  ratio: adaptive
              Context IR · 多模态参考:
                description: 结合参考视频与参考音频增强提示词。
                summary: Context IR · 多模态参考
                value:
                  model: MiniMax-H3
                  content:
                    - type: text
                      text: 参考视频 1 的动作，音色参考音频 1。
                    - type: video_url
                      video_url:
                        url: https://your-cdn.example.com/reference.mp4
                      role: reference_video
                    - type: audio_url
                      audio_url:
                        url: https://your-cdn.example.com/voice.mp3
                      role: reference_audio
                  duration: 5
            schema:
              $ref: '#/components/schemas/MiniMaxV2ContextIRRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                example:
                  value:
                    task_id: task_7Rk2mQ9vXc4LpT8nWb3sYh6dZf1aGe5J
              schema:
                $ref: '#/components/schemas/MiniMaxV2CreateTaskResponse'
          description: 任务已创建。
          headers:
            X-Request-Id:
              description: 请求 Id，联系支持时请提供。
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: bad_request_error
                      message: >-
                        invalid params, content must include a non-empty text
                        item (prompt is required) (2013)
                      http_code: '400'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 参数错误，或任务 Id 无效。
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: authorized_error
                      message: >-
                        login fail: Please carry the API secret key in the
                        'Authorization' field of the request header (1004)
                      http_code: '401'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 缺少或无效的 API Key。
        '402':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: insufficient_balance_error
                      message: insufficient balance (1008)
                      http_code: '402'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 账户余额不足。
        '422':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: unprocessable_entity_error
                      message: video description contains sensitive content (1026)
                      http_code: '422'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 输入内容不合规。
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: rate_limit_error
                      message: rate limit, please retry later (1002)
                      http_code: '429'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 触发限流，稍后重试。
        '500':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: server_error
                      message: internal error (1000)
                      http_code: '500'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 服务端错误，稍后重试。
        '529':
          content:
            application/json:
              examples:
                example:
                  value:
                    type: error
                    error:
                      type: overloaded_error
                      message: the service is overloaded, please retry later (1000)
                      http_code: '529'
                    request_id: 20261205112532258615475826d9d6AbCdEfGh
              schema:
                $ref: '#/components/schemas/MiniMaxV2ErrorResponse'
          description: 服务繁忙，稍后重试。
components:
  schemas:
    MiniMaxV2ContextIRRequest:
      additionalProperties: false
      description: 创建 H3 Context IR 任务的请求体。该任务只分析素材并输出增强后的结构化提示词，不生成视频。
      properties:
        model:
          default: MiniMax-H3
          description: |-
            模型名称，固定为 `MiniMax-H3`。

            **可选值：**
            - `MiniMax-H3`：MiniMax H3 旗舰版。
          enum:
            - MiniMax-H3
          type: string
        content:
          description: 输入内容数组，必须且只能包含一个非空的 `text` 项；素材规则同创建视频生成任务。
          items:
            $ref: '#/components/schemas/MiniMaxV2ContentItem'
          minItems: 1
          type: array
        duration:
          description: 视频时长，`4` ~ `15` 秒的整数。
          format: int64
          maximum: 15
          minimum: 4
          type: integer
        ratio:
          default: adaptive
          description: >-
            画面比例。文生视频必填且不能为 `adaptive`；图生视频固定按输入图片比例（传入其他值会被忽略）；多模态参考默认
            `adaptive`。


            **可选值：**

            - `adaptive`：自适应：图生视频按输入图片比例，多模态参考由模型决定。文生视频不可用。

            - `21:9`：21:9 超宽屏。

            - `16:9`：16:9 横屏。

            - `4:3`：4:3 横屏。

            - `1:1`：1:1 方形。

            - `3:4`：3:4 竖屏。

            - `9:16`：9:16 竖屏。
          enum:
            - adaptive
            - '21:9'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
          type: string
      required:
        - model
        - content
        - duration
      type: object
    MiniMaxV2CreateTaskResponse:
      additionalProperties: false
      description: 创建成功的响应。
      properties:
        task_id:
          description: 任务 Id，用于查询任务。
          type: string
      required:
        - task_id
      type: object
    MiniMaxV2ErrorResponse:
      additionalProperties: false
      description: 错误响应。HTTP 状态码即错误码。
      properties:
        type:
          description: 固定为 `error`。
          type: string
        error:
          $ref: '#/components/schemas/MiniMaxV2ErrorDetail'
          description: 错误详情。
        request_id:
          description: 请求 Id，与响应头 `X-Request-Id` 相同，联系支持时请提供。
          type: string
      required:
        - type
        - error
        - request_id
      type: object
    MiniMaxV2ContentItem:
      additionalProperties: false
      description: 一个输入项：文本、图片、视频或音频。
      properties:
        type:
          description: |-
            内容项类型。

            **可选值：**
            - `text`：文本提示词，填 `text`。
            - `image_url`：图片，填 `image_url.url`。
            - `video_url`：视频，填 `video_url.url`。
            - `audio_url`：音频，填 `audio_url.url`。
          enum:
            - text
            - image_url
            - video_url
            - audio_url
          type: string
        text:
          description: >-
            提示词，`type` 为 `text` 时必填且不能为空。生成与 Context IR 最多 7000 个字符，视频再生成最多
            40000 个字符。
          type: string
        image_url:
          $ref: '#/components/schemas/MiniMaxV2MediaURL'
          description: >-
            图片，`type` 为 `image_url` 时必填。支持 JPG / JPEG / PNG / WEBP / HEIC /
            HEIF，单张 ≤ 30 MB，宽高 256 ~ 5760 像素，宽高比 0.4 ~ 2.5。
        video_url:
          $ref: '#/components/schemas/MiniMaxV2MediaURL'
          description: >-
            视频，`type` 为 `video_url` 时必填。MP4 / MOV（H.264 或 H.265），单个 ≤ 50 MB，每段 2
            ~ 15 秒且总时长 ≤ 15 秒，帧率 23.976 ~ 60 fps。
        audio_url:
          $ref: '#/components/schemas/MiniMaxV2MediaURL'
          description: >-
            音频，`type` 为 `audio_url` 时必填。WAV / MP3，单个 ≤ 15 MB，每段 2 ~ 15 秒且总时长 ≤
            15 秒。
        role:
          description: >-
            素材用途。只有一张图片且未填 `role` 时按 `first_frame` 处理；多张图片时每张都必须填写。`video_url`
            必须填 `reference_video`，`audio_url` 必须填 `reference_audio`，`text` 不填。


            **可选值：**

            - `first_frame`：首帧图片（图生视频），最多 1 张。

            - `last_frame`：尾帧图片，最多 1 张；可与首帧组成首尾帧生成。

            - `reference_image`：参考图片（多模态参考），最多 9 张。

            - `reference_video`：参考视频（多模态参考），最多 3 个。

            - `reference_audio`：参考音频（多模态参考），最多 3 个。
          enum:
            - first_frame
            - last_frame
            - reference_image
            - reference_video
            - reference_audio
          type: string
      required:
        - type
      type: object
    MiniMaxV2ErrorDetail:
      additionalProperties: false
      description: 错误详情。
      properties:
        type:
          description: |-
            错误类别。

            **可选值：**
            - `bad_request_error`：参数错误（400）。
            - `authorized_error`：鉴权失败（401 / 403）。
            - `insufficient_balance_error`：余额不足（402）。
            - `unprocessable_entity_error`：输入内容不合规（422）。
            - `rate_limit_error`：触发限流（429），稍后重试。
            - `server_error`：服务端错误（500），稍后重试。
            - `overloaded_error`：服务繁忙（529），稍后重试。
          enum:
            - bad_request_error
            - authorized_error
            - insufficient_balance_error
            - unprocessable_entity_error
            - rate_limit_error
            - server_error
            - overloaded_error
          type: string
        message:
          description: 错误说明，末尾括号内为错误码，例如 `(2013)`。
          type: string
        http_code:
          description: HTTP 状态码（字符串）。
          type: string
      required:
        - type
        - message
        - http_code
      type: object
    MiniMaxV2MediaURL:
      additionalProperties: false
      description: 素材地址。
      properties:
        url:
          description: >-
            公网 `http(s)` 地址，或 `data:<类型>;base64,<数据>` 形式的 Base64（格式小写）。不支持
            `mm_file://`。请求体总大小 ≤ 64 MB，较大的文件请使用公网地址。
          minLength: 1
          type: string
      required:
        - url
      type: object
  securitySchemes:
    bearerAuth:
      description: '在请求头 `Authorization: Bearer <API Key>` 中携带 DreamTo API Key。'
      scheme: bearer
      type: http

````

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