Creative Lab — Figure API

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

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

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

Create a Figure Prototype Task

根据源照片生成单张 Q 版风格的概念图。返回的任务 ID 就是你在调用 build endpoint 时需要传入的 input_task_id。响应结构请参考 The Figure Prototype Task Object

参数

  • Name
    image_url
    Type
    string
    必选
    Description

    供 Meshy 风格化为 Q 版手办的源照片。我们目前支持 .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 属性中包含新创建的 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/figure/v1/prototype
# Stage 1: generate a chibi-style concept image
curl https://api.meshy.ai/openapi/creative-lab/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": "018a210d-8ba4-705c-b111-1f1776f7f578"
}
Prototype example
Start with a source portrait, then generate the prototype image used by the build stage.
Source portrait used as the Creative Lab Figure input
Prototype input
Chibi-style figurine prototype image generated from the source photo
Prototype output

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

创建 Figure 构建任务

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

参数

  • Name
    input_task_id
    Type
    string
    必选
    Description

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

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

  • Name
    name
    Type
    string
    Description

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

返回值

响应的 result 属性包含新创建的 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/figure/v1/build
# Stage 2: chain build off a succeeded prototype task
curl https://api.meshy.ai/openapi/creative-lab/figure/v1/build \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
  }'

Response

{
  "result": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb"
}
构建示例
构建任务会将所选的原型图像转换为可下载的带贴图 3D 模型。
Creative Lab Figure 构建模型预览
构建模型预览

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

获取 Figure 任务

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

响应的具体结构请参阅 Figure 原型任务对象Figure 构建任务对象

参数

  • Name
    id
    Type
    path
    Description

    要获取的 Figure 任务的唯一标识符。

返回值

响应内容包含 Figure 任务对象。其具体结构取决于所请求的 是哪个阶段。

Request

GET
/openapi/creative-lab/figure/v1/prototype/018a210d-8ba4-705c-b111-1f1776f7f578
# Prototype
curl https://api.meshy.ai/openapi/creative-lab/figure/v1/prototype/018a210d-8ba4-705c-b111-1f1776f7f578 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

# Build
curl https://api.meshy.ai/openapi/creative-lab/figure/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Prototype Response

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "creative-lab-figure-prototype",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123456000,
  "started_at": 1729123460000,
  "finished_at": 1729123486000,
  "expires_at": 1729382686000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 6,
  "image_urls": [
    "https://assets.meshy.ai/***/concept.png?Expires=***"
  ]
}

Build Response

{
  "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
  "type": "creative-lab-figure-build",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123500000,
  "started_at": 1729123510000,
  "finished_at": 1729123535000,
  "expires_at": 1729382735000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 20,
  "prompt": "",
  "negative_prompt": "",
  "texture_prompt": "",
  "texture_image_url": "",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.mtl?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/preview.png?Expires=***",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/texture_0.png?Expires=***"
    }
  ]
}

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

删除一个 Figure 任务

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

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

路径参数

  • Name
    id
    Type
    path
    Description

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

返回值

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

失败模式

  • Name
    400 - Bad Request
    Description

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

  • Name
    404 - Not Found
    Description

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

Request

DELETE
/openapi/creative-lab/figure/v1/prototype/018a210d-8ba4-705c-b111-1f1776f7f578
curl --request DELETE \
  --url https://api.meshy.ai/openapi/creative-lab/figure/v1/prototype/018a210d-8ba4-705c-b111-1f1776f7f578 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

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

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

Stream a Figure Task

通过 Server-Sent Events (SSE) 流式获取 figure 任务的实时更新。 URL 路径必须与任务所处的阶段匹配——在 /prototype/:buildId/stream 打开流会发出一个携带 status_code: 404 的单一 event: error payload 并关闭该流。

参数

  • Name
    id
    Type
    path
    Description

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

返回

以 Server-Sent Events 的形式返回一个 Figure PrototypeFigure Build 任务对象的流。每一帧都携带该阶段的完整任务对象——与 Get endpoint 返回的形状相同——因此当任务处于 PENDINGIN_PROGRESS 状态时, 输出字段尚未被填充(null[]{}),且 finished_atnull

Request

GET
/openapi/creative-lab/figure/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/stream
curl -N https://api.meshy.ai/openapi/creative-lab/figure/v1/build/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/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.
// Every frame is the full task object; fields not yet populated are null / empty.
// The PENDING frame below is abbreviated to the fields that change.
event: message
data: {
  "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
  "type": "creative-lab-figure-build",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123500000,
  "started_at": 1729123510000,
  "finished_at": 1729123535000,
  "expires_at": 1729382735000,
  "task_error": null,
  "consumed_credits": 20,
  "prompt": "",
  "negative_prompt": "",
  "texture_prompt": "",
  "texture_image_url": "",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.mtl?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/preview.png?Expires=***",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/texture_0.png?Expires=***"
    }
  ]
}

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

获取 Figure 任务列表

获取单个阶段下 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

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

  • Name
    sort_by
    Type
    string
    默认值 -created_at
    Description

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

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

返回值

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

Request

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

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

Response (List Prototype Tasks)

[
  {
    "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "type": "creative-lab-figure-prototype",
    "name": "",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1729123456000,
    "started_at": 1729123460000,
    "finished_at": 1729123486000,
    "expires_at": 1729382686000,
    "preceding_tasks": 0,
    "task_error": null,
    "consumed_credits": 6,
    "image_urls": [
      "https://assets.meshy.ai/***/concept.png?Expires=***"
    ]
  }
]

Figure Prototype 任务对象

Figure Prototype 任务对象是 Meshy 跟踪的一个工作单元,用于根据源照片生成 Q 版风格的概念图。此阶段的输出会通过 input_task_id 串联到构建阶段

属性

  • Name
    id
    Type
    string
    Description

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

  • Name
    type
    Type
    string
    Description

    任务的类型。其值为 creative-lab-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 Figure Prototype Task Object

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "type": "creative-lab-figure-prototype",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123456000,
  "started_at": 1729123460000,
  "finished_at": 1729123486000,
  "expires_at": 1729382686000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 6,
  "image_urls": [
    "https://assets.meshy.ai/***/concept.png?Expires=***"
  ]
}

Figure Build 任务对象

Figure Build 任务对象是 Meshy 用于跟踪任务的工作单元,用于根据已成功的原型任务生成带贴图的 3D 人物模型。它运行的是与 Image to 3D 相同的图生 3D 流程,因此输出字段与该 endpoint 的任务对象一致。

属性

  • Name
    id
    Type
    string
    Description

    任务的唯一标识符。

  • Name
    type
    Type
    string
    Description

    任务的类型。取值为 creative-lab-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

    对于 figure build 始终为空。此字段的存在是为了与 Image to 3D 使用的共享 V2ImageTo3DTaskResponse 结构保持跨 endpoint 兼容性。

  • Name
    negative_prompt
    Type
    string
    Description

    对于 figure build 始终为空。此字段的存在是为了保持跨 endpoint 兼容性。

  • Name
    texture_prompt
    Type
    string
    Description

    对于 figure build 始终为空。此字段的存在是为了保持跨 endpoint 兼容性。

  • Name
    texture_image_url
    Type
    string
    Description

    对于 figure build 始终为空。此字段的存在是为了保持跨 endpoint 兼容性。

  • Name
    model_urls
    Type
    object
    Description

    生成的 3D 模型的可下载 URL。figure build 会输出一个带贴图的 GLB,以及一对 OBJ + MTL 文件,供偏好使用 Wavefront OBJ 格式的流程使用。该字段的结构与 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 material 文件的可下载 URL。需与 obj 以及 texture_urls[0].base_color 中的条目配合使用。

  • Name
    thumbnail_url
    Type
    string
    Description

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

  • Name
    texture_urls
    Type
    array
    Description

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

    • Name
      base_color
      Type
      string
      Description

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

Example Figure Build Task Object

{
  "id": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb",
  "type": "creative-lab-figure-build",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1729123500000,
  "started_at": 1729123510000,
  "finished_at": 1729123535000,
  "expires_at": 1729382735000,
  "preceding_tasks": 0,
  "task_error": null,
  "consumed_credits": 20,
  "prompt": "",
  "negative_prompt": "",
  "texture_prompt": "",
  "texture_image_url": "",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.glb?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.obj?Expires=***",
    "mtl": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/model.mtl?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/preview.png?Expires=***",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/019c320e-9a8f-7a1c-9c11-2a1876f8a9bb/output/texture_0.png?Expires=***"
    }
  ]
}