Creative Lab — 盲盒手办 API

通过两个阶段,将一张源照片变成大头盲盒收藏手办 3D 模型:prototype(原型) 阶段根据你输入的照片生成风格化的概念图,然后 build(构建) 阶段将该概念图转变为带贴图的 3D 模型。 这两个阶段通过 input_task_id 关联在一起。

  • POST /openapi/creative-lab/vinyl-figure/v1/prototype
  • POST /openapi/creative-lab/vinyl-figure/v1/build

POST/openapi/creative-lab/vinyl-figure/v1/prototype

创建一个 Vinyl Figure 原型任务

根据源照片生成一张 vinyl-figure 风格的概念图像。返回的任务 ID 就是你在调用 build endpoint 时作为 input_task_id 传入的值。响应结构请参考 The Vinyl Figure Prototype Task Object

参数

  • Name
    image_url
    Type
    string
    必选
    Description

    供 Meshy 风格化为大头 vinyl figure 的源照片。目前支持 .jpg.jpeg.png.webp 格式。

    提供图像的方式有两种:

    • 公开可访问的 URL:可从公共互联网访问的 URL。
    • Data URI:图像的 base64 编码 data URI。data URI 示例:data:image/jpeg;base64,<your base64-encoded image data>
  • Name
    name
    Type
    string
    Description

    用于显示的可选任务名称。最多 100 个字符。

  • Name
    remove_background
    Type
    boolean
    默认值 false
    Description

    设置为 true 时,原型图像会以移除背景的透明 RGBA PNG 格式返回,方便你将主体合成到任意背景上。

返回值

响应的 result 属性包含新创建的 vinyl figure 原型任务的任务 id。轮询 Get a Task endpoint 或订阅 stream,直到任务达到 SUCCEEDED 状态,然后将该 ID 作为 input_task_id 传给 build endpoint

失败模式

  • Name
    400 - Bad Request
    Description

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

    • 缺少参数image_url 为必填项。
    • 图像格式无效:提供的 image_url 不是受支持的格式(.jpg.jpeg.png.webp)。
    • 图像尺寸超出范围:图像过小、超过最大文件大小,或超过最大像素数。
    • URL 不可达:无法下载 image_url(404 或 timeout)。
    • Data URI 无效:base64 字符串格式有误。
    • 内容被标记:输入图像被 NSFW 或知识产权 moderation 标记。
  • Name
    401 - Unauthorized
    Description

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

  • Name
    402 - Payment Required
    Description

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

  • Name
    429 - Too Many Requests
    Description

    你已超出速率限制。

Request

POST
/openapi/creative-lab/vinyl-figure/v1/prototype
# Stage 1: generate a vinyl-figure-style concept image
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/prototype \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "image_url": "<your publicly accessible image url or base64-encoded data URI>"
  }'

Response

{
  "result": "019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de"
}
Prototype example
Start with a source photo, then generate the prototype image used by the build stage.
Source photo used as the Creative Lab Vinyl Figure input
Prototype input
Big-head vinyl figure prototype image generated from the source photo
Prototype output

POST/openapi/creative-lab/vinyl-figure/v1/build

创建 Vinyl Figure 构建任务

从一个成功的原型任务生成最终的带贴图 3D vinyl figure。构建过程运行与 Image to 3D 相同的图像到 3D 流水线,因此响应对象格式和输出 URL 列表完全一致。响应结构请参阅 Vinyl Figure 构建任务对象

参数

  • Name
    input_task_id
    Type
    string
    必选
    Description

    通过同一 OpenAPI endpoint 创建的原型任务的任务 ID。该原型任务必须是使用相同的 API key 创建的,必须已达到 SUCCEEDED 状态,并且必须已生成恰好一张候选图像。

    通过 webapp 创建的原型任务不被接受——构建 endpoint 仅接受由 POST /openapi/creative-lab/vinyl-figure/v1/prototype 生成的原型任务,其他来源一律返回 404 拒绝。

  • Name
    name
    Type
    string
    Description

    可选的任务名称,用于展示。最多 100 个字符。

返回值

响应中的 result 属性包含新创建的 vinyl figure 构建任务的 id。轮询 获取任务 endpoint 或订阅 流式接口,直到任务达到 SUCCEEDED 状态,然后从 model_urls.glb 下载带贴图的 GLB(如果你的下游流水线更倾向于使用 OBJ,也可以从 model_urls.objmodel_urls.mtl 下载 OBJ + MTL 组合)。

失败模式

  • Name
    400 - Bad Request
    Description

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

    • 缺少参数input_task_id 是必需的。
    • 无效 UUIDinput_task_id 不是有效的 UUID。
    • 父任务未成功:引用的原型任务尚未达到 SUCCEEDED 状态。
    • 没有候选图像:原型任务已成功,但未生成候选图像。
  • Name
    401 - Unauthorized
    Description

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

  • Name
    402 - Payment Required
    Description

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

  • Name
    404 - Not Found
    Description

    引用的原型任务不存在、属于其他用户,或是通过 webapp 创建的(只有 API 模式下创建的原型任务才能链接到构建任务)。

  • Name
    429 - Too Many Requests
    Description

    你已超出速率限制。

Request

POST
/openapi/creative-lab/vinyl-figure/v1/build
# Stage 2: chain build off a succeeded prototype task
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/build \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de"
  }'

Response

{
  "result": "019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef"
}

GET/openapi/creative-lab/vinyl-figure/v1/(prototype|build)/:id

获取盲盒手办任务

根据有效的任务 id 获取一个原型或构建任务。URL 路径 必须与任务所处的阶段相匹配——通过 /prototype/:id 获取构建任务会返回 404,反之亦然。

有关响应结构,请参阅盲盒手办原型任务对象盲盒手办构建任务对象

参数

  • Name
    id
    Type
    path
    Description

    要获取的盲盒手办任务的唯一标识符。

返回值

响应包含盲盒手办任务对象。其结构取决于 所请求的具体阶段。

Request

GET
/openapi/creative-lab/vinyl-figure/v1/prototype/019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de
# Prototype
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/prototype/019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

# Build
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/build/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Prototype Response

{
  "id": "019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de",
  "type": "creative-lab-vinyl-figure-prototype",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1752969600000,
  "started_at": 1752969604000,
  "finished_at": 1752969630000,
  "expires_at": 1753228830000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 6,
  "image_urls": [
    "https://assets.meshy.ai/***/concept.png?Expires=***"
  ]
}

Build Response

{
  "id": "019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef",
  "type": "creative-lab-vinyl-figure-build",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1752969700000,
  "started_at": 1752969710000,
  "finished_at": 1752969735000,
  "expires_at": 1753228935000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 30,
  "prompt": "",
  "negative_prompt": "",
  "texture_prompt": "",
  "texture_image_url": "",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.mtl?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/preview.png?Expires=***",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/texture_0.png?Expires=***"
    }
  ]
}

DELETE/openapi/creative-lab/vinyl-figure/v1/(prototype|build)/:id

删除一个 Vinyl Figure 任务

取消一个 vinyl figure 任务。如果任务仍处于 PENDING 状态,创建时消耗的 credits 将被退还。已处于 IN_PROGRESS 状态的任务会被取消,但不会退款(因为工作进程可能已经在消耗资源)。已经到达终止状态 (SUCCEEDEDFAILEDCANCELED)的任务无法被取消。

URL 路径必须与任务所处的阶段相匹配 —— 对 /prototype/:buildId 执行 DELETE 将返回 404

路径参数

  • Name
    id
    Type
    path
    Description

    要取消的 vinyl figure 任务的唯一标识符。

返回值

成功时返回 204 No Content,响应体为空。

失败情况

  • Name
    400 - Bad Request
    Description

    该任务已处于终止状态,无法取消。

  • Name
    404 - Not Found
    Description

    该任务不存在、属于其他用户,或其所处阶段与 URL 路径不匹配。

Request

DELETE
/openapi/creative-lab/vinyl-figure/v1/prototype/019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de
curl --request DELETE \
  --url https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/prototype/019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

// Returns 204 No Content on success (empty body).

GET/openapi/creative-lab/vinyl-figure/v1/(prototype|build)/:id/stream

流式获取手办玩偶任务

通过 Server-Sent Events(SSE)流式获取手办玩偶任务的实时更新。URL 路径必须与任务所处的阶段相匹配——在 /prototype/:buildId/stream 上打开流会发出一条 status_code: 404event: error 数据包,并随即关闭该流。

参数

  • Name
    id
    Type
    path
    Description

    要进行流式获取的手办玩偶任务的唯一标识符。

返回

以 Server-Sent Events 的形式返回一个由 手办玩偶原型手办玩偶成品 任务对象组成的流。 对于 PENDINGIN_PROGRESS 状态的任务,响应流中将只包含必要的 progressstatus 字段。

Request

GET
/openapi/creative-lab/vinyl-figure/v1/build/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/stream
curl -N https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/build/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response Stream

// Error event example (wrong stage or task not found)
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": "019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef",
  "type": "creative-lab-vinyl-figure-build",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1752969700000,
  "started_at": 1752969710000,
  "finished_at": 1752969735000,
  "expires_at": 1753228935000,
  "task_error": null,
  "consumed_credits": 30,
  "prompt": "",
  "negative_prompt": "",
  "texture_prompt": "",
  "texture_image_url": "",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.mtl?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/preview.png?Expires=***",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/texture_0.png?Expires=***"
    }
  ]
}

GET/openapi/creative-lab/vinyl-figure/v1/(prototype|build)

列出 Vinyl Figure 任务

获取单个阶段中你的 vinyl figure 任务的分页列表。 URL 路径决定阶段——/prototype 返回原型(prototype)任务; /build 返回构建(build)任务。另一阶段的任务不会包含在任一响应中。

路径参数

  • Name
    stage
    Type
    path
    必选
    Description

    prototypebuild 之一。该集合仅返回阶段与 URL 匹配的任务——请求 /prototype 永远不会返回 build 任务,反之亦然。

查询参数

  • Name
    page_num
    Type
    integer
    默认值 1
    Description

    用于分页的页码。

  • Name
    page_size
    Type
    integer
    默认值 10
    Description

    每页数量限制。最大允许值为 50 项。

  • Name
    sort_by
    Type
    string
    默认值 -created_at
    Description

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

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

返回值

返回对应阶段任务对象的分页列表——列出 /prototype 时返回 vinyl figure 原型任务对象, 列出 /build 时返回 vinyl figure 构建任务对象

Request

GET
/openapi/creative-lab/vinyl-figure/v1/prototype
# List prototype tasks
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/prototype?page_size=10 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

# List build tasks
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/build?page_size=10 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response (List Prototype Tasks)

[
  {
    "id": "019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de",
    "type": "creative-lab-vinyl-figure-prototype",
    "name": "",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1752969600000,
    "started_at": 1752969604000,
    "finished_at": 1752969630000,
    "expires_at": 1753228830000,
    "preceding_tasks": 0,
    "task_error": null,
    "consumed_credits": 6,
    "image_urls": [
      "https://assets.meshy.ai/***/concept.png?Expires=***"
    ]
  }
]

The Vinyl Figure Prototype Task Object

Vinyl Figure Prototype Task 对象是 Meshy 用于跟踪根据源照片生成乙烯基手办风格**概念图(concept image)**这一工作单元的任务对象。此阶段的输出会通过 input_task_id 链接到构建阶段

属性

  • Name
    id
    Type
    string
    Description

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

  • Name
    type
    Type
    string
    Description

    任务的类型。其值为 creative-lab-vinyl-figure-prototype

  • Name
    name
    Type
    string
    Description

    创建任务时提供的任务名称。如果未提供名称,则为空字符串。

  • Name
    status
    Type
    string
    Description

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

  • Name
    progress
    Type
    integer
    Description

    任务的 progress。如果任务尚未开始,此属性为 0。任务成功完成后,此值将变为 100

  • Name
    created_at
    Type
    timestamp
    Description

    任务创建时的 timestamp,以毫秒为单位。

  • Name
    started_at
    Type
    timestamp
    Description

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

  • Name
    finished_at
    Type
    timestamp
    Description

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

  • Name
    expires_at
    Type
    timestamp
    Description

    任务结果过期时的 timestamp,以毫秒为单位。

  • Name
    preceding_tasks
    Type
    integer
    Description

    排在前面的任务数量。

  • Name
    task_error
    Type
    object
    Description

    失败任务的错误详情。有关完整的 task_error 对象说明,请参见 Errors

  • Name
    consumed_credits
    Type
    integer
    Description

    此任务消耗的 credits 数量。当任务状态为 PENDINGIN_PROGRESSSUCCEEDED 时会出现该字段。对于 FAILED 任务则返回 0(失败时会退还 credits)。

  • Name
    image_urls
    Type
    array of strings
    Description

    此原型任务生成的概念图候选图片的可下载 URL。目前 API 始终仅返回一个候选图片;该字段设计为数组,以便未来版本可以在不产生破坏性变更的情况下提供多个候选图片。

Example Vinyl Figure Prototype Task Object

{
  "id": "019c8a2e-4b7d-7c3a-8d21-3f2987a1c4de",
  "type": "creative-lab-vinyl-figure-prototype",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1752969600000,
  "started_at": 1752969604000,
  "finished_at": 1752969630000,
  "expires_at": 1753228830000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 6,
  "image_urls": [
    "https://assets.meshy.ai/***/concept.png?Expires=***"
  ]
}

手办模型构建任务对象

手办模型构建任务对象是 Meshy 跟踪的一个工作单元,用于从成功的原型任务生成带贴图的 3D 手办模型。它运行的是与 Image to 3D 相同的图生 3D 流水线,因此输出字段与该 endpoint 的任务对象保持一致。

属性

  • Name
    id
    Type
    string
    Description

    任务的唯一标识符。

  • Name
    type
    Type
    string
    Description

    任务的类型。取值为 creative-lab-vinyl-figure-build

  • Name
    name
    Type
    string
    Description

    创建任务时提供的任务名称。如果未提供名称,则为空字符串。

  • Name
    status
    Type
    string
    Description

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

  • Name
    progress
    Type
    integer
    Description

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

  • Name
    created_at
    Type
    timestamp
    Description

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

  • Name
    started_at
    Type
    timestamp
    Description

    任务开始时的时间戳,单位为毫秒。

  • Name
    finished_at
    Type
    timestamp
    Description

    任务完成时的时间戳,单位为毫秒。

  • Name
    expires_at
    Type
    timestamp
    Description

    任务结果过期时的时间戳,单位为毫秒。

  • Name
    preceding_tasks
    Type
    integer
    Description

    排在此任务之前的任务数量。仅当状态为 PENDING 时有意义。

  • Name
    task_error
    Type
    object
    Description

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

  • Name
    consumed_credits
    Type
    integer
    Description

    此任务消耗的 credits 数量。对于 FAILED 任务,返回 0(失败时会退还 credits)。

  • Name
    prompt
    Type
    string
    Description

    手办模型构建任务中始终为空。之所以保留此字段,是为了与 Image to 3D 所使用的共享 V2ImageTo3DTaskResponse 结构保持跨 endpoint 兼容。

  • Name
    negative_prompt
    Type
    string
    Description

    手办模型构建任务中始终为空。保留此字段是为了跨 endpoint 兼容。

  • Name
    texture_prompt
    Type
    string
    Description

    手办模型构建任务中始终为空。保留此字段是为了跨 endpoint 兼容。

  • Name
    texture_image_url
    Type
    string
    Description

    手办模型构建任务中始终为空。保留此字段是为了跨 endpoint 兼容。

  • Name
    model_urls
    Type
    object
    Description

    生成的 3D 模型的可下载 URL。手办模型构建任务会输出一个带贴图的 GLB,以及供偏好 Wavefront OBJ 的流水线使用的 OBJ + MTL 文件对。该字段结构与 Image to 3D 的 model_urls 对象一致,因此未来新增格式时不会造成破坏性变更。

    • Name
      glb
      Type
      string
      Description

      带贴图的 GLB 文件的可下载 URL。

    • Name
      obj
      Type
      string
      Description

      Wavefront OBJ 文件(geometry + UV)的可下载 URL。

    • Name
      mtl
      Type
      string
      Description

      OBJ 配套的 MTL 材质文件的可下载 URL。请与 obj 以及 texture_urls[0].base_color 中的条目配合使用。

  • Name
    thumbnail_url
    Type
    string
    Description

    模型文件缩略图的可下载 URL。

  • Name
    texture_urls
    Type
    array
    Description

    此任务生成的贴图 URL 对象数组。目前仅包含一个带有基础色贴图(base color map)的对象。

    • Name
      base_color
      Type
      string
      Description

      基础色贴图图像的可下载 URL。

Example Vinyl Figure Build Task Object

{
  "id": "019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef",
  "type": "creative-lab-vinyl-figure-build",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1752969700000,
  "started_at": 1752969710000,
  "finished_at": 1752969735000,
  "expires_at": 1753228935000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 30,
  "prompt": "",
  "negative_prompt": "",
  "texture_prompt": "",
  "texture_image_url": "",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/model.mtl?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/preview.png?Expires=***",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/019c8a31-6e2f-7b4d-9a55-4c3098b2d5ef/output/texture_0.png?Expires=***"
    }
  ]
}