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

# 通过 Comfy Router 使用 MiniMax H3 Image Highspeed

> 通过 Comfy Router 调用 minimax/minimax-h3-image-highspeed：端点、请求形状以及 Router 返回的响应。

`minimax/minimax-h3-image-highspeed` 的 API 参考，由 Comfy Router 提供，来自 MiniMax。

**输入：** 文本、图像 · **输出：** 图像

## 快速开始

在[你的 Comfy 工作区](https://platform.comfy.org/profile/api-keys?onboarding=router)中创建密钥，并将其导出为 `COMFY_API_KEY`。Python 和 TypeScript 片段使用 Comfy SDK（`pip install comfy-sdk` 和 `npm install @comfyorg/sdk`）；cURL 片段是通过原始 HTTP 进行的相同调用。

**模型 ID：** `minimax/minimax-h3-image-highspeed`

**端点：** `POST https://api.comfy.org/v2/models/minimax/minimax-h3-image-highspeed`

> [tab] 等待结果
>
> ```python Python theme={null}
> from comfy_sdk import Comfy
>
> # 从环境变量读取 COMFY_API_KEY。
> # SDK 会自动创建幂等键，并在自动重试时复用它。
> with Comfy() as client:
>     result = client.models.run(
>         "minimax/minimax-h3-image-highspeed",
>         {
>             "area": "1K",
>             "prompt": "A single red maple leaf resting on a plain white background.",
>         },
>     )
>
> print(result)
> ```
>
> ```typescript TypeScript theme={null}
> import { comfy } from "@comfyorg/sdk";
>
> // 从环境变量读取 COMFY_API_KEY。
> // SDK 会自动创建幂等键，并在自动重试时复用它。
> const { data } = await comfy.models.run("minimax/minimax-h3-image-highspeed", {
>   area: "1K",
>   prompt: "A single red maple leaf resting on a plain white background.",
> });
>
> console.log(data);
> ```
>
> ```bash cURL theme={null}
> curl https://api.comfy.org/v2/models/minimax/minimax-h3-image-highspeed \
>   -H "X-API-Key: $COMFY_API_KEY" \
>   -H "Idempotency-Key: $(uuidgen)" \
>   -H "Content-Type: application/json" \
>   -d "{\"area\": \"1K\", \"prompt\": \"A single red maple leaf resting on a plain white background.\"}"
> ```

> [tab] 排队并稍后收集
>
> 请求体相同，发送到 `POST https://api.comfy.org/v2/models/minimax/minimax-h3-image-highspeed/requests`。一旦运行被受理，Router 就会以 `201` 返回 `request_id`；结果就绪后即可从当前进程或另一个进程收集。[队列投递](https://docs.comfy.org/zh/development/comfy-router/queue.md) 会逐步介绍状态、取消和收集的处理流程。
>
> ```python Python theme={null}
> import asyncio
> from comfy_sdk import AsyncComfy
>
> # 从环境变量读取 COMFY_API_KEY。
> # 每次 submit() 调用都会生成自己的 Idempotency-Key，并在自动重试时复用它。
> async def main():
>     async with AsyncComfy() as client:
>         handle = await client.models.submit(
>             "minimax/minimax-h3-image-highspeed",
>             {
>                 "area": "1K",
>                 "prompt": "A single red maple leaf resting on a plain white background.",
>             },
>         )
>         print("request_id:", handle.request_id)  # 加上模型 ID，就是另一个进程所需的全部信息
>
>         # 轮询直到请求完成，并等待服务器指定的 Retry-After 时间。
>         async for update in handle.iter_events():
>             print(update.status, update.queue_position)
>
>         # 提供商自身的载荷，与 models.run() 返回的值相同。
>         # 失败或已取消的请求会在此处抛出带类型的 Router 错误。
>         result = await handle.get()
>
>     print(result)
>
> asyncio.run(main())
> ```
>
> ```typescript TypeScript theme={null}
> import { comfy } from "@comfyorg/sdk";
>
> // 从环境变量读取 COMFY_API_KEY。
> // 每次 submit() 调用都会生成自己的 Idempotency-Key，并在自动重试时复用它。
> const handle = await comfy.models.submit("minimax/minimax-h3-image-highspeed", {
>   area: "1K",
>   prompt: "A single red maple leaf resting on a plain white background.",
> });
> console.log("requestId:", handle.requestId); // 加上模型 ID，就是另一个进程所需的全部信息
>
> // 轮询直到请求完成，并等待服务器指定的 Retry-After 时间。
> for await (const update of handle.events()) {
>   console.log(update.status, update.queuePosition);
> }
>
> // 与 models.run() 返回的结果相同。失败或已取消的请求会在此处触发拒绝。
> const result = await handle.get();
>
> console.log(result.data);
> ```
>
> ```bash cURL theme={null}
> # 1. 提交。Router 会以 201 返回 request_id、status_url、response_url 和 cancel_url。
> curl https://api.comfy.org/v2/models/minimax/minimax-h3-image-highspeed/requests \
>   -H "X-API-Key: $COMFY_API_KEY" \
>   -H "Idempotency-Key: $(uuidgen)" \
>   -H "Content-Type: application/json" \
>   -d "{\"area\": \"1K\", \"prompt\": \"A single red maple leaf resting on a plain white background.\"}"
>
> # 2. 轮询直到状态为 COMPLETED，并等待每个响应指定的 Retry-After 秒数。
> REQUEST_ID="<request_id from the 201 body>"
> curl -i https://api.comfy.org/v2/models/minimax/minimax-h3-image-highspeed/requests/$REQUEST_ID/status \
>   -H "X-API-Key: $COMFY_API_KEY"
>
> # 3. 收集。完成时返回 200 和模型的原生输出；仍在运行时返回 202 和状态响应体。
> curl https://api.comfy.org/v2/models/minimax/minimax-h3-image-highspeed/requests/$REQUEST_ID \
>   -H "X-API-Key: $COMFY_API_KEY"
> ```

## Schema

### 输入

**area** `string`

当省略 `size` 或为 `auto` 时，输出面积级别。取值为 `1K`、`2K`、`4K`（默认）。

**aspect\_ratio** `string`

当省略 `size` 或为 `auto` 时，输出宽高比。`auto`（默认）或介于 1:3 到 3:1 之间的 `X:Y`，例如 `16:9`。

**disable\_prompt\_enhanced** `boolean` (default: false)

关闭 MiniMax 的提示词增强功能。需要固定的 `size` 或 `X:Y` 形式的 `aspect_ratio`。

**images** `object[]`

可选的参考图像。存在时，请求将作为图像编辑执行，与 edits 路由上完全一致。

**images\[].image\_url** `string` *required*

公开的 http(s) URL 或 `data:image/<format>;base64,` URI。JPEG、PNG、WEBP、HEIC 或 HEIF，每边 128 到 8192 px，长边最多为短边的 4 倍。

**model** `string`

模型名。`MiniMax-H3-Image` 或 `MiniMax-H3-Image-Highspeed`。Router 调用方可以省略此字段或发送 null；Router 会填入请求路径所选择的模型。

**n** `integer` (default: 1)

图像数量。输入 token 按每张图像计费一次。

取值范围：`1` 到 `10`

**output\_compression** `integer`

`jpeg` 和 `webp` 的压缩质量，默认 95。

取值范围：`0` 到 `100`

**output\_format** `string`

输出图像格式。取值为 `png`、`jpeg`、`jpg`（默认）、`webp`。

**prompt** `string` *required*

图像的文本描述。与 `images` 一起使用时，为编辑的描述；参考图像按数组顺序依次为图像 1、图像 2 等。

**size** `string`

输出尺寸，`auto`（默认）或 `WIDTHxHEIGHT`（例如 `2720x1536`）。固定尺寸的面积必须为 655,360 到 20,000,000 像素，宽高比介于 1:3 和 3:1 之间，且不能与 `aspect_ratio` 或 `area` 组合使用。

生成自 Router 在 `GET /v2/models/minimax/minimax-h3-image-highspeed/openapi.json` 提供的 schema，该 schema 与请求到达提供商之前 Router 用于校验调用的文档相同。

### 输出

**created** `integer`

格式：`int64`

**data** `object[]`

**data\[].error** `object`

仅当该图像失败或被拦截时存在。

**data\[].error.code** `string`

**data\[].error.message** `string`

**data\[].revised\_prompt** `string`

MiniMax 为此图像使用的提示词。

**data\[].size** `string`

实际图像尺寸，格式为 `WIDTHxHEIGHT`。

**data\[].url** `string`

生成图像的 URL。该 URL 会过期，请下载图像。

**output\_format** `string`

**request\_id** `string`

**usage** `object`

成功图像的 token 用量。计费基于此。

**usage.generated\_images** `integer`

**usage.input\_tokens** `integer`

**usage.input\_tokens\_details** `object`

**usage.input\_tokens\_details.image\_tokens** `integer`

**usage.input\_tokens\_details.text\_tokens** `integer`

**usage.output\_tokens** `integer`

**usage.output\_tokens\_details** `object`

**usage.output\_tokens\_details.image\_tokens** `integer`

**usage.total\_tokens** `integer`

## 示例

### 输入

```json theme={null}
{
  "area": "1K",
  "prompt": "A single red maple leaf resting on a plain white background."
}
```

### 输出

```json theme={null}
{
  "created": 1794300000,
  "data": [
    {
      "size": "1024x1024",
      "url": "https://example.invalid/minimax/minimax-h3-image/generated.jpg"
    }
  ],
  "output_format": "jpeg",
  "request_id": "06a1b2c3d4e5f60718293a4b5c6d7e8f",
  "usage": {
    "generated_images": 1,
    "input_tokens": 10,
    "input_tokens_details": {
      "image_tokens": 0,
      "text_tokens": 10
    },
    "output_tokens": 1024,
    "output_tokens_details": {
      "image_tokens": 1024
    },
    "total_tokens": 1034
  }
}
```

## 发布前须知

SDK 会生成 `Idempotency-Key` 并在自动重试中复用它。手动重试时，请复用原始 key。Router 最长可保持连接 10 分钟。

请求失败时，Router 会发送 `X-Comfy-Error-Type` 响应头说明原因。`422` 表示 Router 在调用提供商之前就拒绝了输入，`413` 表示请求体超出了 Router 可接受的大小。已生成的资源请及时下载，因为[结果 URL 会过期](https://docs.comfy.org/zh/development/comfy-router/reference.md#结果资产)。

上文任何字段描述中提到的尺寸限制，都是提供商对该字段自身的限定，引自提供商的规范。Router 会对整个请求体另行设置上限，base64 编码的媒体内容也计入其中：参见[请求体大小](https://docs.comfy.org/zh/development/comfy-router/limitations.md)。

本页记录的是通过 Comfy Router 调用的某一个合作伙伴模型。同一个 `comfy-sdk` / `@comfyorg/sdk` 包还提供第二个客户端，用于在 Comfy Cloud 上运行完整的 ComfyUI 工作流图：`Comfy(api_key=...)` / `new Comfy({ apiKey })`，并带有 `client.workflows`、`client.assets` 和 `client.jobs`。请参阅 [Comfy SDKs](https://docs.comfy.org/zh/development/api-development/sdks.md)。

> [card] [请求头](https://docs.comfy.org/zh/development/comfy-router/headers.md)
>
> 身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。

> [card] [使用 Router API](https://docs.comfy.org/zh/development/comfy-router/api.md)
>
> 模型发现、验证错误、重试与计费。

> [card] [限制](https://docs.comfy.org/zh/development/comfy-router/limitations.md)
>
> Router 目前不支持的功能，以及替代方案。


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