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

# FLUX Video Upscale を Comfy Router で使用する

> Comfy Router 経由で HTTP 上で FLUX Video Upscale を使ってビデオをアップスケーリングするための Python、TypeScript、cURL スニペット、およびリクエストフィールドと結果の形状

FLUX Video Upscale の API リファレンス。FLUX Video Upscale は Black Forest Labs のビデオアップスケーラーです。ビデオを送信すると、より高解像度のバージョンが返されます。

## クイックスタート

[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:** `bfl/video-upscale-v1`

**エンドポイント:** `POST https://api.comfy.org/v2/models/bfl/video-upscale-v1`

<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(
              "bfl/video-upscale-v1",
              {
                  "input_video": "https://your-host.example/clip.mp4",
                  "upscale_factor": 2,
                  "creativity": 1,
              },
          )

      print("video:", result["result"]["sample"])
      ```

      ```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.
      type Result = { result: { sample: string } };
      const { data } = await comfy.models.run<Result>("bfl/video-upscale-v1", {
        input_video: "https://your-host.example/clip.mp4",
        upscale_factor: 2,
        creativity: 1,
      });

      console.log("video:", data.result.sample);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/bfl/video-upscale-v1 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input_video\": \"https://your-host.example/clip.mp4\", \"upscale_factor\": 2, \"creativity\": 1}"
      ```
    </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(
              "bfl/video-upscale-v1",
              {
                  "input_video": "https://your-host.example/clip.mp4",
                  "upscale_factor": 2,
                  "creativity": 1,
              },
          )
          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("video:", result["result"]["sample"])
      ```

      ```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.
      type Result = { result: { sample: string } };
      const handle = await comfy.models.submit<Result>("bfl/video-upscale-v1", {
        input_video: "https://your-host.example/clip.mp4",
        upscale_factor: 2,
        creativity: 1,
      });
      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();
      if (result.kind !== "json") throw new Error("expected a JSON result");

      console.log("video:", result.data.result.sample);
      ```

      ```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/bfl/video-upscale-v1/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input_video\": \"https://your-host.example/clip.mp4\", \"upscale_factor\": 2, \"creativity\": 1}"

      # 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/bfl/video-upscale-v1/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/bfl/video-upscale-v1/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="creativity" type="integer" default="1">
  0 はソースを正確に保持してシャープにします。1 は創造的なディテール強化を許可し、人物の顔や製品を厳密には保持しません。

  範囲: `0` から `1`
</ParamField>

<ParamField body="input_video" type="string" required>
  アップスケールするビデオ。HTTP(S) URL または base64 エンコードされた MP4 のいずれかです。ソース映像は最大 20 秒、50MB までです。
</ParamField>

<ParamField body="prompt" type="string">
  クリップの内容を説明する省略可能な項目で、強化されるディテールを誘導します。ニュートラルなアップスケールにしたい場合は空のままにします。
</ParamField>

<ParamField body="safety_tolerance" type="integer" default="2">
  プロンプトと出力フレームのモデレーションに対する許容値で、0 が最も厳格です。

  範囲: `0` から `4`
</ParamField>

<ParamField body="upscale_factor" type="number" default="2">
  ソース解像度に対する出力のスケール。出力はソースのアスペクト比を保持し、1 フレームあたり約 14.4 メガピクセルに制限されるため、非常に大きなソースでは要求した係数より小さくスケールされます。

  範囲: `1.5` から `3`

  フォーマット: `float`
</ParamField>

<ParamField body="webhook_secret" type="string">
  webhook 署名検証用の省略可能なシークレット。
</ParamField>

<ParamField body="webhook_url" type="string (uri)">
  webhook 通知を受け取る URL。

  フォーマット: `uri`
</ParamField>

プロバイダーにリクエストが到達する前に呼び出しを検証する対象となるドキュメントと同じ、Router が `GET /v2/models/bfl/video-upscale-v1/openapi.json` で提供するスキーマから生成されています。

### 出力

<ResponseField name="cost" type="number">
  プロバイダーが報告するクレジット単位のコストで、タスクが Ready になると設定されます。

  フォーマット: `float`
</ResponseField>

<ResponseField name="id" type="string" required>
  BFL のタスク識別子。
</ResponseField>

<ResponseField name="progress" type="number">
  BFL が報告する省略可能な生成の進捗。

  範囲: `0` から `1`

  フォーマット: `float`
</ResponseField>

<ResponseField name="result" type="object" required>
  完了した生成結果。ここでは nullable ではありません。このコンポーネントの `required` エントリは `200` が result を伴うという約束であり、`result` が nullable だとキーの存在確認だけに矮小化されてしまいます。
</ResponseField>

<ResponseField name="result.cost" type="number">
  プロバイダーが報告する生成のコスト。これは BFL の数値であり、Comfy の請求額ではありません。

  フォーマット: `double`
</ResponseField>

<ResponseField name="result.duration" type="number">
  プロバイダーが報告する生成の所要時間（秒）。

  フォーマット: `double`
</ResponseField>

<ResponseField name="result.end_time" type="number">
  プロバイダーが報告する生成の完了時刻（Unix エポックからの秒数）。`start_time` と同じ理由で `double` です。

  フォーマット: `double`
</ResponseField>

<ResponseField name="result.prompt" type="string">
  プロンプトのアップサンプリング後の、生成が実際に実行したプロンプト。
</ResponseField>

<ResponseField name="result.sample" type="string (uri)">
  生成されたアセットの署名付き URL。Router はアセットを Comfy のストレージに再ホストしてこのフィールドを書き換えるため、通常は最大 24 時間有効な Comfy ホストの URL になります。発行時に 24 時間分の署名が付与され、23 時間のメモから再生されるため、後でポーリングすると残り 1 時間しかないものが返ることがあります。再ホストを実行できなかったリーフは、代わりに BFL 自身の短命な配信 URL を保持します。ビデオでは約 2 時間、画像では約 10 分です。いずれにしてもリンクは失効するため、URL を保存するのではなくアセットをダウンロードしてください。

  フォーマット: `uri`
</ResponseField>

<ResponseField name="result.seed" type="integer">
  生成が使用したシード。指定されたものでもプロバイダーが選んだものでも同じです。`int64` として宣言されているのは、BFL が 2^31 を超えるシード（例: 2784347701）を返すためです。フォーマットされていない `integer` は、多くの SDK ジェネレーターで 32 ビットフィールドとして生成されます。

  フォーマット: `int64`
</ResponseField>

<ResponseField name="result.start_time" type="number">
  プロバイダーが報告する生成の開始時刻（Unix エポックからの秒数）。`float` ではなく `double` です。現在のエポック値付近では float32 の間隔が約 128 秒になるため、生成全体の範囲が 1 つのデコード値に潰れてしまいます。

  フォーマット: `double`
</ResponseField>

<ResponseField name="status" type="string" required>
  タスクのステータス: Pending、Reasoning、Generating、Ready、Request Moderated、Content Moderated、Error、または Task not found。
</ResponseField>

<h2 id="examples">
  Examples
</h2>

### 入力

```json theme={null}
{
  "input_video": "https://your-host.example/clip.mp4",
  "upscale_factor": 2,
  "creativity": 1
}
```

### 出力

```json theme={null}
{
  "id": "0a1b2c3d-...",
  "status": "Ready",
  "result": {
    "sample": "https://.../upscaled.mp4"
  }
}
```

`result.sample` は通常、作成時点から最大24時間有効な Comfy がホストする署名付き URL です。リプレイでは古い URL が返されることがあり、再ホストできなかったアセットは有効期限の短いプロバイダーの URL のままとなります。リンクを保存するのではなく、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>
