> ## 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 で HappyHorse 1.0 I2V を使用する

> Comfy Router 経由で HTTP により wan/happyhorse-1.0-i2v を呼び出すための Python、TypeScript、cURL スニペット、およびリクエストフィールドと結果の形状

HappyHorse 1.0 I2V の API リファレンスです。HappyHorse 1.0 の画像から動画への変換は、静止した最初のフレームをアニメーション化し、同じ処理の中で同期したオーディオをレンダリングします。

<h2 id="quick-start">
  クイックスタート
</h2>

[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:** `wan/happyhorse-1.0-i2v`

**エンドポイント:** `POST https://api.comfy.org/v2/models/wan/happyhorse-1.0-i2v`

<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(
              "wan/happyhorse-1.0-i2v",
              {
                  "input": {
                      "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
                      "img_url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png",
                  },
                  "parameters": {
                      "resolution": "720P",
                      "duration": 5,
                  },
              },
          )

      print("video:", result["output"]["video_url"])
      ```

      ```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 = { output: { video_url: string } };
      const { data } = await comfy.models.run<Result>("wan/happyhorse-1.0-i2v", {
        input: {
          prompt: "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
          img_url: "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png",
        },
        parameters: {
          resolution: "720P",
          duration: 5,
        },
      });

      console.log("video:", data.output.video_url);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/wan/happyhorse-1.0-i2v \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input\": {\"prompt\":\"the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady\",\"img_url\":\"https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png\"}, \"parameters\": {\"resolution\":\"720P\",\"duration\":5}}"
      ```
    </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(
              "wan/happyhorse-1.0-i2v",
              {
                  "input": {
                      "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
                      "img_url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png",
                  },
                  "parameters": {
                      "resolution": "720P",
                      "duration": 5,
                  },
              },
          )
          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["output"]["video_url"])
      ```

      ```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 = { output: { video_url: string } };
      const handle = await comfy.models.submit<Result>("wan/happyhorse-1.0-i2v", {
        input: {
          prompt: "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
          img_url: "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png",
        },
        parameters: {
          resolution: "720P",
          duration: 5,
        },
      });
      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.output.video_url);
      ```

      ```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/wan/happyhorse-1.0-i2v/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input\": {\"prompt\":\"the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady\",\"img_url\":\"https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png\"}, \"parameters\": {\"resolution\":\"720P\",\"duration\":5}}"

      # 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/wan/happyhorse-1.0-i2v/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/wan/happyhorse-1.0-i2v/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="input" type="object" required>
  プロンプトなど、基本情報を入力します。
</ParamField>

<ParamField body="input.audio_url" type="string">
  オーディオファイルのダウンロードURL。対応形式: mp3 および wav。reference\_video\_urls とは併用できません。
</ParamField>

<ParamField body="input.img_url" type="string">
  最初のフレーム画像のURL、または Base64 エンコードデータ。I2V モデルでは必須です。画像形式: JPEG、JPG、PNG、BMP、WEBP。解像度: 360〜2000 ピクセル。ファイルサイズ: 最大 10MB。
</ParamField>

<ParamField body="input.media" type="object[]">
  wan2.7 および wan3.0 モデル用のメディアアセットリスト。ビデオ生成用の参照素材 (画像、オーディオ、ビデオ) を指定します。各要素は type フィールドと url フィールドを含みます。
  サポートされる type の値はモデルによって異なります:

  * wan2.7-i2v: first\_frame、last\_frame、driving\_audio、first\_clip
  * wan2.7-r2v: reference\_image、reference\_video
  * wan2.7-videoedit: video、reference\_image
  * wan3.0-video: first\_frame (最大 1)、last\_frame (最大 1)、reference\_image (最大 10)、
    reference\_video (最大 5 クリップ、合計再生時間 \<= 15 秒)、reference\_audio (最大 5 クリップ、
    合計再生時間 \<= 15 秒)、file (最大 1、link とは併用不可)、link (最大 1、file とは
    併用不可)。reference\_\*/file/link タイプと first\_frame/last\_frame タイプは
    同一リクエスト内で同時に使用できません。配列の順序が、プロンプト内でのアセットの
    参照順序 (画像 1、ビデオ 1、オーディオ 1、…) を定義します。
</ParamField>

<ParamField body="input.media[].type" type="string" required>
  メディアアセットのタイプ

  指定可能な値: `first_frame`、`last_frame`、`driving_audio`、`first_clip`、`reference_image`、`reference_video`、`reference_audio`、`video`、`file`、`link`
</ParamField>

<ParamField body="input.media[].url" type="string" required>
  メディアファイルのURL (公開 HTTP/HTTPS URL または OSS 一時URL)
</ParamField>

<ParamField body="input.negative_prompt" type="string">
  ネガティブプロンプトは、ビデオ画面に表示したくない内容を記述するために使用します
</ParamField>

<ParamField body="input.prompt" type="string">
  テキストプロンプト。中国語と英語に対応し、長さは 800 文字以内です
  (wan3.0-video では最大 20,000 文字。制限を超えた内容は切り捨てられます)。
  複数の参照ビデオを使用する wan2.6-r2v の場合は、参照ビデオの順序に従って
  被写体を 'character1'、'character2' などで参照します。例: 「Character1 が道端で歌い、Character2 がその横で踊る」
  wan3.0-video の参照モードでは、media 配列内の対応する順序でメディアアセットを
  'Image 1'、'Video 1'、'Audio 1' などで参照します。
</ParamField>

<ParamField body="input.reference_video_urls" type="string[]">
  wan2.6-r2v モデル専用の参照ビデオURL。1〜3 本のビデオURLの配列。
  入力制限:

  * 形式: mp4、mov
  * 本数: 1〜3 本
  * 単一ビデオの長さ: 2〜30 秒
  * 単一ファイルサイズ: 最大 30MB
  * audio\_url とは併用不可
    参照再生時間: 単一ビデオは最大 5 秒、2 本の場合は各最大 2.5 秒、3 本の場合は比例して短くなります。
    課金: 実際に使用した参照再生時間に基づきます。
</ParamField>

<ParamField body="input.template" type="string">
  ビデオエフェクトテンプレート名。任意。現在サポートされているもの: squish、flying、carousel。使用すると prompt パラメータは無視されます。
</ParamField>

<ParamField body="model" type="string">
  呼び出すモデルのID。このコンポーネントでは制約されません: Comfy Router が `POST /v2/models/wan/{model}` の `{model}` パスセグメントから設定するため、Router の呼び出し元は省略します。`POST /proxy/wan/api/v1/services/aigc/video-generation/video-synthesis` への直接の v1 呼び出しでは必ず指定する必要があり、受け付けられる表記の enum はそのオペレーション自身のコンポーネント `WanVideoGenerationRequest` にあります。
</ParamField>

<ParamField body="parameters" type="object">
  ビデオ処理パラメータ
</ParamField>

<ParamField body="parameters.audio" type="boolean" default="true">
  ビデオにオーディオを追加するかどうか
</ParamField>

<ParamField body="parameters.audio_setting" type="string" default="&#x22;auto&#x22;">
  wan2.7-videoedit モデル用のビデオオーディオ設定。

  * auto (デフォルト): モデルがプロンプトの内容に基づいてインテリジェントに判断します
  * origin: 入力ビデオのオリジナルオーディオを強制的に保持します

    指定可能な値: `auto`、`origin`
</ParamField>

<ParamField body="parameters.duration" type="integer" default="5">
  生成されるビデオの再生時間 (秒):

  * wan2.5 モデル: 5 または 10 秒
  * wan2.6-t2v、wan2.6-i2v: 5、10、または 15 秒
  * wan2.6-r2v: 5 または 10 秒のみ (15 秒には非対応)
  * wan2.7-i2v、wan2.7-t2v: \[2, 15] の整数
  * wan2.7-r2v、wan2.7-videoedit: \[2, 10] の整数
  * wan3.0-video: ビデオ入力なしの場合は \[2, 30] の整数。ビデオ入力がある場合は、
    入力ビデオの合計再生時間 + 出力ビデオの再生時間が 30 秒を超えてはなりません。-1 は
    モデルが適切な再生時間を選択するスマート再生時間モードを有効にします

    範囲: `-1` 〜 `30`
</ParamField>

<ParamField body="parameters.prompt_extend" type="boolean" default="true">
  プロンプトのインテリジェントな書き換えを有効にするかどうか。デフォルトは true
</ParamField>

<ParamField body="parameters.ratio" type="string">
  生成されるビデオのアスペクト比。wan2.7 および wan3.0 モデル専用です。
  wan2.7 モデルでは、指定しない場合は解像度ティアに基づいてデフォルトが決まります。
  wan3.0-video では、adaptive (デフォルト) が入力メディアの比率と意図に基づいて
  適切なアスペクト比を自動的に推奨します。

  指定可能な値: `adaptive`、`16:9`、`9:16`、`1:1`、`4:3`、`3:4`
</ParamField>

<ParamField body="parameters.resolution" type="string">
  解像度レベル。サポートされる値はモデルによって異なります:

  * wan2.5-i2v-preview: 480P、720P、1080P
  * wan2.6-i2v: 720P、1080P のみ (480P 非対応)
  * wan2.7 モデル (i2v、t2v、r2v、videoedit): 720P、1080P (デフォルト 1080P)
  * wan3.0-video、wan3.0-video-prime: 480P、720P、1080P (上流のデフォルトは 1080P)
    このプロキシは resolution も size も指定しないビデオ生成リクエストを拒否します。
    解像度ティアが課金レートを決定するためです。

    指定可能な値: `480P`、`720P`、`1080P`
</ParamField>

<ParamField body="parameters.seed" type="integer">
  乱数シード。モデルが生成するコンテンツのランダム性を制御するために使用します

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

<ParamField body="parameters.shot_type" type="string" default="&#x22;single&#x22;">
  インテリジェントなマルチレンズ制御。prompt\_extend が有効な場合にのみ機能します。
  wan2.6 および wan2.7-r2v モデル用。

  * single: 単一ショットビデオ（デフォルト）
  * multi: マルチショットビデオ

    指定可能な値: `multi`、`single`
</ParamField>

<ParamField body="parameters.size" type="string">
  幅*高さ形式のビデオ解像度。対応する解像度はモデルによって異なります:
  wan2.5 T2V の場合: 480P（480*832、832*480、624*624）、720P、1080P の各サイズ
  wan2.6 T2V/R2V の場合（480P なし）:
  720P: 1280*720、720*1280、960*960、1088*832、832*1088
  1080P: 1920*1080、1080*1920、1440*1440、1632*1248、1248*1632
</ParamField>

<ParamField body="parameters.watermark" type="boolean" default="false">
  透かしロゴを追加するかどうか。透かしは右下隅に配置されます
</ParamField>

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

### 出力

<ResponseField name="output" type="object" required />

<ResponseField name="output.actual_prompt" type="string">
  インテリジェントな書き換え後の実際のプロンプト (ビデオタスク用)
</ResponseField>

<ResponseField name="output.check_audio" type="string">
  オーディオ生成を伴う I2V タスク用のオーディオ URL
</ResponseField>

<ResponseField name="output.code" type="string">
  失敗したリクエストのエラーコード (リクエストが成功した場合は返されません)
</ResponseField>

<ResponseField name="output.end_time" type="string">
  タスク完了時間
</ResponseField>

<ResponseField name="output.message" type="string">
  失敗したリクエストの詳細情報 (リクエストが成功した場合は返されません)
</ResponseField>

<ResponseField name="output.orig_prompt" type="string">
  オリジナルの入力プロンプト (ビデオタスク用)
</ResponseField>

<ResponseField name="output.results" type="object[]">
  画像生成タスクのタスク結果のリスト
</ResponseField>

<ResponseField name="output.results[].actual_prompt" type="string">
  インテリジェントな書き換え後の実際のプロンプト (有効な場合)
</ResponseField>

<ResponseField name="output.results[].code" type="string">
  画像のエラーコード (一部のタスクが失敗した場合に返されます)
</ResponseField>

<ResponseField name="output.results[].message" type="string">
  画像のエラー情報 (一部のタスクが失敗した場合に返されます)
</ResponseField>

<ResponseField name="output.results[].orig_prompt" type="string">
  オリジナルの入力プロンプト
</ResponseField>

<ResponseField name="output.results[].url" type="string">
  生成済み画像の URL アドレス
</ResponseField>

<ResponseField name="output.scheduled_time" type="string">
  タスク実行時間
</ResponseField>

<ResponseField name="output.submit_time" type="string">
  タスク送信時間
</ResponseField>

<ResponseField name="output.task_id" type="string" required>
  タスク ID
</ResponseField>

<ResponseField name="output.task_metrics" type="object">
  画像生成タスクのタスク結果の統計
</ResponseField>

<ResponseField name="output.task_metrics.FAILED" type="integer">
  失敗したタスクの数
</ResponseField>

<ResponseField name="output.task_metrics.SUCCEEDED" type="integer">
  成功したタスクの数
</ResponseField>

<ResponseField name="output.task_metrics.TOTAL" type="integer">
  タスクの総数
</ResponseField>

<ResponseField name="output.task_status" type="string" required>
  タスクのステータス

  指定可能な値: `PENDING`、`RUNNING`、`SUCCEEDED`、`FAILED`、`CANCELED`、`UNKNOWN`
</ResponseField>

<ResponseField name="output.video_url" type="string">
  完了したビデオ生成タスクのビデオ URL。リンクの有効期間は 24 時間
</ResponseField>

<ResponseField name="request_id" type="string" required>
  一意のリクエスト識別子
</ResponseField>

<ResponseField name="usage" type="object">
  出力情報の統計。成功した結果のみがカウントされます
</ResponseField>

<ResponseField name="usage.SR" type="integer">
  ビデオの解像度レベル (I2V および wan3.0-video タスク)
</ResponseField>

<ResponseField name="usage.duration" type="number">
  生成されたビデオの再生時間 (秒) (I2V および wan3.0-video タスク)
</ResponseField>

<ResponseField name="usage.fps" type="integer">
  生成されたビデオのフレームレート (wan3.0-video タスク)
</ResponseField>

<ResponseField name="usage.image_count" type="integer">
  生成された画像の数 (T2I および I2I タスク)
</ResponseField>

<ResponseField name="usage.input_video_duration" type="number">
  入力ビデオの再生時間 (秒)、ビデオ入力がない場合は 0.0 (wan3.0-video タスク)
</ResponseField>

<ResponseField name="usage.output_video_duration" type="number">
  出力ビデオの再生時間 (秒) (wan3.0-video タスク)
</ResponseField>

<ResponseField name="usage.ratio" type="string">
  生成されたビデオのアスペクト比 (例: 16:9) (wan3.0-video タスク)
</ResponseField>

<ResponseField name="usage.size" type="string">
  画像の解像度 (T2I および I2I タスク)
</ResponseField>

<ResponseField name="usage.video_count" type="integer">
  生成されたビデオの数 (T2V タスク)
</ResponseField>

<ResponseField name="usage.video_duration" type="number">
  生成されたビデオの再生時間 (秒) (T2V タスク)
</ResponseField>

<ResponseField name="usage.video_ratio" type="string">
  ビデオの解像度比率 (T2V タスク)
</ResponseField>

<ResponseField name="code" type="string">
  失敗したリクエストのエラーコード。`output` の下ではなく、エンベロープのルートで報告されます (リクエストが成功した場合は返されません)。
</ResponseField>

<ResponseField name="message" type="string">
  失敗したリクエストの詳細情報。`output` の下ではなく、エンベロープのルートで報告されます (リクエストが成功した場合は返されません)。`output.message` にフォールバックする前に、こちらを確認してください。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "input": {
    "prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
    "img_url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/pink_robot_front.png"
  },
  "parameters": {
    "resolution": "720P",
    "duration": 5
  }
}
```

### 出力

```json theme={null}
{
  "output": {
    "task_id": "0385dc79-5ff8-4d82-bcb6-7c1a9f2e4d60",
    "task_status": "SUCCEEDED",
    "submit_time": "2027-01-01T00:00:00.000Z",
    "scheduled_time": "2027-01-01T00:00:01.000Z",
    "end_time": "2027-01-01T00:01:04.000Z",
    "orig_prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady",
    "actual_prompt": "the robot lowers its raised arm and steps toward the camera, the flat orange backdrop holds steady, smooth studio lighting, subtle camera push in",
    "video_url": "https://.../generated.mp4"
  },
  "request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51",
  "usage": {
    "SR": 720,
    "duration": 5
  }
}
```

ビデオ URL は 24 時間有効です。保持する必要がある場合は、速やかにビデオをダウンロードしてください。

## 出荷前の確認

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>
