> ## Documentation Index
> Fetch the complete documentation index at: https://comfyuiwiki.com/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 H3(Hailuo 03)는 옴니모달 비디오 모델로, 한 번의 생성에서 영상과 오디오 트랙을 함께 만들어 내므로 완성된 클립에 이미 대사, 음향 효과, 음악이 포함되어 있습니다.

## 빠른 시작

[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 스니펫은 동일한 호출을 raw HTTP로 수행합니다.

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

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

<Tabs defaultTabIndex={1}>
  <Tab title="결과 기다리기">
    <CodeGroup>
      ```python Python theme={null}
      import asyncio
      from comfy_sdk import AsyncComfy

      # 환경 변수에서 COMFY_API_KEY를 읽습니다.
      # SDK는 자동으로 idempotency 키를 생성하고 자동 재시도에 재사용합니다.
      async def main():
          async with AsyncComfy() as client:
              result = await 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("video:", result["task"]["content"]["url"])

      asyncio.run(main())
      ```

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

      // 환경 변수에서 COMFY_API_KEY를 읽습니다.
      // SDK는 자동으로 idempotency 키를 생성하고 자동 재시도에 재사용합니다.
      type Result = { task: { content: { url: string } } };
      const result = await comfy.models.run<Result>("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",
      });
      if (result.kind !== "json") throw new Error("expected a JSON result");

      console.log("video:", result.data.task.content.url);
      ```

      ```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="대기열에 제출하고 나중에 수집">
    동일한 본문을 `POST https://api.comfy.org/v2/models/minimax/minimax-h3/requests` 로 보냅니다. Router는 실행이 접수되는 즉시 `201` 과 `request_id` 를 응답하며, 결과는 준비가 되는 대로 이 프로세스나 다른 프로세스에서 수집할 수 있습니다. 상태, 취소, 수집 방법은 [실행 대기열 전송](/ko/development/comfy-router/queue) 를 참고하세요.

    <CodeGroup>
      ```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",
                  {
                      "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)  # 모델 ID와 함께라면 다른 프로세스에 필요한 전부입니다

              # 요청이 완료될 때까지 폴링하며, 서버가 알려준 Retry-After만큼 대기합니다.
              async for update in handle.iter_events():
                  print(update.status, update.queue_position)

              # 공급자 자체의 페이로드이며, models.run()이 반환하는 것과 동일한 값입니다.
              # 실패했거나 취소된 요청은 여기에서 타입이 지정된 Router 오류를 발생시킵니다.
              result = await handle.get()

          print("video:", result["task"]["content"]["url"])

      asyncio.run(main())
      ```

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

      // 환경 변수에서 COMFY_API_KEY를 읽습니다.
      // 각 submit() 호출은 자체 Idempotency-Key를 발급하고 자동 재시도에 재사용합니다.
      type Result = { task: { content: { url: string } } };
      const handle = await comfy.models.submit<Result>("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); // 모델 ID와 함께라면 다른 프로세스에 필요한 전부입니다

      // 요청이 완료될 때까지 폴링하며, 서버가 알려준 Retry-After만큼 대기합니다.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // models.run()이 반환하는 것과 동일한 결과입니다. 실패했거나 취소된 요청은 여기에서 거부됩니다.
      const result = await handle.get();
      if (result.kind !== "json") throw new Error("expected a JSON result");

      console.log("video:", result.data.task.content.url);
      ```

      ```bash cURL theme={null}
      # 1. 제출. Router는 request_id, status_url, response_url, cancel_url과 함께 201을 응답합니다.
      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. 상태가 COMPLETED가 될 때까지 폴링하며, 각 응답이 알려주는 Retry-After 초만큼 대기합니다.
      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. 수집. 모델의 네이티브 출력과 함께 200, 아직 실행 중이면 상태 본문과 함께 202를 반환합니다.
      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
    }
  }
}
```

**MP4에는 생성된 오디오 트랙이 담겨 있습니다.** H3는 옴니모달 모델입니다. 음성, 사운드 효과, 음악은 이후에 덧붙여지는 것이 아니라 단일 포워드 패스에서 영상과 함께 합성되며, 결과물은 네이티브 스테레오 오디오가 담긴 하나의 MP4입니다. 위의 요청 본문에서 이를 끄는 방법은 없습니다. 문서화된 필드는 프롬프트 콘텐츠, `duration`, `ratio`, `resolution`, `seed`, `aigc_watermark`, `callback_url`이며, 어느 것도 무음 렌더를 선택하지 않습니다. 따라서 자체 보이스오버를 클립 위에 얹으려는 파이프라인은 먼저 반환된 트랙을 음소거하거나 제거해야 하며, 그렇지 않으면 이미 말하고 있는 클립 위에 믹싱하게 됩니다. 오디오를 이끄는 것은 프롬프트입니다. 대사, 사운드 효과, 음악을 샷과 동일한 프롬프트 블록에 설명하세요. 프롬프트를 구성하는 방법은 [MiniMax H3 프롬프트 가이드](/ko/tutorials/video/minimax/minimax-h3-prompt-guide)를, 이 모델이 ComfyUI에서 하는 일은 [MiniMax H3 개요](/ko/tutorials/video/minimax/minimax-h3)를 참고하세요.

비디오 URL은 만료됩니다. Router는 MP4를 다시 호스팅하고 12시간 동안 유효한 Comfy 서명 URL을 응답하며, 재호스팅이 실패하면 수명이 더 짧은 MiniMax 자체 링크로 대체합니다. 위 응답 스키마의 `task.content.url` 설명은 갱신된 URL을 얻으려면 다시 조회하라고 안내합니다. 이는 MiniMax가 자사 API를 위해 쓴 표현을 그대로 옮긴 것이며, Router는 MiniMax의 작업 조회 라우트를 노출하지 않습니다. 대기 중인 요청의 결과 라우트를 다시 읽으면 요청이 [완료 후 24시간 동안 보관되는](/ko/development/comfy-router/queue#멱등성-및-과금) 동안 저장된 결과 문서를 반환하지만, 그 조회가 새로 서명된 URL을 발급한다고 문서화된 곳은 없습니다. 링크를 보관하기보다 MP4를 즉시 다운로드하세요.

## 배포 전 확인

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)를 참고하세요.

이 페이지는 Comfy Router를 통해 호출하는 하나의 파트너 모델을 설명합니다. 동일한 `comfy-sdk` / `@comfyorg/sdk` 패키지에는 Comfy Cloud에서 전체 ComfyUI 워크플로 그래프를 실행하기 위한 두 번째 클라이언트도 포함되어 있습니다: `Comfy(api_key=...)` / `new Comfy({ apiKey })`, 그리고 `client.workflows`, `client.assets`, `client.jobs`가 있습니다. [Comfy SDKs](/ko/development/api-development/sdks)를 참조하세요.

<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>
