> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-willie-des-1087-router-migration-block.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy Router로 MiniMax H3 사용하기

> Comfy Router를 통해 minimax/minimax-h3를 호출합니다: 엔드포인트, 요청 형태, Router가 반환하는 응답.

`minimax/minimax-h3`의 API 레퍼런스로, MiniMax에서 Comfy Router를 통해 제공됩니다.

## 빠른 시작

[Comfy 워크스페이스](https://platform.comfy.org/profile/api-keys)에서 키를 생성하고 `COMFY_API_KEY`로 내보내세요. Python 및 TypeScript 스니펫은 Comfy SDK(`pip install comfy-sdk`, `npm install @comfyorg/sdk`)를 사용하며, cURL 스니펫은 동일한 호출을 raw HTTP로 수행합니다.

**모델 ID:** `minimax/minimax-h3`

**엔드포인트:** `POST https://api.comfy.org/v2/models/minimax/minimax-h3`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "minimax/minimax-h3",
              {
                  "content": [
                      {
                          "text": "A single red maple leaf resting on a plain white background.",
                          "type": "text",
                      },
                  ],
                  "duration": 5,
                  "ratio": "16:9",
                  "resolution": "768P",
              },
          )

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      const { data } = await comfy.models.run("minimax/minimax-h3", {
        content: [
          {
            text: "A single red maple leaf resting on a plain white background.",
            type: "text",
          },
        ],
        duration: 5,
        ratio: "16:9",
        resolution: "768P",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/minimax/minimax-h3 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"content\": [{\"text\":\"A single red maple leaf resting on a plain white background.\",\"type\":\"text\"}], \"duration\": 5, \"ratio\": \"16:9\", \"resolution\": \"768P\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "minimax/minimax-h3",
              {
                  "content": [
                      {
                          "text": "A single red maple leaf resting on a plain white background.",
                          "type": "text",
                      },
                  ],
                  "duration": 5,
                  "ratio": "16:9",
                  "resolution": "768P",
              },
          )
          print("request_id:", handle.request_id)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      const handle = await comfy.models.submit("minimax/minimax-h3", {
        content: [
          {
            text: "A single red maple leaf resting on a plain white background.",
            type: "text",
          },
        ],
        duration: 5,
        ratio: "16:9",
        resolution: "768P",
      });
      console.log("requestId:", handle.requestId); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      const result = await handle.get();

      console.log(result.data);
      ```

      ```bash cURL theme={null}
      # 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/minimax/minimax-h3/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"content\": [{\"text\":\"A single red maple leaf resting on a plain white background.\",\"type\":\"text\"}], \"duration\": 5, \"ratio\": \"16:9\", \"resolution\": \"768P\"}"

      # 2. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/minimax/minimax-h3/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/minimax/minimax-h3/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## 스키마

### 입력

<ParamField body="aigc_watermark" type="boolean">
  출력에 AIGC 워터마크를 추가할지 여부입니다. 기본값은 거짓입니다.
</ParamField>

<ParamField body="callback_url" type="string">
  선택 사항입니다. 챌린지 검증 이후 작업 상태 변경을 수신할 URL입니다.
</ParamField>

<ParamField body="content" type="object[]" required>
  생성을 구동하는 콘텐츠 항목입니다. 비어 있지 않은 텍스트 항목 하나를 반드시 포함해야 하며, 선택적으로 first\_frame/last\_frame 이미지 또는 reference\_\* 미디어를 추가할 수 있습니다.
</ParamField>

<ParamField body="content[].audio_url" type="object">
  오디오 소스입니다. audio\_url 항목에 필수입니다.
</ParamField>

<ParamField body="content[].audio_url.url" type="string">
  공개적으로 접근 가능한 URL, mm\_file://\{file\_id} 참조 또는 데이터 URI입니다.
</ParamField>

<ParamField body="content[].image_url" type="object">
  이미지 소스입니다. image\_url 항목에 필수입니다.
</ParamField>

<ParamField body="content[].image_url.url" type="string">
  공개적으로 접근 가능한 URL, mm\_file://\{file\_id} 참조 또는 데이터 URI입니다.
</ParamField>

<ParamField body="content[].role" type="string">
  미디어 항목의 역할입니다. 옵션: first\_frame, last\_frame, reference\_image, reference\_video, reference\_audio, base\_video. 키프레임 역할과 reference\_\* 역할은 하나의 요청 내에서 상호 배타적입니다. base\_video는 비디오 재생성 요청의 소스 비디오를 나타냅니다.
</ParamField>

<ParamField body="content[].text" type="string">
  프롬프트 텍스트입니다. 요청당 비어 있지 않은 텍스트 항목이 정확히 하나 필요합니다.
</ParamField>

<ParamField body="content[].type" type="string" required>
  콘텐츠 항목 유형입니다. 옵션: text, image\_url, video\_url, audio\_url.
</ParamField>

<ParamField body="content[].video_url" type="object">
  비디오 소스입니다. video\_url 항목에 필수입니다.
</ParamField>

<ParamField body="content[].video_url.url" type="string">
  공개적으로 접근 가능한 URL, mm\_file://\{file\_id} 참조 또는 데이터 URI입니다.
</ParamField>

<ParamField body="duration" type="integer" required>
  비디오 재생 시간(초)으로, 5에서 15 사이입니다.
</ParamField>

<ParamField body="model" type="string">
  모델의 ID입니다. 옵션: MiniMax-H3. Router 호출자는 이 필드를 생략하거나 null을 보낼 수 있습니다. Router는 공급자 디스패치 이전에 요청 경로에서 선택된 모델을 주입합니다.
</ParamField>

<ParamField body="ratio" type="string">
  화면 비율입니다. 옵션: adaptive(기본값), 21:9, 16:9, 4:3, 1:1, 3:4, 9:16. 텍스트 기반 비디오 생성에서는 필수이며 adaptive일 수 없습니다. 첫 프레임 또는 마지막 프레임 생성에서는 무시됩니다(adaptive로 처리됨).
</ParamField>

<ParamField body="resolution" type="string" required>
  비디오 해상도입니다. 옵션: 2K, 768P.
</ParamField>

<ParamField body="seed" type="integer">
  \[-1, 2^32 - 1] 범위의 무작위 시드입니다. 생략하거나 -1이면 무작위입니다.

  형식: `int64`
</ParamField>

Router가 `GET /v2/models/minimax/minimax-h3/openapi.json`에서 제공하는 스키마에서 생성되었으며, 이는 요청이 공급자에게 도달하기 이전에 호출을 검증하는 데 사용하는 것과 동일한 문서입니다.

### 출력

<ResponseField name="task" type="object">
  Minimax V2 비디오 생성 작업입니다.
</ResponseField>

<ResponseField name="task.content" type="object">
  생성된 출력입니다. 상태가 succeeded일 때 존재합니다.
</ResponseField>

<ResponseField name="task.content.prompt" type="string">
  성공한 h3\_context\_ir 작업에서 생성된 향상된 비디오 프롬프트입니다.
</ResponseField>

<ResponseField name="task.content.url" type="string">
  생성된 MP4의 시간 제한 URL입니다. 갱신된 URL을 얻으려면 다시 조회하세요.
</ResponseField>

<ResponseField name="task.duration" type="number">
  생성된 비디오의 재생 시간(초)입니다.
</ResponseField>

<ResponseField name="task.error" type="object">
  상태가 failed일 때의 오류 세부 정보이며, code와 message를 포함합니다.
</ResponseField>

<ResponseField name="task.id" type="string">
  작업 ID입니다.
</ResponseField>

<ResponseField name="task.model" type="string">
  작업에 사용된 모델입니다.
</ResponseField>

<ResponseField name="task.ratio" type="string">
  생성된 비디오의 실제 화면 비율입니다.
</ResponseField>

<ResponseField name="task.resolution" type="string">
  생성된 비디오의 해상도입니다.
</ResponseField>

<ResponseField name="task.status" type="string">
  작업 상태입니다. 옵션: queued, running, succeeded, failed, cancelled, expired.
</ResponseField>

<ResponseField name="task.task_type" type="string">
  작업의 유형입니다.
</ResponseField>

<ResponseField name="task.usage" type="object">
  작업에 대해 기록된 사용량입니다.
</ResponseField>

<ResponseField name="task.usage.completion_tokens" type="integer" />

<ResponseField name="task.usage.input_image_count" type="integer" />

<ResponseField name="task.usage.input_seconds" type="number" />

<ResponseField name="task.usage.output_seconds" type="number" />

<ResponseField name="task.usage.prompt_tokens" type="integer" />

<ResponseField name="task.usage.total_seconds" type="number" />

<ResponseField name="task.usage.total_tokens" type="integer" />

## 예시

### 입력

```json theme={null}
{
  "content": [
    {
      "text": "A single red maple leaf resting on a plain white background.",
      "type": "text"
    }
  ],
  "duration": 5,
  "ratio": "16:9",
  "resolution": "768P"
}
```

### 출력

```json theme={null}
{
  "task": {
    "content": {
      "url": "https://example.invalid/minimax/minimax-h3/generated.mp4"
    },
    "duration": 6,
    "id": "3f7a1b28-5c0d-4e91-8a6f-1b2c3d4e5f60",
    "model": "MiniMax-H3",
    "ratio": "16:9",
    "resolution": "768P",
    "status": "succeeded",
    "usage": {
      "output_seconds": 6,
      "total_seconds": 6
    }
  }
}
```

## 배포 전 확인

SDK는 `Idempotency-Key`를 생성하고 자동 재시도에 재사용합니다. 수동으로 재시도할 때는 원본 키를 재사용하세요. Router는 연결을 최대 10분간 유지할 수 있습니다.

요청이 실패하면 Router는 그 이유를 설명하는 `X-Comfy-Error-Type` 응답 헤더를 보냅니다. `422`는 Router가 공급자를 호출하기 전에 입력을 거부했음을 의미하고, `413`은 요청 본문이 Router가 허용하는 크기보다 컸음을 의미합니다. [결과 URL이 만료](/ko/development/comfy-router/reference#결과-에셋)될 수 있으므로 생성된 에셋은 즉시 다운로드하세요.

위의 필드 설명에 명시된 크기 제한은 해당 필드에 대한 공급자 자체의 한도이며, 공급자 사양에서 인용한 것입니다. Router는 전체 요청 본문에 별도의 상한을 적용하며, base64로 인코딩된 미디어도 여기에 포함됩니다. [요청 본문 크기](/ko/development/comfy-router/limitations)를 참고하세요.

<CardGroup cols={3}>
  <Card title="헤더" icon="list" href="/ko/development/comfy-router/headers">
    인증, 멱등성, 요청 ID, 오류 분류, 재시도 간격, 지출 한도.
  </Card>

  <Card title="Router API 사용" icon="code" href="/ko/development/comfy-router/api">
    모델 검색, 검증 오류, 재시도, 과금.
  </Card>

  <Card title="제한 사항" icon="triangle-exclamation" href="/ko/development/comfy-router/limitations">
    Router가 현재 지원하지 않는 기능과 대신 사용할 방법.
  </Card>
</CardGroup>
