> ## 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 使用 Meshy 6

> 通过 Comfy Router 调用 meshy/meshy-6：端点、请求结构以及 Router 返回的响应。

`meshy/meshy-6` 的 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-6`

**端点：** `POST https://api.comfy.org/v2/models/meshy/meshy-6`

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

<h2 id="schema">
  模式
</h2>

### 输入

#### `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`
</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">
  控制是否启用重网格化阶段。当为 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>
  对应的预览任务 ID。给定预览任务的状态必须为 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-6/openapi.json` 提供的 schema 生成，这与它在请求到达提供商之前用于验证调用的文档相同。

### 输出

<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">
  前序任务的数量。仅当状态为 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` 并在自动重试中复用它。手动重试时，请复用原始 key。Router 最长可保持连接 10 分钟。

请求失败时，Router 会发送 `X-Comfy-Error-Type` 响应头说明原因。`422` 表示 Router 在调用提供商之前就拒绝了输入。生成的资源请及时下载，因为[结果链接会过期](/zh/development/comfy-router/reference#结果资产)。

<CardGroup cols={3}>
  <Card title="请求头" icon="list" href="/zh/development/comfy-router/quickstart">
    身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
  </Card>

  <Card title="使用 Router API" icon="code" href="/zh/development/comfy-router/quickstart">
    模型发现、校验错误、重试与计费。
  </Card>

  <Card title="限制" icon="triangle-exclamation" href="/zh/development/comfy-router/limitations">
    Router 目前不支持的功能，以及替代方案。
  </Card>
</CardGroup>
