> ## 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 で H3 Max Turbo を使用する

> Comfy Router 経由で fal/h3-max-turbo を呼び出す: エンドポイント、リクエスト形状、Router が返すレスポンス。

Comfy Router が fal から提供する `fal/h3-max-turbo` の API Reference。

## クイックスタート

[Comfy ワークスペース](https://platform.comfy.org/profile/api-keys)でキーを作成し、`COMFY_API_KEY` としてエクスポートします。Python と TypeScript のスニペットは Comfy SDK（`pip install comfy-sdk`、`npm install @comfyorg/sdk`）を使用しています。cURL のスニペットは、同じ呼び出しを生の HTTP で実行するものです。

**モデル ID:** `fal/h3-max-turbo`

**エンドポイント:** `POST https://api.comfy.org/v2/models/fal/h3-max-turbo`

<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(
              "fal/h3-max-turbo",
              {
                  "duration": 5,
                  "prompt": "a red fox running through a snowy forest",
                  "prompt_expansion_mode": "balanced",
                  "resolution": "480P",
              },
          )

      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("fal/h3-max-turbo", {
        duration: 5,
        prompt: "a red fox running through a snowy forest",
        prompt_expansion_mode: "balanced",
        resolution: "480P",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/fal/h3-max-turbo \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"duration\": 5, \"prompt\": \"a red fox running through a snowy forest\", \"prompt_expansion_mode\": \"balanced\", \"resolution\": \"480P\"}"
      ```
    </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(
              "fal/h3-max-turbo",
              {
                  "duration": 5,
                  "prompt": "a red fox running through a snowy forest",
                  "prompt_expansion_mode": "balanced",
                  "resolution": "480P",
              },
          )
          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("fal/h3-max-turbo", {
        duration: 5,
        prompt: "a red fox running through a snowy forest",
        prompt_expansion_mode: "balanced",
        resolution: "480P",
      });
      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/fal/h3-max-turbo/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"duration\": 5, \"prompt\": \"a red fox running through a snowy forest\", \"prompt_expansion_mode\": \"balanced\", \"resolution\": \"480P\"}"

      # 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/fal/h3-max-turbo/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/fal/h3-max-turbo/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="aspect_ratio" type="string" default="&#x22;16:9&#x22;">
  アスペクト比: 21:9、16:9、4:3、1:1、3:4、または 9:16。
</ParamField>

<ParamField body="duration" type="integer" default="5">
  生成されるビデオの再生時間（秒）。
</ParamField>

<ParamField body="enable_safety_checker" type="boolean" default="true">
  安全性チェッカーを有効にします。
</ParamField>

<ParamField body="prompt" type="string" required>
  ビデオ生成用のテキストプロンプト。
</ParamField>

<ParamField body="prompt_expansion_mode" type="string" required>
  生成前にプロンプトの書き換えにどの程度の労力を費やすか: balanced または quality。
</ParamField>

<ParamField body="resolution" type="string" default="&#x22;768P&#x22;">
  生成されるビデオの解像度: 480P または 768P。
</ParamField>

<ParamField body="seed" type="integer">
  ランダムシード。省略した場合はランダムシードが選択済みになります。
</ParamField>

<ParamField body="sync_mode" type="boolean">
  生成されたビデオを CDN URL ではなく base64 として返します。
</ParamField>

Router が `GET /v2/models/fal/h3-max-turbo/openapi.json` で提供するスキーマから生成されています。これはリクエストがプロバイダーに到達する前に呼び出しを検証する際に使用されるものと同じドキュメントです。

### 出力

<ResponseField name="expanded_prompt" type="string">
  展開後のプロンプト。モデルに送信された内容です。
</ResponseField>

<ResponseField name="timings" type="object">
  エンドツーエンドの所要時間の内訳（秒）。
</ResponseField>

<ResponseField name="video" type="object" required>
  生成されたビデオファイル。
</ResponseField>

<ResponseField name="video.content_type" type="string">
  ビデオファイルの MIME タイプ。
</ResponseField>

<ResponseField name="video.file_name" type="string">
  ビデオファイルの名前。
</ResponseField>

<ResponseField name="video.file_size" type="integer">
  ビデオファイルのサイズ（バイト）。
</ResponseField>

<ResponseField name="video.url" type="string">
  生成されたビデオの URL。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "duration": 5,
  "prompt": "a red fox running through a snowy forest",
  "prompt_expansion_mode": "balanced",
  "resolution": "480P"
}
```

### 出力

```json theme={null}
{
  "expanded_prompt": "a single red maple leaf falling onto still water, cinematic, 4k",
  "timings": {
    "inference": 42.5
  },
  "video": {
    "content_type": "video/mp4",
    "file_name": "output.mp4",
    "file_size": 4194304,
    "url": "https://example.invalid/fal/minimax/h3-max/output.mp4"
  }
}
```

## 出荷前の確認

SDK は `Idempotency-Key` を生成し、自動リトライで再利用します。手動リトライでは元のキーを再利用してください。Router は最大 10 分間接続を保持できます。

リクエストが失敗すると、Router は理由を示す `X-Comfy-Error-Type` レスポンスヘッダーを送信します。`422` は、プロバイダーを呼び出す前に Router が入力を拒否したことを意味します。生成されたアセットは [結果 URL の有効期限](/ja/development/comfy-router/reference#結果アセット) があるため、早めにダウンロードしてください。

<CardGroup cols={3}>
  <Card title="ヘッダー" icon="list" href="/ja/development/comfy-router/quickstart">
    認証、冪等性、リクエスト ID、エラー分類、リトライ間隔、支出上限。
  </Card>

  <Card title="Router API の利用" icon="code" href="/ja/development/comfy-router/quickstart">
    モデルの検出、バリデーションエラー、リトライ、課金。
  </Card>

  <Card title="制限事項" icon="triangle-exclamation" href="/ja/development/comfy-router/limitations">
    Router が現在対応していないことと、代替手段。
  </Card>
</CardGroup>
