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

> Comfy Router 経由で fal/flux-3-max を呼び出します：エンドポイント、リクエストの形状、Router が返すレスポンス。

`fal/flux-3-max` の API リファレンスです。Comfy Router が fal から提供します。

**入力:** テキスト、画像 · **出力:** ビデオ + オーディオ

## クイックスタート

[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:** `fal/flux-3-max`

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

**結果を待つ**

```python Python theme={null}
from comfy_sdk import Comfy

# 環境変数から COMFY_API_KEY を読み取ります。
# SDK は自動的に冪等性キーを作成し、自動リトライで再利用します。
with Comfy() as client:
    result = client.models.run(
        "fal/flux-3-max",
        {
            "duration": 5,
            "prompt": "A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.",
            "resolution": "720p",
        },
    )

print(result)
```

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

// 環境変数から COMFY_API_KEY を読み取ります。
// SDK は自動的に冪等性キーを作成し、自動リトライで再利用します。
const { data } = await comfy.models.run("fal/flux-3-max", {
  duration: 5,
  prompt: "A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.",
  resolution: "720p",
});

console.log(data);
```

```bash cURL theme={null}
curl https://api.comfy.org/v2/models/fal/flux-3-max \
  -H "X-API-Key: $COMFY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "{\"duration\": 5, \"prompt\": \"A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.\", \"resolution\": \"720p\"}"
```

**キューに入れて後で収集する**

同じボディを `POST https://api.comfy.org/v2/models/fal/flux-3-max/requests` に送信します。Router は実行が受け付けられるとすぐに `201` と `request_id` を返し、結果は準備ができ次第、このプロセスまたは別のプロセスから収集されます。[キューの配信](/ja/development/comfy-router/queue)では、ステータス、キャンセル、収集について順を追って説明します。

```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(
            "fal/flux-3-max",
            {
                "duration": 5,
                "prompt": "A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.",
                "resolution": "720p",
            },
        )
        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("fal/flux-3-max", {
  duration: 5,
  prompt: "A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.",
  resolution: "720p",
});
console.log("requestId:", handle.requestId); // モデル ID と一緒なら、別のプロセスに必要なのはこれだけです

// リクエストが完了するまでポーリングし、サーバーが指定する Retry-After だけ待機します。
for await (const update of handle.events()) {
  console.log(update.status, update.queuePosition);
}

// models.run() が返すのと同じ結果です。失敗したリクエストまたはキャンセル済みのリクエストはここで reject されます。
const result = await handle.get();

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

```bash cURL theme={null}
# 1. 送信します。Router は request_id、status_url、response_url、cancel_url とともに 201 を返します。
curl https://api.comfy.org/v2/models/fal/flux-3-max/requests \
  -H "X-API-Key: $COMFY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d "{\"duration\": 5, \"prompt\": \"A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.\", \"resolution\": \"720p\"}"

# 2. status が COMPLETED になるまでポーリングし、各レスポンスが指定する Retry-After 秒だけ待機します。
REQUEST_ID="<request_id from the 201 body>"
curl -i https://api.comfy.org/v2/models/fal/flux-3-max/requests/$REQUEST_ID/status \
  -H "X-API-Key: $COMFY_API_KEY"

# 3. 収集します。200 はモデル固有の出力、202 はまだ実行中の場合の status ボディです。
curl https://api.comfy.org/v2/models/fal/flux-3-max/requests/$REQUEST_ID \
  -H "X-API-Key: $COMFY_API_KEY"
```

## スキーマ

### 入力

**aspect\_ratio** `string` (default: "auto")

生成されるビデオのアスペクト比。auto の場合、テキストプロンプトでは 16:9 になり、それ以外では最初の画像に従います。

指定可能な値: `auto`、`21:9`、`2:1`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16`

**duration** `integer` (default: 5)

生成されるビデオの再生時間（秒）。5 から 20 まで。fal はこの値の秒数に応じて課金します。

範囲: `5` から `20`

**generate\_audio** `boolean` (default: true)

同期されたオーディオを生成します。料金は同じです。

**prompt** `string` *required*

ビデオとそのサウンドを説明するテキストプロンプト。

**reasoning\_level** `string` (default: "high")

生成前にモデルがプロンプトについてどれだけ推論し、展開するか。high はより低速です。料金は同じです。

指定可能な値: `low`、`high`

**resolution** `string` (default: "720p")

生成されるビデオの解像度。1080p は 720p より 1 秒あたりの料金が高くなります。

指定可能な値: `720p`、`1080p`

**seed** `integer`

ランダムシード。省略した場合はランダムなシードが選択されます。

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

### 出力

**seed** `integer`

生成に使用されたシード。

**timings** `object`

秒単位のタイミング内訳。

**video** `object` *required*

生成されたビデオファイル。

**video.content\_type** `string`

ビデオファイルの MIME タイプ。

**video.duration** `number`

ビデオの再生時間（秒）。

**video.file\_name** `string`

ビデオファイルの名前。

**video.file\_size** `integer`

ビデオファイルのサイズ（バイト）。

**video.fps** `number`

ビデオのフレームレート。

**video.height** `integer`

ビデオの高さ（ピクセル）。

**video.num\_frames** `integer`

ビデオのフレーム数。

**video.url** `string` *required*

生成されたビデオの URL。

**video.width** `integer`

ビデオの幅（ピクセル）。

## 例

### 入力

```json theme={null}
{
  "duration": 5,
  "prompt": "A red panda walks along a mossy log in a sunlit forest. Ambient birdsong.",
  "resolution": "720p"
}
```

### 出力

```json theme={null}
{
  "seed": 42,
  "video": {
    "content_type": "video/mp4",
    "duration": 5.041666666666667,
    "file_name": "video.mp4",
    "file_size": 4404019,
    "fps": 24,
    "height": 704,
    "num_frames": 121,
    "url": "https://example.invalid/fal/flux-3-max/video.mp4",
    "width": 1280
  }
}
```

## 出荷前の確認

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

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

上記のフィールド説明に記載されているサイズ制限は、プロバイダーの仕様から引用した、そのフィールドに対するプロバイダー自身の上限です。Router はリクエスト本文全体に対して別の上限を適用し、base64 エンコードされたメディアもこれにカウントされます。[リクエスト本文のサイズ](/ja/development/comfy-router/limitations) を参照してください。

このページは、Comfy Router 経由で呼び出す 1 つのパートナーモデルについて説明しています。同じ `comfy-sdk` / `@comfyorg/sdk` パッケージには、Comfy Cloud 上で ComfyUI のワークフローグラフ全体を実行するための 2 つ目のクライアントも含まれています: `Comfy(api_key=...)` / `new Comfy({ apiKey })`、および `client.workflows`、`client.assets`、`client.jobs`。[Comfy SDKs](/ja/development/api-development/sdks) を参照してください。

> **[ヘッダー](/ja/development/comfy-router/headers)**
>
> 認証、冪等性、リクエスト ID、エラー分類、リトライ間隔、支出上限。

> **[Router API の利用](/ja/development/comfy-router/api)**
>
> モデルの検出、バリデーションエラー、リトライ、課金。

> **[制限事項](/ja/development/comfy-router/limitations)**
>
> Router が現在対応していないことと、代替手段。


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