> ## 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 で Rigging を使用する

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

`meshy/rigging` の API リファレンス。Meshy から Comfy Router によって提供されます。

## クイックスタート

[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:** `meshy/rigging`

**エンドポイント:** `POST https://api.comfy.org/v2/models/meshy/rigging`

<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(
              "meshy/rigging",
              {
                  "height_meters": 1.8,
                  "input_task_id": "0193abcd-0000-0000-0000-000000000000",
              },
          )

      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("meshy/rigging", {
        height_meters: 1.8,
        input_task_id: "0193abcd-0000-0000-0000-000000000000",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/meshy/rigging \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"height_meters\": 1.8, \"input_task_id\": \"0193abcd-0000-0000-0000-000000000000\"}"
      ```
    </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(
              "meshy/rigging",
              {
                  "height_meters": 1.8,
                  "input_task_id": "0193abcd-0000-0000-0000-000000000000",
              },
          )
          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("meshy/rigging", {
        height_meters: 1.8,
        input_task_id: "0193abcd-0000-0000-0000-000000000000",
      });
      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/meshy/rigging/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"height_meters\": 1.8, \"input_task_id\": \"0193abcd-0000-0000-0000-000000000000\"}"

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

## スキーマ

### 入力

<ParamField body="height_meters" type="number" default="1.7">
  キャラクターモデルのおおよその高さ（メートル単位）。正の数である必要があります。

  範囲: `0` ～ `…`
</ParamField>

<ParamField body="input_task_id" type="string">
  リギングが必要な入力タスク。model\_url が指定されていない場合は必須です。
</ParamField>

<ParamField body="model_url" type="string">
  テクスチャ付きのヒューマノイド GLB ファイルへの公開アクセス可能な URL または Data URI。input\_task\_id が指定されていない場合は必須です。
</ParamField>

<ParamField body="texture_image_url" type="string">
  モデルの UV 展開済みベースカラーテクスチャ画像。公開アクセス可能な URL または Data URI。.png 形式に対応しています。
</ParamField>

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

### 出力

<ResponseField name="created_at" type="integer">
  タスクが作成された時刻のタイムスタンプ（ミリ秒単位）。

  形式: `int64`
</ResponseField>

<ResponseField name="expires_at" type="integer">
  タスク結果が期限切れになる時刻のタイムスタンプ（ミリ秒単位）。

  形式: `int64`
</ResponseField>

<ResponseField name="finished_at" type="integer">
  タスクが完了した時刻のタイムスタンプ（ミリ秒単位）。未完了の場合は 0。

  形式: `int64`
</ResponseField>

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

<ResponseField name="preceding_tasks" type="integer">
  先行するタスクの数。ステータスが PENDING の場合のみ意味を持ちます。
</ResponseField>

<ResponseField name="progress" type="integer">
  タスクの進捗状況 (0～100)。未開始の場合は 0、成功した場合は 100。

  範囲: `0` ～ `100`
</ResponseField>

<ResponseField name="result" type="object">
  タスクが SUCCEEDED の場合、出力アセットの URL を含みます。
</ResponseField>

<ResponseField name="result.basic_animations" type="object">
  デフォルトのアニメーションの URL を含みます。
</ResponseField>

<ResponseField name="result.basic_animations.running_armature_glb_url" type="string">
  ランニングアニメーションのアーマチュアを GLB 形式でダウンロードするための URL。
</ResponseField>

<ResponseField name="result.basic_animations.running_fbx_url" type="string">
  ランニングアニメーションを FBX 形式でダウンロードするための URL（スキン付き）。
</ResponseField>

<ResponseField name="result.basic_animations.running_glb_url" type="string">
  ランニングアニメーションを GLB 形式でダウンロードするための URL（スキン付き）。
</ResponseField>

<ResponseField name="result.basic_animations.walking_armature_glb_url" type="string">
  ウォーキングアニメーションのアーマチュアを GLB 形式でダウンロードするための URL。
</ResponseField>

<ResponseField name="result.basic_animations.walking_fbx_url" type="string">
  ウォーキングアニメーションを FBX 形式でダウンロードするための URL（スキン付き）。
</ResponseField>

<ResponseField name="result.basic_animations.walking_glb_url" type="string">
  ウォーキングアニメーションを GLB 形式でダウンロードするための URL（スキン付き）。
</ResponseField>

<ResponseField name="result.rigged_character_fbx_url" type="string">
  リギング済みキャラクターを FBX 形式でダウンロードするための URL。
</ResponseField>

<ResponseField name="result.rigged_character_glb_url" type="string">
  リギング済みキャラクターを GLB 形式でダウンロードするための URL。
</ResponseField>

<ResponseField name="started_at" type="integer">
  タスクが開始された時刻のタイムスタンプ（ミリ秒単位）。未開始の場合は 0。

  形式: `int64`
</ResponseField>

<ResponseField name="status" type="string" required>
  有効な値: `SUCCEEDED`
</ResponseField>

<ResponseField name="task_error" type="object">
  タスクが失敗した場合にエラーメッセージを含むエラーオブジェクト。
</ResponseField>

<ResponseField name="task_error.message" type="string">
  詳細なエラーメッセージ。
</ResponseField>

<ResponseField name="type" type="string">
  リギングタスクのタイプ。

  有効な値: `rig`
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "height_meters": 1.8,
  "input_task_id": "0193abcd-0000-0000-0000-000000000000"
}
```

### 出力

```json theme={null}
{
  "created_at": 1767225600000,
  "expires_at": 1767830400000,
  "finished_at": 1767225712000,
  "id": "018f2c7a-4b1e-7c3d-9a05-6e2f8b41d0c9",
  "progress": 100,
  "result": {
    "basic_animations": {
      "running_glb_url": "https://example.invalid/meshy/rigging/running.glb",
      "walking_glb_url": "https://example.invalid/meshy/rigging/walking.glb"
    },
    "rigged_character_fbx_url": "https://example.invalid/meshy/rigging/character.fbx",
    "rigged_character_glb_url": "https://example.invalid/meshy/rigging/character.glb"
  },
  "started_at": 1767225601000,
  "status": "SUCCEEDED",
  "type": "rig"
}
```

## 出荷前の確認

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>
