图像转3D API

图像转3D API 是一项功能,允许您将 Meshy 的图像转3D能力集成到您自己的应用程序中。在本节中,您将找到开始使用此API所需的所有信息。


POST/openapi/v1/image-to-3d

创建图像转3D任务

此端点允许您创建一个新的图像转3D任务。请参阅图像转3D任务对象以查看图像转3D任务对象包含哪些属性。

参数

必需属性

  • Name
    image_url
    Type
    string
    Description

    提供一张用于模型生成的图像。当前支持.jpg.jpeg.png格式。

    有两种方式提供图片:

    • 公网可访问的URL:一个可以从公网访问的图片链接。
    • Data URI:图片的base64编码数据URI。例如:data:image/jpeg;base64,<your base64-encoded image data>

可选属性

  • Name
    ai_model
    Type
    string
    Description

    要使用的模型ID。

    可选值:

    • meshy-4
    • meshy-5

    未指定时默认为meshy-4

  • Name
    topology
    Type
    string
    Description

    指定生成模型的拓扑结构。

    可选值:

    • quad:生成以四边形为主的网格。
    • triangle:生成简化的三角网格。

    未指定时默认为triangle

  • Name
    target_polycount
    Type
    integer
    Description

    指定生成模型的目标面数。实际面数可能会根据几何复杂度有所偏差。

    有效取值范围根据用户等级不同:

    • 100 到 300,000(含)

    未指定时默认为30,000

  • Name
    symmetry_mode
    Type
    string
    Description

    symmetry_mode字段控制生成过程中对称性的行为。

    有效值:

    • off:关闭对称。
    • auto:根据输入几何自动判断并应用对称。
    • on:强制在生成过程中应用对称。

    未指定时默认为auto

  • Name
    should_remesh
    Type
    boolean
    Description

    should_remesh标志控制是否启用重建网格阶段。

    当设置为false时,将直接返回三角网格,忽略topology和target_polycount。

    未指定时默认为true

  • Name
    should_texture
    Type
    boolean
    Description

    should_texture标志决定是否生成贴图。设置为false时跳过贴图阶段,仅生成网格(消耗5积分)。设置为true时会生成贴图(消耗额外10积分)。未指定时默认为true

  • Name
    enable_pbr
    Type
    boolean
    Description

    生成PBR贴图(金属度、粗糙度、法线)以及基础色。

    未指定时默认为false

  • Name
    texture_prompt
    Type
    string
    Description

    提供文本提示以引导贴图生成。最多600字符。

  • Name
    texture_image_url
    Type
    string
    Description

    提供一张2D图片以引导贴图生成。当前支持.jpg.jpeg.png格式。

    有两种方式提供图片:

    • 公网可访问的URL:一个可以从公网访问的图片链接。
    • Data URI:图片的base64编码数据URI。例如:data:image/jpeg;base64,<your base64-encoded image data>

返回值

响应的result字段包含新建图像转3D任务的任务id

请求

POST
/openapi/v1/image-to-3d
curl https://api.meshy.ai/openapi/v1/image-to-3d \
  -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>",
    "enable_pbr": true,
    "should_remesh": true,
    "should_texture": true
  }'


 ## Using Data URI example
curl https://api.meshy.ai/openapi/v1/image-to-3d \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "image_url": "data:image/png;base64,${YOUR_BASE64_ENCODED_IMAGE_DATA}",
    "enable_pbr": true,
    "should_remesh": true,
    "should_texture": true
  }'

响应

{
  "result": "018a210d-8ba4-705c-b111-1f1776f7f578"
}

GET/openapi/v1/image-to-3d/:id

获取图像转3D任务

此端点允许您通过有效的任务id获取图像转3D任务。请参阅图像转3D任务对象以查看图像转3D任务对象包含哪些属性。

参数

  • Name
    id
    Type
    path
    Description

    要获取的图像转3D任务的唯一标识符。

返回值

响应包含图像转3D任务对象。详情请查阅图像转3D任务对象部分。

请求

GET
/openapi/v1/image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578
curl https://api.meshy.ai/openapi/v1/image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

响应

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
    "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
    "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "texture_prompt": "",
  "progress": 100,
  "started_at": 1692771667037,
  "created_at": 1692771650657,
  "expires_at": 1692771679037,
  "finished_at": 1692771669037,
  "status": "SUCCEEDED",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
      "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
      "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  }
}

GET/openapi/v1/image-to-3d

列出图像转3D任务

此端点允许您获取图像转3D任务的列表。

参数

可选属性

  • Name
    page_num
    Type
    integer
    Description

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

  • Name
    page_size
    Type
    integer
    Description

    每页返回的任务数量。默认为10,最大允许为50

  • Name
    sort_by
    Type
    string
    Description

    排序字段。可选值:

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

返回值

返回分页的图像转3D任务对象列表。

请求

GET
/openapi/v1/image-to-3d
curl https://api.meshy.ai/openapi/v1/image-to-3d?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"

响应

[
  {
    "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "model_urls": { 
      "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
      "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
      "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
      "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
    },
    "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
    "texture_prompt": "",
    "progress": 100,
    "started_at": 1692771667037,
    "created_at": 1692771650657,
    "expires_at": 1692771679037,
    "finished_at": 1692771669037,
    "status": "SUCCEEDED",
    "texture_urls": [
      {
        "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
        "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
        "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
        "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
      }
    ],
    "preceding_tasks": 0,
    "task_error": {
      "message": ""
    }
  }
]

GET/openapi/v1/image-to-3d/:id/stream

流式图像转3D任务

此端点通过Server-Sent Events (SSE)流式返回图像转3D任务的实时进度更新。

参数

  • Name
    id
    Type
    path
    Description

    要流式获取的图像转3D任务的唯一标识符。

返回值

返回图像转3D任务对象的流式Server-Sent Events。

对于PENDINGIN_PROGRESS状态的任务,响应流仅包含必要的progressstatus字段。

请求

GET
/openapi/v1/image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578/stream
curl -N https://api.meshy.ai/openapi/v1/image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"

响应流

// 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": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
  "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
  "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
  "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
  "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "texture_prompt": "",
  "progress": 100,
  "started_at": 1692771667037,
  "created_at": 1692771650657,
  "expires_at": 1692771679037,
  "finished_at": 1692771669037,
  "status": "SUCCEEDED",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
      "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
      "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  }
}

图像转3D任务对象

图像转3D任务对象是Meshy用于追踪从图像输入生成3D模型的工作单元。 该对象包含以下属性:

属性

  • Name
    id
    Type
    string
    Description

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

  • Name
    model_urls
    Type
    object
    Description

    Meshy生成的可下载带贴图3D模型文件的URL。如果某种格式未生成,则不会返回该属性。

    • Name
      glb
      Type
      string
      Description

      GLB文件的可下载URL。

    • Name
      fbx
      Type
      string
      Description

      FBX文件的可下载URL。

    • Name
      obj
      Type
      string
      Description

      OBJ文件的可下载URL。

    • Name
      usdz
      Type
      string
      Description

      USDZ文件的可下载URL。

  • Name
    thumbnail_url
    Type
    string
    Description

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

  • Name
    texture_prompt
    Type
    string
    Description

    用于引导贴图生成的文本提示。

  • Name
    texture_image_url
    Type
    string
    Description

    用于引导贴图生成的图片URL。

  • Name
    progress
    Type
    integer
    Description

    任务进度。如果任务尚未开始,该属性为0。任务成功后为100

  • Name
    started_at
    Type
    timestamp
    Description

    任务开始的时间戳(毫秒)。如果任务尚未开始,该属性为0

  • Name
    created_at
    Type
    timestamp
    Description

    任务创建的时间戳(毫秒)。

  • Name
    expires_at
    Type
    timestamp
    Description

    任务结果过期的时间戳(毫秒)。

  • Name
    finished_at
    Type
    timestamp
    Description

    任务完成的时间戳(毫秒)。如果任务尚未完成,该属性为0

  • Name
    status
    Type
    string
    Description

    任务状态。可能的值有PENDINGIN_PROGRESSSUCCEEDEDFAILEDCANCELED

  • Name
    texture_urls
    Type
    array
    Description

    任务生成的贴图URL对象数组。通常只包含一个贴图URL对象。每个贴图URL包含以下属性:

    • Name
      base_color
      Type
      string
      Description

      基础色贴图的可下载URL。

    • Name
      metallic
      Type
      string
      Description

      金属度贴图的可下载URL。

    • Name
      normal
      Type
      string
      Description

      法线贴图的可下载URL。

    • Name
      roughness
      Type
      string
      Description

      粗糙度贴图的可下载URL。

  • Name
    preceding_tasks
    Type
    integer
    Description

    前置任务数量。

  • Name
    task_error
    Type
    object
    Description

    错误对象,包含任务失败时的错误信息。如果任务成功,message应为空。

    • Name
      message
      Type
      string
      Description

      详细错误信息。

图像转3D任务对象示例

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
    "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
    "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "texture_prompt": "",
  "texture_image_url": "",
  "progress": 1,
  "started_at": 1692771667037,
  "created_at": 1692771650657,
  "expires_at": 1692771679037,
  "finished_at": 1692771669037,
  "status": "SUCCEEDED",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
      "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
      "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  },
}

多图像转3D API

多图像转3D API 是一项功能,允许您将 Meshy 的多图像转3D能力集成到您自己的应用程序中。在本节中,您将找到开始使用此API所需的所有信息。


POST/openapi/v1/multi-image-to-3d

创建多图像转3D任务

此端点允许您创建一个新的多图像转3D任务。请参阅多图像转3D任务对象以查看多图像转3D任务对象包含哪些属性。 请注意,多图像转3D仅支持Meshy-5模型。

参数

必需属性

  • Name
    image_urls
    Type
    array
    Description

    提供1到4张图片用于模型生成。当前支持.jpg.jpeg.png格式。所有图片应为同一物体的不同角度以获得最佳效果。

    每张图片有两种提供方式:

    • 公网可访问的URL:一个可以从公网访问的图片链接。
    • Data URI:图片的base64编码数据URI。例如:data:image/jpeg;base64,<your base64-encoded image data>

可选属性

  • Name
    ai_model
    Type
    string
    Description

    要使用的模型ID。

    可选值:

    • meshy-5

    未指定时默认为meshy-5

  • Name
    topology
    Type
    string
    Description

    指定生成模型的拓扑结构。

    可选值:

    • quad:生成以四边形为主的网格。
    • triangle:生成简化的三角网格。

    未指定时默认为triangle

  • Name
    target_polycount
    Type
    integer
    Description

    指定生成模型的目标面数。实际面数可能会根据几何复杂度有所偏差。

    有效取值范围根据用户等级不同:

    • 100 到 300,000(含)

    未指定时默认为30,000

  • Name
    symmetry_mode
    Type
    string
    Description

    symmetry_mode字段控制生成过程中对称性的行为。

    有效值:

    • off:关闭对称。
    • auto:根据输入几何自动判断并应用对称。
    • on:强制在生成过程中应用对称。

    未指定时默认为auto

  • Name
    should_remesh
    Type
    boolean
    Description

    should_remesh标志控制是否启用重建网格阶段。

    当设置为false时,将直接返回三角网格,忽略topology和target_polycount。

    未指定时默认为true

  • Name
    should_texture
    Type
    boolean
    Description

    should_texture标志决定是否生成贴图。设置为false时跳过贴图阶段,仅生成网格(消耗5积分)。设置为true时会生成贴图(消耗额外10积分)。未指定时默认为true

  • Name
    texture_prompt
    Type
    string
    Description

    提供文本提示以引导贴图生成。最多600字符。

返回值

响应的result字段包含新建多图像转3D任务的任务id

请求

POST
/openapi/v1/multi-image-to-3d
curl https://api.meshy.ai/openapi/v1/multi-image-to-3d \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "image_urls": [
      "<your publicly accessible image url or base64-encoded data URI>",
      "<your second publicly accessible image url or base64-encoded data URI>"
    ],
    "should_remesh": true,
    "should_texture": true
  }'


 ## Using Data URI example
curl https://api.meshy.ai/openapi/v1/multi-image-to-3d \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "image_urls": [
      "data:image/png;base64,${YOUR_BASE64_ENCODED_IMAGE_DATA_1}",
      "data:image/png;base64,${YOUR_BASE64_ENCODED_IMAGE_DATA_2}"
    ],
    "should_remesh": true,
    "should_texture": true
  }'

响应

{
  "result": "018a210d-8ba4-705c-b111-1f1776f7f578"
}

GET/openapi/v1/multi-image-to-3d/:id

获取多图像转3D任务

此端点允许您通过有效的任务id获取多图像转3D任务。 请参考多图像转3D任务对象查看多图像转3D任务对象包含的属性。

参数

  • Name
    id
    Type
    path
    Description

    要获取的多图像转3D任务的唯一标识符。

返回

响应包含多图像转3D任务对象。查看多图像转3D任务对象部分了解详情。

请求

GET
/openapi/v1/multi-image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578
curl https://api.meshy.ai/openapi/v1/multi-image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

响应

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
    "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
    "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "texture_prompt": "",
  "progress": 100,
  "started_at": 1692771667037,
  "created_at": 1692771650657,
  "expires_at": 1692771679037,
  "finished_at": 1692771669037,
  "status": "SUCCEEDED",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
      "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
      "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  }
}

GET/openapi/v1/multi-image-to-3d

列出多图像转3D任务

此端点允许您获取多图像转3D任务列表。

参数

可选属性

  • Name
    page_num
    Type
    integer
    Description

    分页页码。从1开始,默认为1

  • Name
    page_size
    Type
    integer
    Description

    每页大小限制。默认为10项。最大允许50项。

  • Name
    sort_by
    Type
    string
    Description

    排序字段。可用值:

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

返回

返回多图像转3D任务对象的分页列表。

请求

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

响应

[
  {
    "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "model_urls": {
      "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
      "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
      "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
      "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
    },
    "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
    "texture_prompt": "",
    "progress": 100,
    "started_at": 1692771667037,
    "created_at": 1692771650657,
    "expires_at": 1692771679037,
    "finished_at": 1692771669037,
    "status": "SUCCEEDED",
    "texture_urls": [
      {
        "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
        "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
        "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
        "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
      }
    ],
    "preceding_tasks": 0,
    "task_error": {
      "message": ""
    }
  }
]

GET/openapi/v1/multi-image-to-3d/:id/stream

流式多图像转3D任务

此端点使用服务器发送事件(SSE)流式传输多图像转3D任务的实时更新。

参数

  • Name
    id
    Type
    path
    Description

    要流式传输的多图像转3D任务的唯一标识符。

返回

以服务器发送事件的形式返回多图像转3D任务对象的流。

对于PENDINGIN_PROGRESS状态的任务,响应流将只包含必要的progressstatus字段。

请求

GET
/openapi/v1/multi-image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578/stream
curl -N https://api.meshy.ai/openapi/v1/multi-image-to-3d/018a210d-8ba4-705c-b111-1f1776f7f578/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"

响应流

// 错误事件示例
event: error
data: {
  "status_code": 404,
  "message": "任务未找到"
}

// 消息事件示例说明任务进度
// 对于PENDING或IN_PROGRESS状态的任务,响应流不会包含所有字段
event: message
data: {
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
  "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
  "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
  "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
  "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "texture_prompt": "",
  "progress": 100,
  "started_at": 1692771667037,
  "created_at": 1692771650657,
  "expires_at": 1692771679037,
  "finished_at": 1692771669037,
  "status": "SUCCEEDED",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
      "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
      "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  }
}

多图像转3D任务对象

多图像转3D任务对象是Meshy用于追踪从多张图片(1到4张)生成3D模型的工作单元。图片应为同一物体,最好是不同视角或角度。 该对象包含以下属性:

属性

  • Name
    id
    Type
    string
    Description

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

  • Name
    model_urls
    Type
    object
    Description

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

    • Name
      glb
      Type
      string
      Description

      GLB文件的可下载URL。

    • Name
      fbx
      Type
      string
      Description

      FBX文件的可下载URL。

    • Name
      obj
      Type
      string
      Description

      OBJ文件的可下载URL。

    • Name
      usdz
      Type
      string
      Description

      USDZ文件的可下载URL。

  • Name
    thumbnail_url
    Type
    string
    Description

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

  • Name
    texture_prompt
    Type
    string
    Description

    用于指导纹理生成过程的文本提示。

  • Name
    progress
    Type
    integer
    Description

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

  • Name
    started_at
    Type
    timestamp
    Description

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

  • Name
    created_at
    Type
    timestamp
    Description

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

  • Name
    expires_at
    Type
    timestamp
    Description

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

  • Name
    finished_at
    Type
    timestamp
    Description

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

  • Name
    status
    Type
    string
    Description

    任务的状态。可能的值包括:PENDING(等待中)、IN_PROGRESS(进行中)、SUCCEEDED(成功)、FAILED(失败)、CANCELED(已取消)。

  • Name
    texture_urls
    Type
    array
    Description

    由任务生成的纹理URL对象数组。通常只包含一个纹理URL对象。每个纹理URL具有以下属性:

    • Name
      base_color
      Type
      string
      Description

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

    • Name
      metallic
      Type
      string
      Description

      金属度贴图的可下载URL。

    • Name
      normal
      Type
      string
      Description

      法线贴图的可下载URL。

    • Name
      roughness
      Type
      string
      Description

      粗糙度贴图的可下载URL。

  • Name
    preceding_tasks
    Type
    integer
    Description

    前置任务的数量。

  • Name
    task_error
    Type
    object
    Description

    如果任务失败,包含错误信息的错误对象。如果任务成功,message属性应为空。

    • Name
      message
      Type
      string
      Description

      详细的错误信息。

多图像生成3D任务对象示例

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "model_urls": {
    "glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***",
    "fbx": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.fbx?Expires=***",
    "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***",
    "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "texture_prompt": "",
  "progress": 1,
  "started_at": 1692771667037,
  "created_at": 1692771650657,
  "expires_at": 1692771679037,
  "finished_at": 1692771669037,
  "status": "SUCCEEDED",
  "texture_urls": [
    {
      "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
      "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX",
      "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX",
      "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX"
    }
  ],
  "preceding_tasks": 0,
  "task_error": {
    "message": ""
  },
}