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

# Higgsfield Genjutsu Motion Transfer V1.0 を Comfy Router で使用する

> Comfy Router 経由で higgsfield/higgsfield-genjutsu-motion-transfer-v1.0 を呼び出します。エンドポイント、リクエストの形状、Router が返すレスポンスについて説明します。

`higgsfield/higgsfield-genjutsu-motion-transfer-v1.0` の API リファレンスです。Comfy Router が Higgsfield から提供しています。

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

## クイックスタート

[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:** `higgsfield/higgsfield-genjutsu-motion-transfer-v1.0`

**エンドポイント:** `POST https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0`

<Tabs defaultTabIndex={1}>
  <Tab title="結果を待つ">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # 環境変数から COMFY_API_KEY を読み取ります。
      # SDK は自動的に冪等性キーを作成し、自動リトライのために再利用します。
      with Comfy() as client:
          result = client.models.run(
              "higgsfield/higgsfield-genjutsu-motion-transfer-v1.0",
              {
                  "image_urls": ["https://cdn.example.com/character.jpg"],
                  "prompt": "Keep the camera move and recast the dancer as the character in the reference image",
                  "resolution": "720p",
                  "video_url": "https://cdn.example.com/source.mp4",
              },
          )

      print(result)
      ```

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

      // 環境変数から COMFY_API_KEY を読み取ります。
      // SDK は自動的に冪等性キーを作成し、自動リトライのために再利用します。
      const { data } = await comfy.models.run("higgsfield/higgsfield-genjutsu-motion-transfer-v1.0", {
        image_urls: ["https://cdn.example.com/character.jpg"],
        prompt: "Keep the camera move and recast the dancer as the character in the reference image",
        resolution: "720p",
        video_url: "https://cdn.example.com/source.mp4",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"image_urls\": [\"https://cdn.example.com/character.jpg\"], \"prompt\": \"Keep the camera move and recast the dancer as the character in the reference image\", \"resolution\": \"720p\", \"video_url\": \"https://cdn.example.com/source.mp4\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="キューに送信して後で取得する">
    同じボディを `POST https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests` に送信します。Router は実行が受け付けられるとすぐに `201` と `request_id` を返し、結果は準備ができ次第、このプロセスからでも別のプロセスからでも取得できます。[キューの配信](/ja/development/comfy-router/queue)では、ステータス、キャンセル、取得の流れを説明しています。

    <CodeGroup>
      ```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(
                  "higgsfield/higgsfield-genjutsu-motion-transfer-v1.0",
                  {
                      "image_urls": ["https://cdn.example.com/character.jpg"],
                      "prompt": "Keep the camera move and recast the dancer as the character in the reference image",
                      "resolution": "720p",
                      "video_url": "https://cdn.example.com/source.mp4",
                  },
              )
              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("higgsfield/higgsfield-genjutsu-motion-transfer-v1.0", {
        image_urls: ["https://cdn.example.com/character.jpg"],
        prompt: "Keep the camera move and recast the dancer as the character in the reference image",
        resolution: "720p",
        video_url: "https://cdn.example.com/source.mp4",
      });
      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 は 201 とともに request_id、status_url、response_url、cancel_url を返します。
      curl https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"image_urls\": [\"https://cdn.example.com/character.jpg\"], \"prompt\": \"Keep the camera move and recast the dancer as the character in the reference image\", \"resolution\": \"720p\", \"video_url\": \"https://cdn.example.com/source.mp4\"}"

      # 2. ステータスが COMPLETED になるまでポーリングし、各レスポンスが示す Retry-After の秒数だけ待機します。
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. 取得。完了時はモデルのネイティブ出力とともに 200、実行中はステータスボディとともに 202 を返します。
      curl https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="image_urls" type="string[]" required>
  キャスト、ロケーション、スタイル用の1～8枚の参照画像の URL。
</ParamField>

<ParamField body="prompt" type="string">
  キャスト変更のための任意のガイダンス。
</ParamField>

<ParamField body="resolution" type="string" default="&#x22;720p&#x22;">
  出力解像度: 480p、720p、1080p。
</ParamField>

<ParamField body="video_url" type="string" required>
  モーション、カメラ、タイミングを保持するソースビデオの URL。最低4秒。これより長いビデオは30秒にトリミングされます。
</ParamField>

これは、Router が `GET /v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/openapi.json` で提供しているスキーマから生成されたもので、リクエストがプロバイダーに到達する前に Router が呼び出しを検証する際に照合するドキュメントと同じです。

### 出力

<ResponseField name="cancel_url" type="string">
  処理が開始される前にリクエストをキャンセルするために使用される絶対 URL。
</ResponseField>

<ResponseField name="error" type="string">
  失敗の詳細。`status` が `failed` の場合に設定されます。
</ResponseField>

<ResponseField name="request_id" type="string" required>
  ポーリング、キャンセル、サポートに使用される安定した識別子。
</ResponseField>

<ResponseField name="status" type="string" required>
  現在のリクエスト状態。

  指定可能な値: `queued`, `in_progress`, `nsfw`, `failed`, `completed`, `canceled`
</ResponseField>

<ResponseField name="status_url" type="string">
  リクエストがターミナル状態に達するまでポーリングするための絶対 URL。
</ResponseField>

<ResponseField name="video" type="object">
  Higgsfield のメディア出力1件。
</ResponseField>

<ResponseField name="video.url" type="string" required>
  生成済みメディアのダウンロード URL。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "image_urls": [
    "https://cdn.example.com/character.jpg"
  ],
  "prompt": "Keep the camera move and recast the dancer as the character in the reference image",
  "resolution": "720p",
  "video_url": "https://cdn.example.com/source.mp4"
}
```

### 出力

```json theme={null}
{
  "cancel_url": "https://api.higgsfield.ai/requests/2e9b7c44-81d3-4f0a-a6e5-3b9d0c71f5a8/cancel",
  "request_id": "2e9b7c44-81d3-4f0a-a6e5-3b9d0c71f5a8",
  "status": "completed",
  "status_url": "https://api.higgsfield.ai/requests/2e9b7c44-81d3-4f0a-a6e5-3b9d0c71f5a8/status",
  "video": {
    "url": "https://example.invalid/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/generated.mp4"
  }
}
```

## 出荷前の確認

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) を参照してください。

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

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

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


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