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

# Meshy 7 を Comfy Router で使用する

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

`meshy/meshy-7` の API リファレンスです。Comfy Router が Meshy から提供しています。

## クイックスタート

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

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

<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/meshy-7",
              {
                  "art_style": "realistic",
                  "mode": "preview",
                  "prompt": "a red cube",
              },
          )

      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/meshy-7", {
        art_style: "realistic",
        mode: "preview",
        prompt: "a red cube",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/meshy/meshy-7 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"art_style\": \"realistic\", \"mode\": \"preview\", \"prompt\": \"a red cube\"}"
      ```
    </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/meshy-7",
              {
                  "art_style": "realistic",
                  "mode": "preview",
                  "prompt": "a red cube",
              },
          )
          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/meshy-7", {
        art_style: "realistic",
        mode: "preview",
        prompt: "a red cube",
      });
      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/meshy-7/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"art_style\": \"realistic\", \"mode\": \"preview\", \"prompt\": \"a red cube\"}"

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

## スキーマ

### 入力

#### `preview` バリアント

<ParamField body="ai_model" type="string">
  実行するMeshyモデル。Comfy Routerのルートではこれはパス（`/v2/models/meshy/{model}`）から供給され、省略するかnullとして送信できます。Routerは検証後にパスのモデルをここへ書き込みます。v1 /proxyルートではMeshyTextTo3DPreviewRequestを参照してください。これはMeshyAiModelに制約します。
</ParamField>

<ParamField body="art_style" type="string" default="&#x22;realistic&#x22;">
  オブジェクトの希望するアートスタイルを記述します。

  指定可能な値: `realistic`、`sculpture`
</ParamField>

<ParamField body="is_a_t_pose" type="boolean" default="false">
  非推奨。代わりにpose\_modeを使用してください。モデルをA/Tポーズで生成するかどうか。
</ParamField>

<ParamField body="mode" type="string" required>
  previewタスクを作成する場合、このフィールドは"preview"に設定する必要があります。

  指定可能な値: `preview`
</ParamField>

<ParamField body="moderation" type="boolean" default="false">
  trueの場合、入力コンテンツは有害な可能性のあるコンテンツについてスクリーニングされます。
</ParamField>

<ParamField body="pose_mode" type="string">
  生成されるモデルのポーズモードを指定します。

  指定可能な値: `a-pose`、`t-pose`、\`\`
</ParamField>

<ParamField body="prompt" type="string" required>
  3Dモデルがどのようなオブジェクトであるかを記述します。最大600文字。
</ParamField>

<ParamField body="should_remesh" type="boolean" default="true">
  remeshフェーズを有効にするかどうかを制御します。falseの場合、最高精度の三角形メッシュを返します。
</ParamField>

<ParamField body="symmetry_mode" type="string" default="&#x22;auto&#x22;">
  モデル生成中の対称性の挙動を制御します。

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

<ParamField body="target_polycount" type="integer" default="30000">
  生成されるモデルの目標ポリゴン数を指定します。有効範囲は100から300,000です。

  範囲: `100` から `300000`
</ParamField>

<ParamField body="topology" type="string" default="&#x22;triangle&#x22;">
  生成されるモデルのトポロジーを指定します。

  指定可能な値: `quad`、`triangle`
</ParamField>

<ParamField body="ultra_mode" type="boolean" default="false">
  より高忠実度のジオメトリと、より細かな表面ディテールのためのUltra生成を有効にします。ai\_modelがmeshy-7またはlatestの場合のみサポートされます。
</ParamField>

#### `refine` バリアント

<ParamField body="ai_model" type="string">
  実行するMeshyモデル。Comfy Routerのルートではこれはパス（`/v2/models/meshy/{model}`）から供給され、省略するかnullとして送信できます。Routerは検証後にパスのモデルをここへ書き込みます。v1 /proxyルートではMeshyTextTo3DRefineRequestを参照してください。これはMeshyAiModelに制約します。
</ParamField>

<ParamField body="enable_pbr" type="boolean" default="false">
  ベースカラーに加えてPBRマップ（メタリック、ラフネス、ノーマル）を生成します。Sculptureスタイルを使用する場合はenable\_pbrをfalseに設定する必要があることに注意してください。
</ParamField>

<ParamField body="mode" type="string" required>
  refineタスクを作成する場合、このフィールドは"refine"に設定する必要があります。

  指定可能な値: `refine`
</ParamField>

<ParamField body="moderation" type="boolean" default="false">
  trueの場合、入力コンテンツは有害な可能性のあるコンテンツについてスクリーニングされます。
</ParamField>

<ParamField body="preview_task_id" type="string" required>
  対応するpreviewタスクID。指定されたpreviewタスクのステータスはSUCCEEDEDでなければなりません。
</ParamField>

<ParamField body="texture_image_url" type="string">
  テクスチャリングプロセスを導くための2D画像を指定します。.jpg、.jpeg、.png形式、またはbase64エンコードされたデータURIをサポートします。
</ParamField>

<ParamField body="texture_prompt" type="string">
  テクスチャリングプロセスを導くための追加のテキストプロンプトを指定します。最大600文字。
</ParamField>

<ParamField body="texture_resolution" type="string" default="&#x22;2k&#x22;">
  生成されるテクスチャのテクスチャ解像度。2k、4k、8kのいずれか。4kと8kにはai\_modelがmeshy-6、meshy-7またはlatestが必要です。

  指定可能な値: `2k`、`4k`、`8k`
</ParamField>

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

### 出力

<ResponseField name="art_style" type="string">
  プレビュータスクの作成に使用された、変更されていない art\_style。
</ResponseField>

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

  形式: `int64`
</ResponseField>

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

  形式: `int64`
</ResponseField>

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

<ResponseField name="model_urls" type="object">
  Meshy によって生成されたテクスチャ付き 3Dモデルファイルのダウンロード可能な URL。
</ResponseField>

<ResponseField name="model_urls.fbx" type="string">
  FBX ファイルのダウンロード可能な URL。
</ResponseField>

<ResponseField name="model_urls.glb" type="string">
  GLB ファイルのダウンロード可能な URL。
</ResponseField>

<ResponseField name="model_urls.mtl" type="string">
  MTL ファイルのダウンロード可能な URL。
</ResponseField>

<ResponseField name="model_urls.obj" type="string">
  OBJ ファイルのダウンロード可能な URL。
</ResponseField>

<ResponseField name="model_urls.usdz" type="string">
  USDZ ファイルのダウンロード可能な URL。
</ResponseField>

<ResponseField name="negative_prompt" type="string">
  後方互換性のために維持されている非推奨のフィールド。
</ResponseField>

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

<ResponseField name="progress" type="integer">
  タスクの進捗。開始されていない場合は 0、成功した場合は 100。

  範囲: `0` から `100`
</ResponseField>

<ResponseField name="prompt" type="string">
  タスクの作成に使用された、変更されていないプロンプト。
</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="texture_image_url" type="string">
  テクスチャリング処理のガイドに使用されたテクスチャ画像のダウンロード可能な URL。
</ResponseField>

<ResponseField name="texture_prompt" type="string">
  リファイン段階でテクスチャリング処理をガイドするために提供された追加のテキストプロンプト。
</ResponseField>

<ResponseField name="texture_richness" type="string">
  後方互換性のために維持されている非推奨のフィールド。
</ResponseField>

<ResponseField name="texture_urls" type="object[]">
  タスクから生成されたテクスチャ URL オブジェクトの配列。
</ResponseField>

<ResponseField name="texture_urls[].base_color" type="string">
  ベースカラーマップ画像のダウンロード可能な URL。
</ResponseField>

<ResponseField name="texture_urls[].metallic" type="string">
  メタリックマップ画像のダウンロード可能な URL。
</ResponseField>

<ResponseField name="texture_urls[].normal" type="string">
  ノーマルマップ画像のダウンロード可能な URL。
</ResponseField>

<ResponseField name="texture_urls[].roughness" type="string">
  ラフネスマップ画像のダウンロード可能な URL。
</ResponseField>

<ResponseField name="thumbnail_url" type="string">
  モデルファイルのサムネイル画像のダウンロード可能な URL。
</ResponseField>

<ResponseField name="type" type="string">
  Text to 3D タスクの種類。

  取り得る値: `text-to-3d-preview`、`text-to-3d-refine`
</ResponseField>

<ResponseField name="video_url" type="string">
  プレビュービデオのダウンロード可能な URL を返す非推奨のフィールド。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "art_style": "realistic",
  "mode": "preview",
  "prompt": "a red cube"
}
```

### 出力

```json theme={null}
{
  "art_style": "realistic",
  "created_at": 1767225600000,
  "finished_at": 1767225719000,
  "id": "018f2c7a-4b1e-7c3d-9a05-6e2f8b41d0c9",
  "model_urls": {
    "fbx": "https://example.invalid/meshy/text-to-3d/model.fbx",
    "glb": "https://example.invalid/meshy/text-to-3d/model.glb",
    "mtl": "https://example.invalid/meshy/text-to-3d/model.mtl",
    "obj": "https://example.invalid/meshy/text-to-3d/model.obj",
    "usdz": "https://example.invalid/meshy/text-to-3d/model.usdz"
  },
  "progress": 100,
  "prompt": "a red cube",
  "started_at": 1767225601000,
  "status": "SUCCEEDED",
  "thumbnail_url": "https://example.invalid/meshy/text-to-3d/thumbnail.png",
  "type": "text-to-3d-preview"
}
```

## 出荷前の確認

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>
