lowpoly 将于 2026年10月30日 下线。 meshy-7 作为 3D 生成模型将于 2026年12月31日 下线;作为贴图模型仍可使用。 请在这些日期前切换模型,以免请求报错。 查看所有弃用信息

v2 迁移参考

查看影响迁移的 API v1 和 v2 之间的差异。有关迁移步骤,请参阅迁移到 API v2。

下表显示了针对你的代码所做的每件事,应阅读哪些部分。请阅读与你的代码匹配的行,跳过其余部分。

如果你的代码请阅读
调用任何 v1 endpointEndpoint 路径 和 Errors
获取、列出、流式传输或删除任务任务读取
读取任务结果,例如模型 URL 或缩略图任务对象 和 响应字段
创建任务参数处理
创建 Image to 3D 或 Multi-Image to 3D 任务Image to 3D 和 Multi-Image to 3D
创建或读取 Text to 3D 任务Text to 3D
创建 Retexture 任务Retexture
创建 Remesh 任务Remesh
创建 Convert 或 尺寸调整 任务Convert 和 尺寸调整
下载 STL 或 3MF 文件模型大小
创建文字生成影像或影像生成影像任务文字生成影像 和 影像生成影像
调用 UV Unwrap、Rigging、Animation、Text to Motion 或 3D 打印 endpoint其他 endpoint
接收 webhooksWebhook 负载
读取响应头,例如 Retry-After请求头

Endpoint paths

每个创建任务的 /openapi/v1 endpoint 都在 /openapi/v2/ 下的相同路径中有一个 v2 版本,balance、Usage 和 动画库 也是如此。例如,POST /openapi/v1/image-to-3d 变为 POST /openapi/v2/image-to-3d。

Creative Lab 和其他 v1 endpoint 没有 v2 版本,因此这些调用仍保留在 v1。

有些 endpoint 需要更多说明:

  • Text to 3D 只有 v2 路径 /openapi/v2/text-to-3d,因此其创建路径不会改变。
  • 除 Creative Lab 外,所有任务类型的读取操作都使用同一组路由。请参阅任务读取。
  • balance 和 动画库 返回与 v1 相同的响应体。
  • Usage,即 GET /openapi/v2/usage/tasks,接受与 v1 相同的参数,并返回与 v1 相同的记录和 Errors,并封装在 {"data": [...], "has_more": ...} 中。

任务读取

在 v2 中,你通过同样的四个路由读取所有任务类型,包括你在 v1 上创建的任务。Creative Lab 任务不在此列,需要通过其 v1 路由读取。

操作v1v2
获取任务GET /openapi/v1/<endpoint>/{id}GET /openapi/v2/tasks/{id}
列出任务GET /openapi/v1/<endpoint>GET /openapi/v2/tasks?type=<type>
流式获取任务GET /openapi/v1/<endpoint>/{id}/streamGET /openapi/v2/tasks/{id}/stream
删除任务DELETE /openapi/v1/<endpoint>/{id}DELETE /openapi/v2/tasks/{id}

v2 中不存在按 endpoint 区分的读取路由,例如 GET /openapi/v2/image-to-3d/{id}。Text to 3D 保留了其专属路由,返回的数据结构有所不同。详见Text to 3D 读取。

这四个任务路由的工作方式如下:

  • 获取:当任务处于 PENDING 或 IN_PROGRESS 状态时,Retry-After 响应头会告诉你下次轮询前需等待多少秒。
  • 列出:响应格式为 {"data": [...], "has_more": ...},按最新优先排序,不包含总数。若不指定 type,会包含除 Creative Lab 以外的所有任务类型。其他参数有:
    • page_num:取值范围从 1 到 255
    • page_size:默认值为 10,最大为 100。取值在 101 到 255 之间时,最多返回 100 条任务。
    • sort_by:-created_at 或 +created_at
  • 流式获取:每个 message 事件都携带完整的任务对象,最新状态每 10 秒重复发送一次。流会在任务完成后关闭,或者在大约 21 分钟后即使任务尚未完成也会关闭。如果流在任务完成前关闭,请重新打开流或改为获取任务。error 事件携带错误对象以及 status_code,形如 {"type": ..., "code": ..., "message": ..., "doc_url": ..., "status_code": ...}。
  • 删除:行为与 v1 相同。返回 200 及空响应体,会为 PENDING 状态的任务退款,对 IN_PROGRESS 状态的任务返回 409。
示例:列出请求与响应
curl "https://api.meshy.ai/openapi/v2/tasks?type=image-to-3d&page_size=2" \
  -H "Authorization: Bearer ${MESHY_API_KEY}"
{
  "data": [
    { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-3d", "status": "SUCCEEDED" },
    { "id": "018a210d-7a91-7c2e-9b10-5d6e7f8a9b0c", "type": "image-to-3d", "status": "PENDING" }
  ],
  "has_more": true
}

data 中的每一项都是完整的任务对象,此处为简化展示。

任务对象

以下所有来源返回的都是同一个任务对象:

  • 创建响应
  • GET /openapi/v2/tasks/{id}
  • 列表中的每一项
  • 每个流事件
  • 每次 v2 webhook 投递

除了下表之后介绍的两个顶级字段外,只有 input 和 output 取决于任务类型。webhook 投递发送 progress 的方式不同。参见 Webhook payloads。

字段类型描述
idstring任务 ID。你在 v1 上创建的任务在 v2 上保持相同的 ID。
typestring任务类型。参见 Task types。
statusstringPENDING、IN_PROGRESS、SUCCEEDED、FAILED 或 CANCELED。
progressinteger0 到 100。任务成功后为 100。
created_atinteger创建时间,以 Unix 毫秒表示。
started_at、finished_atinteger 或 null开始和结束时间。
expires_atinteger 或 nulloutput 中的链接何时过期。
preceding_tasksinteger处于 PENDING 状态时的排队位置。1 表示下一个执行。
consumed_creditsinteger 或 null扣除的积分,已扣除退款部分。
task_errorobject 或 null任务失败的原因。
inputobject 或 null你发送的请求。参见 input。
outputobject 或 null结果。任务成功前为 null。

此表中的每个字段始终存在。尚不存在的值为 null,绝不会是 0 或 ""。数组永远不会是 null,除了 intended_print 对象中的 dimensions_mm,因此当没有贴图时 texture_urls 为 []。

Meshy 可能随时添加新字段,因此请忽略你不使用的字段。

有六个字段有额外规则:

  • expires_at 是 finished_at 之后的 3 天。在任务成功之前为 null,对于 Text to 3D 任务和企业账户则始终为 null。v1 在失败的任务上也会设置该值。对于其他账户的 Text to 3D 任务,null 并不意味着 Meshy 会保留文件。Meshy 仍会在任务完成后 3 天删除它们。请在这 3 天内下载所需内容。参见资产保留期。
  • preceding_tasks 在任务离开队列后为 0,在列表结果中始终为 0。
  • consumed_credits 对失败的任务为 0。只有在 Meshy 无法读取该响应的扣费情况时才为 null。在这种情况下,请重新读取该任务。列表项中永远不会是 null。
  • task_error 除非任务失败,否则为 null。在失败的任务中,task_error 包含错误对象的每个字段,且 type 永远不为 null,因此应根据 type 进行分支处理。对于没有公开代码的错误,code 和 doc_url 为 null,例如所有 service_unavailable 错误、大多数 server_error 错误,以及部分 invalid_input 错误。参见错误参考。
  • prompt_ignored 出现在部分 Auto Split 任务中。当 Auto Split 请求将 mode 设置为 by_parts 或 by_color,且 Meshy 无法从其 prompt 中读取到任何部件名称时,会出现这种情况。此时任务会改为按照 Meshy 从模型参考图像中识别出的部件进行拆分,并使用你所选择的 mode。然后该任务会在顶级拥有 "prompt_ignored": true,从创建响应开始即如此。在 v1 上,这个字段从首次读取时就会出现。如果模型没有参考图像,或者 Meshy 在其中找到的部件少于两个,则请求会返回 400。
  • intended_print 出现在你在 v2 上创建的每个 Repair Printability 任务中,因为 v2 默认会检查壁厚。在 v1 上,只有当请求指定了打印机类型或打印尺寸时才会出现该字段。它位于顶级,与 v1 一致,而不在 output 下。在 v2 上,它从创建响应开始就存在,而在 v1 上则从首次读取开始出现。其 dimensions_mm 在 Meshy 测量模型之前为 null,如果输入不是 GLB 或 Meshy 无法测量它,则该值将一直保持为 null。每次 v2 分析在 output.printability.intended_print 中都有相同的对象。
Example: a succeeded Image to 3D task
{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "image-to-3d",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1790640079880,
  "started_at": 1790640079892,
  "finished_at": 1790640153381,
  "expires_at": 1790899353381,
  "preceding_tasks": 0,
  "consumed_credits": 30,
  "task_error": null,
  "input": {
    "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp",
    "should_texture": true,
    "target_formats": ["glb", "fbx"]
  },
  "output": {
    "model_urls": {
      "fbx": "https://assets.meshy.ai/***/output/model.fbx?Expires=***",
      "glb": "https://assets.meshy.ai/***/output/model.glb?Expires=***"
    },
    "thumbnail_url": "https://assets.meshy.ai/***/output/preview.png?Expires=***",
    "thumbnail_urls": null,
    "texture_urls": [
      {
        "base_color": "https://assets.meshy.ai/***/output/texture_0.png?Expires=***",
        "metallic": null,
        "roughness": null,
        "normal": null,
        "metallic_roughness": null,
        "emission": null
      }
    ]
  }
}
Example: task_error on a failed task
{
  "task_error": {
    "type": "timeout",
    "code": "timeout",
    "message": "Your request took too long to process. Please retry. If this persists, try simplifying your input.",
    "doc_url": "https://docs.meshy.ai/en/api/v2/errors#timeout"
  }
}

内部错误的 code 和 doc_url 为 null,例如 {"type": "server_error", "code": null, "message": "Generation failed due to resource constraints. Please retry. If this persists, try simplifying your input.", "doc_url": null}。v1 省略了这两个字段。

任务输入

input 回显你发送的创建请求,但仅限于该 endpoint 接受的 参数。请将其用于调试,而不是用作重放的请求。如果你的代码之后还需要用到该请求,请自行保留一份副本。input 与你的请求的区别如下:

  • input 只包含该 endpoint 定义的 参数。请参阅参数处理。
  • v2 不会填充默认值或 Meshy 选定的值。如果你省略了 target_formats,input 中也不会包含它,尽管 v2 实际使用了 ["glb"]。v1 任务还会返回一些 Meshy 选定的值,例如它所使用的 remove_lighting、hd_texture 和 texture_resolution。v2 中没有对应这些值的字段。
  • input 中的某个 参数 仍有可能被忽略,例如所选模型无法使用的 参数。
  • v2 会将 Data URI 替换为指向 Meshy 存储副本的链接,如果没有存储副本,则替换为 data:<type>;base64,[omitted ~<size>]。它会从带签名的 URL 中移除查询字符串,并从任意 URL 中移除用户名和密码。
  • 在 v1 上创建的任务会显示 v1 的 参数 名称。
  • 当 Meshy 没有保存该请求的副本时,input 为 null。这种情况可能发生在创建调用刚结束后的短暂时间内,也可能发生在 2026 年 6 月之前创建的任务上。创建请求的响应中始终包含 input。

任务类型

type 字段和 type 列表过滤器使用以下这些值。过滤器 type=text-to-3d 会匹配全部三种 Text to 3D 类型。

typeEndpointoutput 字段
image-to-3d, multi-image-to-3dImage to 3D, Multi-Image to 3Dmodel_urls, thumbnail_url, thumbnail_urls, texture_urls
text-to-3d-preview, text-to-3d-refine, text-to-3dText to 3Dmodel_urls, thumbnail_url, alpha_thumbnail_url, texture_urls
retexture, remeshRetexture, Remeshmodel_urls, thumbnail_url, texture_urls
convert, resizeConvert, Resizemodel_urls, texture_urls
uv-unwrapUV Unwrapmodel_urls, thumbnail_url
rigRiggingrigged_character_glb_url, rigged_character_fbx_url, basic_animations
rig-checkRigging Checkriggable, animation_type, animatable, reasons
animateAnimationanimation_glb_url, animation_fbx_url, processed_usdz_url, processed_armature_fbx_url, processed_animation_fps_fbx_url
text-to-motionText to Motionmotion_url, motion_format, duration_ms, mode
text-to-image, image-to-imageText to Image, Image to Imageimage_urls
print-multi-colorMulti-Color Printmodel_urls,附带一个 3mf 键
print-repairRepair Printabilitymodel_urls, thumbnail_url, print_repair_report
print-splitAuto Splitmodel_urls, thumbnail_url, part_count
reliefReliefmodel_urls, texture_urls, depth_map_url, thumbnail_url
print-analyzeAnalyze Printabilityprintability

output 字段遵循以下规则:

  • model_urls 为任务生成的每种格式都有一个对应的键,例如 glb、obj 或 blend。带贴图的 obj 会附带一个 mtl。
  • 在使用 save_pre_remeshed_model 发送的 Image to 3D 和 Multi-Image to 3D 任务中,当模型经过了 remesh 时,model_urls 还可以包含 pre_remeshed_glb,即 remesh 之前的模型。它并不是一种格式,因此如果你的代码将这些键当作格式来读取,应跳过它。
  • 每个 texture_urls 项始终包含以下贴图,对于未生成的贴图其值为 null:
    • base_color
    • metallic
    • roughness
    • normal
    • metallic_roughness
    • emission
  • thumbnail_urls 默认为 null,除非你请求了 multi_view_thumbnails。请求后,thumbnail_urls 会包含以下预览图:
    • front
    • right
    • back
    • left
  • alpha_thumbnail_url 仅存在于 Text to 3D 任务中,且默认为 null,除非你请求了 alpha_thumbnail。
  • printability 的字段与 v1 相同,只是 v2 去掉了 _version。metrics 和 evaluated_at 始终存在,在 Meshy 计算出结果之前为 null。

响应字段

使用此表来更新读取任务的代码。未列出的字段保持其名称和值不变。例外情况是 Meshy 在 v1 中随您的请求一起返回的所选值。请参阅任务输入。

v1 字段v2 字段变更
model_urls.<format>output.model_urls.<format>已迁移
model_urloutput.model_urls.glb已迁移
thumbnail_urloutput.thumbnail_url已迁移,且使用 null 而非 ""
thumbnail_urlsoutput.thumbnail_urls已迁移,且出现在列出它的任务类型中
alpha_thumbnail_url在 Text to 3D 任务中为 output.alpha_thumbnail_url已在 Text to 3D 中迁移。在其他任务类型中已移除,因为其 thumbnail_url 已经是带透明背景的 PNG。
texture_urlsoutput.texture_urls已迁移,且使用 [] 而非 null
image_urlsoutput.image_urls已迁移
printability、part_count、print_repair_reportoutput 下相同的名称已迁移。part_count 和 print_repair_report 始终存在,未设置时为 null,而 v1 则直接省略它们。
printability._version无已移除
result.<field>(Rigging、Animation、Text to Motion)output.<field>已迁移,且使用 null 而非 ""
result.<field>(Rigging Check)output.<field>已迁移。在任务成功之前,output 为 null,而 v1 会直接省略 result。
请求参数,例如 prompt 和 ai_modelinput.<parameter>已迁移,且仅在您发送了它们时才会出现
text_style_prompt、image_style_url(Retexture)input.texture_prompt、input.texture_image_url已重命名。texture_image_url 是您发送的 URL,而 v1 返回的是指向 Meshy 副本的链接。
art_style、object_prompt、style_prompt、negative_prompt无已移除,无替代项
started_at、finished_at、expires_at相同的名称在设置之前为 null,而非 0。expires_at 有更多 null 的情况,请参阅任务对象。
preceding_taskspreceding_tasks始终存在

有三处差异取决于任务类型:

  • alpha_thumbnail_url 和 thumbnail_urls 在您未请求它们时为 null。未生成的 texture 贴图为 null,而非缺失。
  • Convert、Resize 和 Multi-Color Print 任务在 v2 中没有 thumbnail_url,而 v1 会发送 ""。只有 Text to 3D 任务才有 alpha_thumbnail_url。UV Unwrap、Repair Printability 和 Multi-Color Print 任务没有 texture_urls。
  • 在 v1 中创建的任务在 input 中保留 v1 的参数名称,例如 text_style_prompt。

请求参数

参数处理

v2 按以下方式处理请求参数:

  • 如果创建请求中包含某个 endpoint 未定义的参数,将返回 400,错误代码为 parameter_unknown。这包括拼写错误的名称、已移除的 v1 参数,以及大小写错误的名称,例如 enablePbr。v1 会忽略它未定义的参数。当请求带有 mode 时,Text to 3D 也是如此。
  • message 会列出每个未知参数的名称。对于已移除的 v1 参数,它还会给出替代参数的名称。对于拼写接近的参数,它会给出你可能想要使用的参数名称。某些已移除的参数会改变 v1 的结果,因此请为你的 endpoint 发送所列出的替代参数。
  • 如果请求同时包含 input_task_id 和 model_url,将返回 400,错误代码为 parameters_conflict。v1 使用 input_task_id,因此请只发送该参数。
  • v2 会忽略 Image to 3D、Multi-Image to 3D 和 Retexture 中的 remove_lighting,因为 texture_model 所接受的 texture 模型不使用该参数。当 ai_model 为 meshy-6-lite 时,以及在使用 Smart Topology 模型的 Image to 3D 中,它也会忽略 image_enhancement。对于其中一些请求,v1 会返回 400。
  • 当 "should_texture": false 时,v2 会忽略 texture_model 以及其他 texture 参数。对于 "enable_pbr": true 与 "should_texture": false 同时出现的情况,v1 会返回 400。

所有其他验证规则仍然适用。例如,如果 texture_resolution 是 texture 模型不支持的值,将返回 400;参数类型错误时也是如此。发送 "image_url": 123 将返回 image_url must be a string。

纹理模型

在 v2 中,生成带纹理模型的请求会在 texture_model 中指定其纹理模型。Meshy 不会替你选择:

  • Image to 3D、Multi-Image to 3D 和 Text to 3D 的一次性调用请求需要提供 texture_model,除非 should_texture 为 false。带纹理的请求若缺少该参数,会返回 400 以及错误码 parameter_missing。
  • Retexture 在每个请求中都需要 texture_model。它取代了 ai_model。

带有 mode 的 Text to 3D 请求会忽略 texture_model。关于每个 ai_model 在每个 endpoint 上可使用的纹理模型,以及每个纹理模型支持的选项,请参阅 纹理模型。

若要保留你 v1 请求生成的纹理,请发送 v1 所使用的纹理模型。下表列出了每种 v1 请求对应的情况。

v1 请求在 v2 上发送
ai_model 为 meshy-7.1、latest、meshy-t2.5 或 meshy-t2,且未指定 texture_model"texture_model": "meshy-7"
"ai_model": "meshy-6-lite" 且未指定 texture_model(Image to 3D)"texture_model": "meshy-6-lite"
"ai_model": "meshy-6-lite" 且未指定 texture_model(Multi-Image to 3D)"texture_model": "meshy-7"。Multi-Image to 3D 可使用 meshy-7 或 meshy-n1。
"ai_model": "meshy-6" 且未指定 texture_model,或 "texture_model": "meshy-6""texture_model": "meshy-7",最接近的匹配项。v2 没有 Meshy 6 纹理模型。
texture_model 为 meshy-7、meshy-n1 或 meshy-6-lite相同的 texture_model
Retexture 未指定 ai_model,或使用 latest 或 meshy-standard-latest"texture_model": "meshy-7"
Retexture 的 ai_model 为 meshy-7、meshy-n1 或 meshy-6-litetexture_model 取相同的值
Retexture 使用 "ai_model": "meshy-6""texture_model": "meshy-7",最接近的匹配项

纹理模型不会影响价格。带纹理任务的费用为 mesh 加上该分辨率下的纹理费用,与 v1 相同。

Image to 3D 与 Multi-Image to 3D

要获得与 v1 相同的结果,请修改请求中的以下部分。标记为 Image to 3D 的行仅适用于该 endpoint。

v1 请求在 v2 上在 v2 上发送
省略 target_formats仅返回 GLB"target_formats": ["glb", "obj", "fbx", "stl", "usdz"],或你所使用的格式
在带贴图请求中省略 texture_model400v1 使用的贴图模型。参见 Texture model。
"hd_texture": true400"texture_resolution": "4k"
"is_a_t_pose": true400"pose_mode": "t-pose"
"ultra_mode": true400"geometry_resolution": "2k"
texture_prompt 与 texture_image_url 同时出现400仅 texture_prompt
"model_type": "smart-topology" 且无 ai_model(Image to 3D)400"ai_model": "meshy-smart-topology-latest"
"model_type": "smart-topology" 且带 ai_model(Image to 3D)400无需改动,结果不会改变。
symmetry_mode400无需改动,结果不会改变。
surface_mode(Image to 3D)400无需改动,结果不会改变。
alpha_thumbnail400无需改动。thumbnail_url 本来就是带透明背景的 PNG。

关于这些替换的一些细节:

  • "texture_resolution": "4k" 需要一个能生成 4K 贴图的贴图模型,就像 v1 上的 "hd_texture": true 一样。在 v2 上,对应的是 "texture_model": "meshy-7",可搭配任意 ai_model。
  • is_a_t_pose 用于请求 T-pose。"pose_mode": "t-pose" 同样请求 T-pose,但使用了不同的图像模型和 prompt,因此生成的 mesh 可能与 v1 的结果不同。
  • 当你同时发送两种贴图输入时,v1 会使用 texture_prompt 并忽略 texture_image_url。
  • 在 Image to 3D 中,单独的 ai_model 即可选定模型。v1 中不带 ai_model 的 "model_type": "smart-topology" 请求运行的是 Meshy T2.5。在 v2 上,meshy-smart-topology-latest 同样运行该模型。它会跟随最新的 Smart Topology 模型,因此结果可能发生变化。如果希望结果保持不变,请发送 meshy-t2.5。
  • 两个 endpoint 都接受 "ai_model": "meshy-standard-latest",其作用与 latest 相同。latest 会跟随 Meshy 在 v1 和 v2 上所指向的标准模型,因此结果可能发生变化。如果希望结果保持不变,请发送具体的模型,例如 meshy-6。
  • STL 和 3MF 文件遵循模型尺寸规则。
Example: the same Image to 3D request on v1 and v2

Image to 3D request

# v1: Smart Topology through model_type, 4K textures through hd_texture, all formats by default
curl https://api.meshy.ai/openapi/v1/image-to-3d \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp",
    "model_type": "smart-topology",
    "ai_model": "meshy-t2",
    "should_texture": true,
    "hd_texture": true,
    "symmetry_mode": "auto"
  }'
Example: the same Multi-Image to 3D request on v1 and v2

Multi-Image to 3D request

# v1: texture_prompt wins over texture_image_url, 4K through hd_texture
curl https://api.meshy.ai/openapi/v1/multi-image-to-3d \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "image_urls": [
      "https://docs.meshy.ai/images/api/quick-start/source-photo.webp",
      "https://docs.meshy.ai/images/api/quick-start/source-photo.webp"
    ],
    "ai_model": "meshy-7.1",
    "should_texture": true,
    "hd_texture": true,
    "texture_prompt": "weathered bronze",
    "texture_image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp"
  }'

Retexture

要获得与 v1 相同的结果,请修改请求中的以下部分。

v1 请求在 v2 上在 v2 上发送
text_style_prompt、image_style_url400texture_prompt、texture_image_url
ai_model已重命名texture_model。参见 Texture model。
省略 ai_model400"texture_model": "meshy-7"
省略 enable_original_uv保留可用的 UV"uv_mode": "regenerate"
"enable_original_uv": false400"uv_mode": "regenerate"
"enable_original_uv": true400"uv_mode": "preserve"
省略 target_formats仅返回 GLB你所使用的格式
"hd_texture": true400"texture_resolution": "4k"
text_style_prompt 与 image_style_url 同时出现400仅使用 texture_image_url
art_style400无需发送任何内容。v2 没有艺术风格。使用 cartoon 时,v1 会跳过 Meshy 的提示词重写,而 v2 可以对较短的提示词应用这一重写。
name400无需发送任何内容。你的结果不会改变。
alpha_thumbnail400无需发送任何内容。thumbnail_url 本身就是带透明背景的 PNG。

以下替换需要更详细的说明:

  • uv_mode 决定 UV 的处理方式。没有 UV 的模型在任何取值下都会得到新的 UV。各个取值的行为如下:
    • auto(默认值)会在模型所有 UV 坐标的外包框至少覆盖 UV 正方形的 5% 时保留模型原有的 UV。否则,会生成新的 UV。
    • regenerate 始终生成新的 UV,与 v1 的行为一致。
    • preserve 会保留原有 UV。如果模型的 UV 外包框覆盖率低于 5%,将会以 model_insufficient_uv 失败。
  • 使用 input_task_id 时,保留 UV 也会保留网格(mesh)的尺寸和位置。而使用新 UV,或上传 model_url 时,Meshy 会重新将网格居中,并保留其尺寸。参见 Model size。
  • 当你同时发送两种 texture 输入时,v1 会使用 image_style_url 并忽略 text_style_prompt。
  • STL 和 3MF 文件遵循 model size 规则。
Example: the same Retexture request on v1 and v2

Retexture request

# v1: style prompt name, default UV behavior regenerates UVs
curl https://api.meshy.ai/openapi/v1/retexture \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model_url": "https://cdn.meshy.ai/model/example_model_2.glb",
    "text_style_prompt": "weathered bronze with green patina",
    "ai_model": "meshy-7",
    "enable_pbr": true,
    "hd_texture": true
  }'

Remesh

v2 Remesh 会更改 topology 和 polycount,并返回你在 target_formats 中列出的格式,和 v1 Remesh 一样。不带 target_formats 时,返回 GLB。Quad topology 在 OBJ 和 FBX 文件中保持为 quad。Remesh 接受以下参数:

  • input_task_id 或 model_url
  • topology
  • target_polycount
  • decimation_mode
  • target_formats

Remesh 不接受 alpha_thumbnail,因为 thumbnail_url 本身就是带透明背景的 PNG。带有该参数的请求会返回 400。

结果会保留模型的尺寸,包括 model_url 上传内容的尺寸。model_url 上传内容返回后是一个居中的 mesh,所以不会保留其位置。Remesh 会丢弃 rig、动画和 morph target。STL 和 3MF 文件遵循模型尺寸规则,因此其尺寸可能与 v1 Remesh 文件不同。

从请求中移除以下参数:

  • resize_height
  • resize_longest_side
  • origin_at
  • auto_size
  • convert_format_only

如果其中任何一个存在,哪怕是 null 或 false,请求都会返回 400。

要获得使用这些参数的 v1 结果,需运行一串任务链。将每个任务的 id 传给下一个任务的 input_task_id,并在创建下一个任务前等待每个任务成功:

  • 对于带新尺寸的 Remesh,先运行 Remesh,再运行尺寸调整,如果需要其他格式则再运行 Convert。
  • 对于带 origin_at 且不改变尺寸的 Remesh,运行相同的任务链,但只向尺寸调整发送 origin_at。
  • 对于 "convert_format_only": true,只运行一个 Convert 任务。v1 在这种模式下也不会执行 remesh。

与带新尺寸的 v1 Remesh 一样,该任务链在 OBJ、FBX 和 Blend 文件中保持 quad topology。带贴图的 OBJ 会附带其 mtl 文件。

尺寸调整通过 resize_height、resize_longest_side 或 auto_size 设置尺寸,并且除非你发送 origin_at,否则会将 origin 设置在底部,这与 v1 Remesh 在调整尺寸时的做法一致。单独发送 origin_at 时,只会移动 origin 并保留尺寸,与 v1 的行为一致。

尺寸调整和 Convert 任务没有 thumbnail_url。如果你是从 v1 Remesh 结果中读取缩略图,请从 Remesh 任务中读取。如果你只运行了 Convert,请从输入任务中读取。它们的 texture_urls 会列出输入任务的 texture 贴图。

Meshy 对每个任务单独计费。带格式的 Remesh 在 v1 和 v2 中都是 5 积分。带格式并进行尺寸调整或 origin 移动的 v1 Remesh 花费 5 积分。v2 任务链共花费 7 积分:Remesh 5 积分、尺寸调整 1 积分、Convert 1 积分。convert_format_only 请求会变成一个 Convert 任务,花费 1 积分而不是 5 积分。

示例:将 v1 Remesh 请求改写为 v2 任务链

Remesh 请求

# v1: remesh, resize, and convert in one task
curl https://api.meshy.ai/openapi/v1/remesh \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "topology": "triangle",
    "target_polycount": 10000,
    "resize_height": 1.8,
    "origin_at": "bottom",
    "target_formats": ["glb", "fbx"]
  }'

Convert 和 尺寸调整

这些请求的工作方式与 v1 相同,Convert 仍然需要 target_formats。v2 的 尺寸调整 也可以只传入 origin_at 而不指定尺寸:这样只会移动 origin,而保持尺寸不变。以 v2 尺寸调整 任务作为 input_task_id 的任务会使用调整后的模型,包括从 model_url 调整尺寸得到的 OBJ、FBX 或 STL 文件。在 v2 上,Convert 会在每种格式中都保留 model_url 上传内容的尺寸,其 STL 和 3MF 文件遵循模型尺寸规则。

模型尺寸

在 v2 上,模型的尺寸取决于它的来源:

  • Image to 3D 和 Multi-Image to 3D 会将其 STL 和 3MF 文件按比例缩小,使最长边最多为 150 毫米,同时保持比例不变。其他格式则保留模型原本的尺寸。以 Meshy 生成的模型为起点的任务也是如此,例如对 Image to 3D 或 Text to 3D 任务进行 Remesh 或 Convert,使用 auto_size 缩放的模型也是一样。
  • Text to 3D、尺寸调整、可打印性修复 和 浮雕 不会对自身的文件应用该上限。
  • 你通过 model_url 上传的模型,在 Convert、Remesh、Retexture 和 多色打印 中的每种格式都会保留其原本的尺寸。
  • 你通过 resize_height 或 resize_longest_side 调整尺寸的模型,在每种格式中都会保留你所设置的尺寸。

要以其他尺寸打印生成的模型,请先运行 尺寸调整,然后再 Convert 为 stl 或 3mf。

上传的模型返回时是一个居中的单一 mesh,不含 rig 或动画。Remesh 也会丢弃变形目标(morph targets)。如果 Meshy 无法读取上传内容的尺寸,它会以标准尺寸返回模型,且 STL 和 3MF 文件最大为 150 毫米。

缩小后的 STL 文件,以及每个 3MF 文件,其 origin 都位于底部。Auto Split 始终会应用该上限。

文字生成影像和影像生成影像

用 background 替换 remove_background。携带 remove_background 的请求将返回 400。默认情况下,v2 会返回带透明背景的 PNG 图片,无论是单视图还是多视图图片都是如此。背景移除只保留主体,因此生成的 scene 或环境也会被移除。如果背景移除失败,任务仍会成功完成,只是返回原始图片。要保留单张图片的背景,请发送 "background": "opaque"。多视图图片始终具有透明背景,若同时传入 generate_multi_view: true 和 "background": "opaque" 则会返回 400。积分消耗不变。

示例:同一个文字生成影像请求在 v1 和 v2 中的区别

文字生成影像请求

# v1: background removal is opt-in
curl https://api.meshy.ai/openapi/v1/text-to-image \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "ai_model": "nano-banana",
    "prompt": "a brass robot, full body",
    "remove_background": true
  }'

其他 endpoint

这些 endpoint 保持其 v1 请求不变,除了以下列表之后列出的已移除参数。它们的响应会变为 v2 任务对象:

  • UV Unwrap
  • Rigging
  • Rigging Check
  • Animation
  • Text to Motion
  • Multi-Color Print
  • Repair Printability
  • Analyze Printability
  • Auto Split
  • Relief

其中一些有额外的细节说明:

  • 对于 Rigging、Rigging Check、Animation 和 Text to Motion,v1 中嵌套在 result 下的字段移动到了 output 下。参见响应字段。
  • Rigging 的 skeleton_template 默认值为 mixamo,部分模型会返回 422。参见 Rigging。关于骨骼和单位,参见 v2 中的变化中的 Rigging 骨骼部分。
  • Rigging 的 height_meters 在 v2 中没有默认值,而在 v1 中对双足骨骼默认值为 1.7。要保留 v1 的尺寸,请发送 "height_meters": 1.7。
  • Rigging 和 Animation 为每个动画片段命名的方式与从 Meshy Web App 下载时一致:基础动画使用 Walking 和 Running,库动画使用该动画的 key,例如 Big_Wave_Hello。Text to Motion 片段使用其任务的 id,例如 _018a210d_1c22_7e0f_9d3a_4a5b6c7d8e9f。在 v1 中,它被命名为 retarget_clip。参见 Animation。
  • Rigging 不接受 texture_image_url,带有该参数的请求将返回 400。Meshy 会使用嵌入在 model_url 文件中的纹理,或输入任务的纹理。要为来自 model_url 的带纹理角色添加骨骼,请将其纹理嵌入到 GLB 中。
  • Repair Printability 不接受 alpha_thumbnail,因为 thumbnail_url 本身已经是带透明背景的 PNG。带有该参数的请求将返回 400。
  • Multi-Color Print 会保留上传的 model_url 的尺寸,其 3MF 文件遵循模型尺寸规则。
  • Relief 的 target_formats 在 v2 中默认值为 ["glb"],在 v1 中默认值为 ["glb", "stl"]。要保留 STL 文件,请发送 "target_formats": ["glb", "stl"]。
  • Analyze Printability 仍然是免费的。如果 Meshy 已经以相同的打印机类型和打印尺寸分析过 input_task_id 对应的模型,创建请求的响应可能已经是 SUCCEEDED,并且已填充 output.printability。在轮询之前请先检查 status。
  • Repair Printability 和 Analyze Printability 默认按照高度为 150 毫米的 FDM 打印来检查壁厚。要按照你自己的打印设置来判断壁厚,请发送 printer_type 和尺寸。关于每种文件格式的默认尺寸,参见 Repair Printability。
示例:v1 和 v2 中的 Rigging 结果

Rigging 结果

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "rig",
  "status": "SUCCEEDED",
  "result": {
    "rigged_character_fbx_url": "https://assets.meshy.ai/***/output/Character_output.fbx?Expires=***",
    "rigged_character_glb_url": "https://assets.meshy.ai/***/output/Character_output.glb?Expires=***",
    "basic_animations": {
      "walking_glb_url": "https://assets.meshy.ai/***/output/Animation_Walking_withSkin.glb?Expires=***",
      "running_glb_url": "https://assets.meshy.ai/***/output/Animation_Running_withSkin.glb?Expires=***"
    }
  }
}

以上两个示例均已精简,仅保留发生变化的字段。

Text to 3D

Text to 3D 没有 v1 版本,其创建请求不会发生变化。由于它的路由已经运行在 v2 上,以下针对其响应和错误的变更适用于你当前的 Text to 3D 代码:

  • 创建响应是完整的任务对象,带有 Location 和 Retry-After 头。它仍然包含带有任务 ID 的 result,因此现有代码可以继续正常运行。
  • 通过 /openapi/v2/tasks 读取 Text to 3D 任务,与其他所有任务类型一样。参见Text to 3D 读取。
  • 大多数错误响应变更为 v2 错误对象。参见 Errors。
  • 同时包含 texture_prompt 和 texture_image_url 的 refine 或一次性(one-call)请求将返回 400。若要保持你当前的结果,请仅发送 texture_prompt。

一次调用请求

将工作拆分为 preview 和 refine 的 mode 已 deprecated。对于已经在使用它的集成,它会继续生效。

要在一次请求中生成模型,请省略 mode。一次调用请求会返回一个带 texture 的模型,除非你发送 "should_texture": false,并且需要 texture_model 来生成 texture。该任务的类型为 text-to-3d,费用与一次 preview 加一次 refine 相同。一次调用请求遵循以下规则:

  • 如果你同时发送了 mode,Text to 3D 会忽略 should_texture 和 texture_model,并运行两步流程。
  • "should_texture": false 只会创建 mesh,费用与一次 preview 相同。使用它时,Meshy 会忽略 texture_model 和其他 texture 参数。
  • 每个 ai_model 都支持 meshy-7、meshy-n1 或 meshy-6-lite 的 texture_model。使用 meshy-6 或 meshy-6-lite 时,meshy-n1 需要 texture_image_url。参见Texture models。
  • ai_model 可以是以下值之一:
    • latest
    • meshy-standard-latest
    • meshy-7.1
    • meshy-6
    • meshy-6-lite
    • 一个 Smart Topology 模型,例如 meshy-t2
  • meshy-7 会返回 400,因此请改为发送 meshy-7.1。
  • geometry_resolution 的 2k 和 4k 需要 meshy-7.1,或者在 latest 解析为 Meshy 7.1 时使用。
  • 带有 ultra_mode 的一次调用请求会返回 400,因此请改为发送 geometry_resolution。
  • 带有 Text to 3D 未定义的参数的一次调用请求会返回 400,并带有代码 parameter_unknown。参见参数处理。
  • count 大于 1 会返回 400。
  • 如果你的 refine 发送了 ai_model,请将其对应的 texture 模型作为 texture_model 发送。对于 meshy-7、meshy-7.1 或 latest,对应的是 meshy-7。对于 meshy-n1 或 meshy-6-lite,发送相同的值。对于 meshy-6,请发送 meshy-7,这是最接近的匹配。
  • 你无法对一次调用任务进行 refine。要在生成 texture 之前检查 mesh,请发送 "should_texture": false。然后使用Retexture为已完成的任务生成 texture,并将其 id 用作 input_task_id。
示例:一次调用请求

cURL

# One call: omit mode, and name the texture model
curl https://api.meshy.ai/openapi/v2/text-to-3d \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a monster mask",
    "ai_model": "meshy-7.1",
    "texture_model": "meshy-7",
    "enable_pbr": true,
    "texture_prompt": "weathered bronze with green patina",
    "target_formats": ["glb", "fbx"]
  }'

Text to 3D 读取

GET /openapi/v2/tasks/{id} 返回的 Text to 3D 任务与其他所有任务类型的格式相同。如果你的代码是从 /openapi/v2/text-to-3d/{id}、其列表接口、其流式接口或 v1 Webhooks 中读取这些任务的,那么在迁移到任务路由时,这些字段会发生变化。Text to 3D 路由和 v1 Webhooks 还会在顶层字段旁包含 input 和 output。

字段Text to 3D 路由任务路由
model_urls、thumbnail_url、texture_urls 及其他结果顶层位于 output 下
prompt、mode、texture_prompt 及其他请求字段顶层位于 input 下,且仅包含你发送过的字段
texture_image_url指向 Meshy 副本的链接input.texture_image_url,即你发送的 URL
started_at、finished_at 在尚未设置时0null
preceding_tasks仅在任务排队期间出现,列表项中从不出现始终存在
consumed_credits 在 Meshy 无法读取扣费信息时缺失null

input 中只保存你发送的请求内容,因此 Meshy 自动填充的值(例如 model_type)仅出现在 Text to 3D 路由中。只有当 refine 请求本身发送了 prompt 时,该 refine 的 input 中才会有 prompt,而 Text to 3D 路由则会显示其 preview 阶段的 prompt。

保持不变的行为

Text to 3D 保留以下行为:

  • model_type 仍然有效,但你可以不填写它。ai_model 单独就能选定模型,因此 meshy-t2.5 和 meshy-t2 在不使用它的情况下也会运行 Smart Topology。
  • 如果不提供 target_formats,Text to 3D 会返回 GLB、OBJ、FBX、STL 和 USDZ。只有在你主动请求时,才会返回 3mf。它不支持 gltf,并且没有打印尺寸上限。
  • 大多数模型不支持的参数仍会返回 400。例如,在使用 meshy-6-lite 进行 refine 时传入 remove_lighting,会返回 remove_lighting is only supported for meshy-6。Meshy 7、Meshy 7.1 以及 Smart Topology 纹理化会忽略 remove_lighting,而不会报错。
  • 带有 mode 的请求会忽略以下参数,而一次性调用(one-call)请求会针对这些参数返回 400。请将它们从你的请求中移除:
    • negative_prompt
    • art_style
    • symmetry_mode
    • texture_richness
  • Text to 3D 的响应中不包含以下字段:
    • negative_prompt
    • art_style
    • texture_richness
    • video_url
  • 请调用 https://api.meshy.ai/openapi/v2/text-to-3d。不带 /openapi 的路径已 deprecated。详见更新日志。

Webhook payloads

每个 webhook 都有一个你在 Webhooks 页面 上设置的 payload 版本,即 v1 或 v2。该版本与创建任务的 API 版本无关。你现有的 webhook 会保持在 v1,直到你切换它们。在 Webhooks 页面上新增的 webhook 默认从 v2 开始,除非你选择 v1。

这两个版本的区别如下:

  • v2 的发送带有 Meshy-Webhook-Version: v2 请求头,其任务对象与 GET /openapi/v2/tasks/{id} 相同,progress 除外。任务处于 IN_PROGRESS 时,发送的 progress 为 50;成功时为 100;失败或被取消时为 0。
  • v1 的发送带有 Meshy-Webhook-Version: v1 请求头,以及该任务类型对应的 v1 请求体。在 v1 webhook 上,Text to 3D 的发送还会带有 input 和 output,因此请通过请求头来区分版本,而不是请求体。

Creative Lab 是唯一的例外。即使在 v2 webhook 上,它的发送也会保留当前的请求体和 v1 请求头。

v1 和 v2 的 webhook 会收到相同的任务,无论是由哪个 API 版本创建的。每个 webhook 都会收到以其对应的 Meshy 用户身份运行的任务,而团队 API key 则以团队所有者的身份运行。参见 Webhooks。

在 Webhooks 页面上点击发送测试所发出的测试,其请求体和请求头与该任务的真实发送相同,并额外带有 Meshy-Webhook-Test: true。真实的发送永远不会带有此请求头。测试不计入发送次数,也不会改变该 webhook。

要测试一个 webhook 并将其切换到 v2,请参阅将你的 webhook 迁移到 v2。

响应头

v2 增加了 Location 响应头,在创建响应中也会发送 Retry-After,其余保持不变。

响应头v1v2
Location不发送在 202 创建响应中为 /openapi/v2/tasks/{id},Text to 3D 则为 /openapi/v2/text-to-3d/{id}
Retry-After在因每秒请求数过多而返回 429 时,以及在读取 PENDING 或 IN_PROGRESS 任务时发送同样会发送,并且在 202 创建响应中也会发送,作为你首次轮询的提示
X-RateLimit-Limit、X-RateLimit-Remaining、X-RateLimit-Reset发送发送

v1 和 v2 共用相同的速率限制。对于 Text to 3D,Location 指向 Text to 3D 路由。

Errors

错误响应与失败任务的 task_error 是同一个对象,形式为 {"type": "...", "code": "...", "message": "...", "doc_url": ...}。HTTP 状态码不会改变,message 字段依然存在,但许多消息会更加具体。例如,v2 的消息会按照你发送的方式指出某个参数的名称,或说明下载失败的原因,或说明为什么 Meshy 无法使用某个任务 ID。如果你的代码依赖 message 文本进行匹配,请改为根据 code 来分支判断。参见 请求错误代码。

Text to 3D 的错误也使用这个对象。例外情况是 Meshy 在读取 API key 之前就拒绝了请求,例如 API key 缺失或无效。此时的响应仍保留 {"message": "..."} 格式的内容。

v1 messagev2 code 与 message
Invalid values: TargetPolycount must be 100 or greaterparameter_out_of_range:target_polycount must be between 100 and 300000
Invalid values: FPS must be one of [24 25 30 60]parameter_invalid_value:post_process.fps must be one of: 24, 25, 30, 60
Invalid values: InputTaskID is a required field; ModelURL is a required fieldparameter_missing:Provide either input_task_id or model_url
failed to validate and download the input image, Fail to download imageinput_download_failed:Could not download image_url: the host example.invalid, or a URL it redirects to, could not be found
Task not found,针对某个 input_task_idinput_task_not_found:input_task_id does not match any of your tasks
Input task is not succeeded, status is FAILEDinput_task_not_ready:input_task_id names a task that failed; use a task that succeeded

以下这些请求在 v1 上可以正常工作,但在 v2 上会返回 400:

  • parameter_missing,对应 texture_model is required unless should_texture is false. Send texture_model (meshy-7, meshy-n1 or meshy-6-lite), or should_texture: false for an untextured mesh.:请求了带 texture 的模型,却没有提供 texture_model。在 Retexture 上,消息为 texture_model is required. Send meshy-7, meshy-n1 or meshy-6-lite.。参见 Texture model。
  • parameter_unknown:请求中包含该 endpoint 未定义的参数,例如一个已被移除的 v1 参数,或拼写错误的名称。message 会指出该参数名以及应改为发送什么。参见 参数处理。
  • parameters_conflict,对应 Send either "input_task_id" or "model_url", not both.:请求中同时包含了两种模型输入。请只发送 input_task_id,即 v1 所使用的那个参数。
  • parameters_conflict,对应 texture_prompt and texture_image_url are mutually exclusive:请求中同时包含了两种 texture 输入,出现在 Image to 3D、Multi-Image to 3D、Retexture,或 Text to 3D 的 refine 请求或一次性调用请求中。请只发送其中一个。参见 请求参数。
  • parameter_unknown,对应 Unknown parameter "<parameter>": it is a v1 parameter. Use /openapi/v2/convert or /openapi/v2/resize instead.:某个 Remesh 请求中包含了尺寸调整参数或 convert_format_only。参见 Remesh。

有三种 404 响应值得加以区分:

  • route_not_found,对应 NoMatchingRoute: Please double check the path and method:该路由在 v2 上不存在,例如 GET /openapi/v2/image-to-3d/{id}。请改用 /openapi/v2/tasks/{id}。
  • task_not_found,对应 Task not found,或在删除操作中对应 Task "<id>" not found:该任务 ID 不存在、属于另一个账户、已被删除,或在其保留期之后已被移除。参见 资产保留期。Creative Lab 的任务 ID 也会返回此错误。
  • input_task_not_found,对应 input_task_id does not match any of your tasks,或 preview_task_id、rig_task_id 对应的相同文本:创建请求中指定的任务不存在、属于另一个账户,或已被删除。