Auto Split API

将 3D 模型拆分为可分别打印的多个部件——可自动拆分,也可按你指定的部件名称或按颜色区域拆分——并可选择添加连接件;切割后留下的薄弱区域会始终得到加固,确保每个部件都能实心打印。


POST/openapi/v1/print/split

创建 Auto Split 任务

此 endpoint 用于创建一个新的 Auto Split 任务。该任务会将先前任务生成的模型切割为可分别打印的多个部件,并返回切分后的模型,其中每个部件都是文件中的独立对象。

参数

  • Name
    input_task_id
    Type
    string
    必选
    Description

    要拆分其模型的成功任务的 ID。支持的任务类型:Image to 3DMulti-Image to 3DText to 3D(预览版)、RemeshConvert 以及 Resize。该任务的状态必须为 SUCCEEDED,且其模型必须由 Meshy 6 或 Meshy 7 生成(ai_modelmeshy-6meshy-7latest)。不支持 low-poly 和 Smart Topology(meshy-t2)模型。

  • Name
    mode
    Type
    string
    默认值 auto
    Description

    模型如何被划分为多个部件。

    可选值:

    • auto:由 Meshy 自行选择切割方式,prompt 会被忽略。
    • by_parts:沿着你在 prompt 中指定的结构部件进行切割,例如头部、手臂和躯干。
    • by_color:沿着你在 prompt 中指定的颜色区域进行切割。需要输入内容由已上传图片生成(Image to 3DMulti-Image to 3D);其他输入会被拒绝并返回 400
仅当 mode = by_parts or by_color
  • Name
    prompt
    Type
    string
    必选
    Description

    描述要拆分成的部件,可使用任意语言。Meshy 会从中读取 1 到 10 个部件名称,因此请直接命名各个部件而不是描述整个模型——例如 split into the figure and the base,或 head, torso, left arm, right arm, legs。最多 600 个字符。有两种失败情形:如果描述看起来是要拆分,但命名的部件少于两个(例如 split into individual parts),会被拒绝并返回 400,且不会计费;如果 Meshy 完全无法理解该描述,则会回退为 auto,任务仍会运行并计费,其响应中会带有 prompt_ignored: true

  • Name
    target_formats
    Type
    array
    默认值 ["glb"]
    Description

    要导出的拆分模型格式。在每种格式中,每个部件都是一个独立对象。系统始终会生成 glb 格式并在 model_urls 中返回;如需其他格式,请在此列出。

    可选值:glbobjfbxusdzblend3mf

  • Name
    layout
    Type
    string
    默认值 assembled
    Description

    各部件在每种输出格式以及 thumbnail 中的排布方式。

    可选值:

    • assembled:部件保持在原始模型中的位置。
    • on_plate:部件被平铺展开摆放在打印平台上,可直接用于切片——与 Web App 中的 On Plate 视图排布方式相同。

    在这两种布局中,导出的文件里每个部件都是一个对象,且仅包含这些对象:切割后残留的塌陷薄片或类似点状的碎片会在导出前被移除,因此文件中出现的每个对象都是可打印的。

  • Name
    connectors
    Type
    boolean
    默认值 false
    Description

    在每个切割处添加榫卯连接件,使打印出的部件能够拼合在一起。

仅当 connectors = true
  • Name
    connector_type
    Type
    string
    默认值 cube
    Description

    每个切割面上连接件的形状。

    可选值:cubecylinder

  • Name
    connector_size
    Type
    number
    默认值 0.5
    Description

    连接件相对于切割面的大小。

    有效范围:0.10.8

  • Name
    connector_height
    Type
    number
    默认值 0.1
    Description

    连接件相对于切割面向外延伸的距离比例。

    有效范围:0.10.8

返回值

响应的 result 属性包含新创建的 Auto Split 任务的 id

失败情形

  • Name
    400 - Bad Request
    Description

    请求无法被接受。常见原因包括:

    • 缺少 prompt:当 modeby_partsby_color 时,必须提供 prompt
    • prompt 命名的部件少于两个by_parts / by_color 至少需要命名两个部件(例如 head, torso, base);诸如 split into individual parts 这类泛泛的指令会被拒绝。此情况不会计费。
    • 不受支持的输入任务input_task_id 必须指向一个由 Meshy 6 或 Meshy 7 生成的、类型受支持的成功任务。
    • 输入带有贴图:输入模型带有 texture。目前仅支持不带 texture 的模型。
    • 缺少参考图片by_color 需要输入内容由已上传图片生成。
    • 不受支持的格式target_formats 中包含 stl
    • 连接件参数超出范围connector_sizeconnector_height 超出 0.10.8 的范围。
  • Name
    401 - Unauthorized
    Description

    身份验证失败,请检查你的 API key。

  • Name
    402 - Payment Required
    Description

    credits 不足,无法执行此任务。

  • Name
    404 - Not Found
    Description

    input_task_id 不存在,或不属于你的账户。

  • Name
    429 - Too Many Requests
    Description

    你已超出速率限制。by_partsby_color 请求还共用一个 prompt 解析限制:每个账户每分钟最多 12 次请求。

  • Name
    503 - Service Unavailable
    Description

    基于 prompt 的拆分方式(by_partsby_color)暂时不可用。请稍后重试,或使用不受影响的 mode: "auto"。此情况不会计费。

Request

POST
/openapi/v1/print/split
# Simple request: let Meshy choose the cuts
curl https://api.meshy.cn/openapi/v1/print/split \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
  }'

# Advanced request: name the parts, add connectors, export glb and obj
curl https://api.meshy.cn/openapi/v1/print/split \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "mode": "by_parts",
    "prompt": "split into the figure and the base",
    "target_formats": ["glb", "obj"],
    "layout": "on_plate",
    "connectors": true,
    "connector_type": "cylinder",
    "connector_size": 0.4
  }'

Response

{
  "result": "0193bfc5-ee4f-73f8-8525-44b398884ce9"
}

GET/openapi/v1/print/split/:id

获取 Auto Split 任务

此 endpoint 用于根据 ID 获取 Auto Split 任务。

参数

  • Name
    id
    Type
    path
    Description

    要获取的 Auto Split 任务的 ID。

返回值

Auto Split 任务对象。

Request

GET
/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f
curl https://api.meshy.cn/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response

{
  "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  "type": "print-split",
  "model_urls": {
    "glb": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***",
  "part_count": 4,
  "progress": 100,
  "status": "SUCCEEDED",
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000082000,
  "task_error": null,
  "consumed_credits": 10
}

DELETE/openapi/v1/print/split/:id

删除一个 Auto Split 任务

此 endpoint 将永久删除一个 Auto Split 任务,包括所有相关的模型和数据。此操作不可撤销。

路径参数

  • Name
    id
    Type
    path
    Description

    要删除的 Auto Split 任务的 ID。

返回值

成功时返回 200 OK

Request

DELETE
/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f
curl --request DELETE \
  --url https://api.meshy.cn/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

// Returns 200 Ok on success.

GET/openapi/v1/print/split

List Auto Split Tasks

此 endpoint 允许您检索 Auto Split 任务列表。

参数

可选属性

  • Name
    page_num
    Type
    integer
    Description

    用于分页的页码。起始值和默认值均为 1

  • Name
    page_size
    Type
    integer
    Description

    每页数量限制。默认为 10 项。最大允许 100 项;超出的值将被限制为 100

  • Name
    sort_by
    Type
    string
    Description

    用于排序的字段。可用值:

    • +created_at:按创建时间升序排序。
    • -created_at:按创建时间降序排序。

返回值

返回一个分页的 Auto Split 任务对象 列表。

Request

GET
/openapi/v1/print/split
curl https://api.meshy.cn/openapi/v1/print/split?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response

[
  {
    "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
    "type": "print-split",
    "model_urls": {
      "glb": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***"
    },
    "thumbnail_url": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***",
    "part_count": 4,
    "progress": 100,
    "status": "SUCCEEDED",
    "preceding_tasks": 0,
    "created_at": 1699999999000,
    "started_at": 1700000000000,
    "finished_at": 1700000082000,
    "task_error": null,
    "consumed_credits": 10
  }
]

GET/openapi/v1/print/split/:id/stream

流式获取 Auto Split 任务

此 endpoint 使用 Server-Sent Events(SSE)流式传输 Auto Split 任务的实时更新。

参数

  • Name
    id
    Type
    path
    Description

    要进行流式传输的 Auto Split 任务的唯一标识符。

返回值

以 Server-Sent Events 的形式返回一个 Auto Split 任务对象 的流。

每个 message 事件都携带由 获取 Auto Split 任务 返回的完整任务对象,包括 consumed_credits、时间戳以及 prompt_ignored;当任务处于 PENDINGIN_PROGRESS 状态时,帧与帧之间发生变化的字段是 progressstatusstarted_atpreceding_tasks,而 model_urlsthumbnail_urlpart_countparts 会在任务到达 SUCCEEDED 状态后出现。error 事件仅携带 status_codemessage,因此在读取 status 之前应先根据事件名称进行分支处理。

Request

GET
/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream
curl -N https://api.meshy.cn/openapi/v1/print/split/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response Stream

// Error event example
event: error
data: {
  "status_code": 404,
  "message": "Task not found"
}

// Message event examples illustrate task progress (other task fields omitted here for brevity;
// each frame is the full task object).
event: message
data: {
  "id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
  "type": "print-split",
  "model_urls": {
    "glb": "https://assets.meshy.cn/***/tasks/a43b5c6d-7e8f-901a-234b-567c890d1e2f/output/model.glb?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.cn/***/tasks/a43b5c6d-7e8f-901a-234b-567c890d1e2f/output/preview.png?Expires=***",
  "part_count": 4,
  "progress": 100,
  "status": "SUCCEEDED",
  "preceding_tasks": 0,
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000082000,
  "task_error": null,
  "consumed_credits": 10
}

Auto Split 任务对象

Auto Split 任务只包含以下属性。其他任务对象所包含的生成提示词字段(nameobject_prompttexture_prompt 等)、单一的 model_url,以及 texture_urls,在拆分任务中都不会被填充,也不会返回。随任务运行而逐步填充的属性(thumbnail_urlmodel_urls、时间戳)则始终存在,在有值之前为空,因此键的集合在 PENDINGSUCCEEDED 之间不会发生变化。

  • Name
    id
    Type
    string
    Description

    任务的唯一标识符。虽然我们在实现细节上使用 k-sortable UUID 作为任务 id,但你不应该对 id 的格式做任何假设。

  • Name
    type
    Type
    string
    Description

    任务的类型。此值为 print-split

  • Name
    model_urls
    Type
    object
    Description

    拆分模型的可下载 URL,每种请求的格式对应一个。文件中的每个部件都是一个独立的对象。如果未请求某种格式,则该格式对应的属性将被省略。

    • Name
      glb
      Type
      string
      Description

      GLB 格式的拆分模型可下载 URL。

    • Name
      obj
      Type
      string
      Description

      OBJ 格式的拆分模型可下载 URL。

    • Name
      fbx
      Type
      string
      Description

      FBX 格式的拆分模型可下载 URL。

    • Name
      usdz
      Type
      string
      Description

      USDZ 格式的拆分模型可下载 URL。

    • Name
      blend
      Type
      string
      Description

      Blender 格式的拆分模型可下载 URL。

    • Name
      3mf
      Type
      string
      Description

      3MF 格式的拆分模型可下载 URL。

  • Name
    thumbnail_url
    Type
    string
    Description

    拆分模型渲染预览图的可下载 URL,其中每个部件以不同颜色显示,按所请求的 layout 排列。

  • Name
    prompt_ignored
    Type
    boolean
    Description

    by_partsby_color 请求的 prompt 未指定任何部件名称时,此值为 true,表示 Meshy 转而自动拆分了模型——结果中的部件名称是 Meshy 生成的,而非你提供的。从 PENDING 状态起即存在。对于 auto 任务,以及提示词被正确遵循的情况下,此字段会被省略。

  • Name
    part_count
    Type
    integer
    Description

    拆分模型中可打印部件的数量——导出文件中每个对象对应一个部件。分割过程中无法转换为可打印部件的坍缩碎片会在导出前从文件中移除,不计入此数量。

  • Name
    progress
    Type
    integer
    Description

    任务的进度。如果任务尚未开始,此属性为 0。一旦任务成功完成,此属性将变为 100

  • Name
    status
    Type
    string
    Description

    任务的状态。可能的值为 PENDINGIN_PROGRESSSUCCEEDEDFAILEDCANCELED 之一。

  • Name
    preceding_tasks
    Type
    integer
    Description

    排在此任务之前的任务数量。

  • Name
    created_at
    Type
    timestamp
    Description

    任务创建时的时间戳,单位为毫秒。

  • Name
    started_at
    Type
    timestamp
    Description

    任务开始时的时间戳,单位为毫秒。如果任务尚未开始,此属性为 0

  • Name
    finished_at
    Type
    timestamp
    Description

    任务完成时的时间戳,单位为毫秒。如果任务尚未完成,此属性为 0

  • Name
    task_error
    Type
    object
    Description

    失败任务的错误详情。完整的 task_error 对象参考请参见 Errors

  • Name
    consumed_credits
    Type
    integer
    Description

    此任务消耗的 credits 数量。此属性始终存在:任务一旦被接受即为 10,而对于 FAILED 任务则为 0,因为失败时费用会被退还。在任务仍处于 PENDING 状态时删除任务,同样会退还费用。

The Auto Split Task Object

{
  "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  "type": "print-split",
  "model_urls": {
    "glb": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.cn/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***",
  "part_count": 4,
  "progress": 100,
  "status": "SUCCEEDED",
  "preceding_tasks": 0,
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000082000,
  "task_error": null,
  "consumed_credits": 10
}