> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-sync-comfy-api-v2-spec.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy Router で Video To Video Resize を使う

> Comfy Router 経由で moonvalley/video-to-video-resize を呼び出します。エンドポイント、リクエストの形状、Router が返すレスポンスについて説明します。

`moonvalley/video-to-video-resize` のAPIリファレンス。Comfy Router が Moonvalley から提供しています。

## クイックスタート

[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:** `moonvalley/video-to-video-resize`

**エンドポイント:** `POST https://api.comfy.org/v2/models/moonvalley/video-to-video-resize`

<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(
              "moonvalley/video-to-video-resize",
              {
                  "control_type": "motion_control",
                  "prompt_text": "Apply motion control to enhance this video",
                  "video_url": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
              },
          )

      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("moonvalley/video-to-video-resize", {
        control_type: "motion_control",
        prompt_text: "Apply motion control to enhance this video",
        video_url: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/moonvalley/video-to-video-resize \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"control_type\": \"motion_control\", \"prompt_text\": \"Apply motion control to enhance this video\", \"video_url\": \"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4\"}"
      ```
    </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(
              "moonvalley/video-to-video-resize",
              {
                  "control_type": "motion_control",
                  "prompt_text": "Apply motion control to enhance this video",
                  "video_url": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
              },
          )
          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("moonvalley/video-to-video-resize", {
        control_type: "motion_control",
        prompt_text: "Apply motion control to enhance this video",
        video_url: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
      });
      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/moonvalley/video-to-video-resize/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"control_type\": \"motion_control\", \"prompt_text\": \"Apply motion control to enhance this video\", \"video_url\": \"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4\"}"

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

## スキーマ

### 入力

<ParamField body="control_type" type="string" required>
  ビデオ制御でサポートされるタイプ

  指定可能な値: `motion_control`, `pose_control`
</ParamField>

<ParamField body="image_url" type="string">
  制御画像の URL
</ParamField>

<ParamField body="inference_params" type="object" />

<ParamField body="inference_params.control_params" type="object" />

<ParamField body="inference_params.control_params.motion_intensity" type="integer" default="6">
  モーション制御の強度

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

<ParamField body="inference_params.guidance_scale" type="number" default="10">
  生成制御のガイダンススケール

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

<ParamField body="inference_params.negative_prompt" type="string">
  ネガティブプロンプトのテキスト
</ParamField>

<ParamField body="inference_params.seed" type="integer" default="9">
  生成のためのランダムシード (デフォルト: ランダム)
</ParamField>

<ParamField body="inference_params.steps" type="integer" default="80">
  デノイズのステップ数
</ParamField>

<ParamField body="inference_params.use_negative_prompts" type="boolean" default="true">
  ネガティブプロンプトを使用するかどうか
</ParamField>

<ParamField body="prompt_text" type="string" required>
  生成するビデオを記述します
</ParamField>

<ParamField body="video_url" type="string" required>
  制御ビデオの URL
</ParamField>

<ParamField body="webhook_url" type="string">
  通知用のオプションの webhook URL
</ParamField>

<ParamField body="frame_position" type="integer[]" />

<ParamField body="frame_resolution" type="integer[]" />

<ParamField body="scale" type="integer[]" />

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

### 出力

<ResponseField name="error" type="object" />

<ResponseField name="frame_conditioning" type="object" />

<ResponseField name="id" type="string" />

<ResponseField name="inference_params" type="object" />

<ResponseField name="meta" type="object" />

<ResponseField name="model_params" type="object" />

<ResponseField name="output_url" type="string" required />

<ResponseField name="prompt_text" type="string" />

<ResponseField name="status" type="string" required />

## 例

### 入力

```json theme={null}
{
  "control_type": "motion_control",
  "prompt_text": "Apply motion control to enhance this video",
  "video_url": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4"
}
```

### 出力

```json theme={null}
{
  "id": "018f2c7a-4b1e-7c3d-9a05-6e2f8b41d0c9",
  "output_url": "https://example.invalid/moonvalley/prompts/output.mp4",
  "prompt_text": "a single red maple leaf falling onto still water",
  "status": "completed"
}
```

## 出荷前の確認

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>
