meshy-5 将于 2026年10月10日 下线。 lowpoly 将于 2026年10月30日 下线。 请在这些日期前切换模型,以免请求报错。

多色打印 API

Convert 3D 模型为多色 3MF 格式以用于 3D 打印,并可配置最多 16 种颜色的调色板。


POST/openapi/v1/print/multi-color

Create a Multi-Color 3D Print Task

此 endpoint 用于创建一个新的多色 3D 打印任务。该任务会将 3D 模型转换为适合 3D 打印的多色 3MF 文件。

参数

  • Name
    model_url
    Type
    string
    必选
    Description

    公开可访问的 3D 模型 URL 或 Data URI。我们目前支持 .glb 和 .fbx 格式。

  • Name
    max_colors
    Type
    integer
    默认值 4
    Description

    输出调色板中的最大颜色数量。

    有效范围:1 到 16。

  • Name
    style
    Type
    string
    默认值 realistic
    Description

    生成的 3MF 文件的视觉颜色风格。

    可用值:

    • realistic:直接从模型的 texture 中采样颜色,以呈现精细、逼真的细节。生成的文件较大。
    • cartoon:将颜色简化为干净、统一的区域,呈现风格化的外观。生成的文件较小。

    输入必须携带颜色信息:realistic 要求每个 mesh 部分都具有单一的基础颜色 texture 以及 UV 坐标;cartoon 也接受逐顶点颜色。未添加 texture(白色)的模型将被拒绝——参见 model_missing_texture。

  • Name
    max_depth
    Type
    integer
    默认值 4
    Description

    用于将 texture 颜色采样到 mesh 上的细分深度。数值越高,可捕获的颜色细节越精细,但文件也会越大。仅适用于 realistic 风格;对 cartoon 无效。

    有效范围:3 到 6。

  • Name
    printer_brand
    Type
    string
    默认值 bambu
    Description

    写入 3MF 文件中的 slicer 预设所对应的打印机品牌,使该文件在对应品牌的 slicer 中打开时,能够匹配相应的打印机、耗材和工艺配置。每个品牌都使用其默认打印机,配备 0.4 毫米喷嘴。

    可用值:bambu、anycubic、creality、elegoo、flashforge、prusa、qidi、snapmaker、ankermake。

返回值

响应中的 result 属性包含新创建的 3D 打印任务的 id。

失败模式

  • Name
    400 - Bad Request
    Description

    请求不可接受。常见原因:

    • 缺少参数:必须提供 model_url 或 input_task_id 中的一个。
    • 模型格式无效:model_url 指向的文件扩展名不受支持(仅支持 .glb 和 .fbx)。
    • URL 无法访问:无法下载 model_url。
    • 输入任务无效:input_task_id 必须指向一个成功的任务。
    • max_colors 无效:数值必须在 1 到 16 之间。
    • style 无效:数值必须为 realistic 或 cartoon。
    • max_depth 无效:数值必须在 3 到 6 之间。
    • printer_brand 无效:数值必须是上面列出的品牌之一。
    • 没有颜色来源:输入模型没有基础颜色 texture(realistic 需要每个 mesh 部分都具有唯一一个带 UV 的 texture),也没有顶点颜色(cartoon 两者皆可接受)。请先为模型添加 texture,或者对带顶点颜色的模型使用 cartoon。.fbx 上传文件会在任务对其进行标准化处理后进行检查,如果失败,会返回 model_missing_texture 错误。
  • Name
    401 - Unauthorized
    Description

    Authentication 失败。请检查您的 API key。

  • Name
    402 - Payment Required
    Description

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

  • Name
    429 - Too Many Requests
    Description

    您已超出 速率限制。

Request

POST
/openapi/v1/print/multi-color
# Convert a 3D model to a multi-color 3MF with a Creality slicer preset
curl https://api.meshy.ai/openapi/v1/print/multi-color \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "max_colors": 8,
    "printer_brand": "creality"
  }'

Response

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

GET/openapi/v1/print/multi-color/:id

检索多色 3D 打印任务

此 endpoint 通过 ID 检索多色 3D 打印任务。

参数

  • Name
    id
    Type
    path
    Description

    要检索的 3D 打印任务的 ID。

返回值

3D 打印任务对象。

Request

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

Response

{
  "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  "type": "print-multi-color",
  "model_urls": {
      "3mf": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.3mf?Expires=***"
},
  "progress": 100,
  "status": "SUCCEEDED",
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000001000,
  "task_error": null,
"consumed_credits": 10
}

DELETE/openapi/v1/print/multi-color/:id

删除多色 3D 打印任务

此 endpoint 会永久删除一个多色 3D 打印任务,包括所有相关的模型和数据。此操作不可逆。

路径参数

  • Name
    id
    Type
    path
    Description

    要删除的多色 3D 打印任务的 ID。

任务状态

仍处于 PENDING 状态的任务将被删除,创建时所消耗的 credits 将被退还。

已处于 IN_PROGRESS 状态的任务无法被删除:该请求会被拒绝并返回 409 Conflict,任务将继续运行。已经开始由工作节点处理的任务所消耗的 credits 是不可退还的,因此在运行过程中删除该任务会让你同时损失 credits 和结果。请等待其进入 SUCCEEDED、FAILED 或 CANCELED 状态后再删除。

处于终止状态(SUCCEEDED、FAILED 或 CANCELED)的任务将被删除,且不会退还 credits。

返回值

成功时返回 200 OK;当任务处于 IN_PROGRESS 状态时返回 409 Conflict。

Request

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

Response

// 200 OK on success, with an empty body.
//
// 409 Conflict when the task is IN_PROGRESS — the task is left running:
{
  "message": "Task is IN_PROGRESS and cannot be deleted. Credits for a task the worker has already started are not refundable; wait for it to reach SUCCEEDED, FAILED or CANCELED, then delete it."
}

GET/openapi/v1/print/multi-color

获取多色 3D 打印任务列表

此 endpoint 允许你获取多色 3D 打印任务的列表。

参数

可选属性

  • Name
    page_num
    Type
    integer
    Description

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

  • Name
    page_size
    Type
    integer
    Description

    每页数量限制。默认为 10 项。最大允许 100 项。

  • Name
    sort_by
    Type
    string
    Description

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

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

返回

返回一个分页列表,包含 3D 打印任务对象。

Request

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

Response

[
  {
    "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
    "type": "print-multi-color",
    "model_urls": {
      "3mf": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.3mf?Expires=***"
    },
    "progress": 100,
    "status": "SUCCEEDED",
    "preceding_tasks": 0,
    "created_at": 1699999999000,
    "started_at": 1700000000000,
    "finished_at": 1700000001000,
    "task_error": null,
  "consumed_credits": 10
  }
]

GET/openapi/v1/print/multi-color/:id/stream

流式获取多色 3D 打印任务

此 endpoint 使用服务器发送事件(Server-Sent Events,SSE)流式传输多色 3D 打印任务的实时更新。

参数

  • Name
    id
    Type
    path
    Description

    要进行流式传输的多色 3D 打印任务的唯一标识符。

返回值

以 Server-Sent Events 的形式返回一个 3D 打印任务对象 流。

对于 PENDING 或 IN_PROGRESS 状态的任务,响应流中只会包含必要的 progress 和 status 字段。

Request

GET
/openapi/v1/print/multi-color/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream
curl -N https://api.meshy.ai/openapi/v1/print/multi-color/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.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
  "id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "a43b5c6d-7e8f-901a-234b-567c890d1e2f",
  "type": "print-multi-color",
  "model_urls": {
    "3mf": "https://assets.meshy.ai/***/tasks/a43b5c6d-7e8f-901a-234b-567c890d1e2f/output/model.3mf?Expires=***"
  },
  "progress": 100,
  "status": "SUCCEEDED",
  "preceding_tasks": 0,
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000001000,
  "task_error": null,
"consumed_credits": 10
}

3D 打印任务对象

  • Name
    id
    Type
    string
    Description

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

  • Name
    type
    Type
    string
    Description

    3D 打印任务的类型。值为 print-multi-color。

  • Name
    model_urls
    Type
    object
    Description

    Meshy 生成的 3D 模型文件的可下载 URL。如果某种格式未被生成,则该格式对应的属性将被省略,而不是返回空字符串。

    • Name
      3mf
      Type
      string
      Description

      多色 3MF 文件的可下载 URL。

  • Name
    progress
    Type
    integer
    Description

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

  • Name
    status
    Type
    string
    Description

    任务的状态。可能的值为 PENDING、IN_PROGRESS、SUCCEEDED、FAILED 之一。

  • 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 数量。当任务状态为 PENDING、IN_PROGRESS 或 SUCCEEDED 时会显示此字段。对于 FAILED 的任务,返回 0(失败时 credits 会被退还)。

The 3D Print Task Object

{
  "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
  "type": "print-multi-color",
  "model_urls": {
      "3mf": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.3mf?Expires=***"
},
  "progress": 100,
  "status": "SUCCEEDED",
  "preceding_tasks": 0,
  "created_at": 1699999999000,
  "started_at": 1700000000000,
  "finished_at": 1700000001000,
  "task_error": null,
"consumed_credits": 10
}