創意工坊 — 手辦 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

建立手辦 Prototype 任務

從來源照片生成一張 Q 版風格的概念圖。傳回的任務 ID 即作為後續 build 端點的 input_task_id。回應結構詳見 Prototype 任務物件

參數

  • Name
    image_url
    Type
    string
    必选
    Description

    提供給 Meshy 用於 Q 版手辦風格化的來源照片。目前支援 .jpg.jpeg.png.webp 格式。

    可透過兩種方式提供圖片:

    • 可公開存取的 URL:可從公開網路存取的 URL。
    • Data URI:圖片的 base64 編碼 Data URI,範例:data:image/jpeg;base64,<your base64-encoded image data>
  • Name
    name
    Type
    string
    Description

    選填的任務名稱,僅用於顯示。最長 100 個字元。

傳回值

回應的 result 欄位會傳回新建立的 figure prototype 任務的 id。輪詢 查詢任務 或訂閱 串流更新 直到任務狀態變為 SUCCEEDED,再將該 ID 作為 build 端點input_task_id 傳入。

失敗情境

  • Name
    400 - Bad Request
    Description

    請求不合法,常見原因:

    • 缺少參數image_url 必填。
    • 圖片格式不支援image_url 不是支援的格式(.jpg.jpeg.png.webp)。
    • 圖片尺寸不合法:圖片過小、檔案超過最大大小上限,或像素數超過上限。
    • URL 無法存取image_url 下載失敗(404 或逾時)。
    • Data URI 不合法:base64 字串格式錯誤。
    • 內容被審核攔截:圖片被 NSFW 或智慧財產權審核標記。
  • Name
    401 - Unauthorized
    Description

    身分驗證失敗,請檢查 API 金鑰。

  • Name
    402 - Payment Required
    Description

    點數不足,無法建立任務。

  • Name
    429 - Too Many Requests
    Description

    請求超出速率限制。

Request

POST
/openapi/creative-lab/figure/v1/prototype
# Stage 1:生成 Q 版风格的概念图
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 範例
從一張來源照片開始,生成 build 階段會使用的 prototype 圖。
作為 Creative Lab Figure 輸入的來源照片
Prototype 輸入
根據來源照片生成的 Q 版手辦 prototype 圖
Prototype 輸出

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

建立手辦 Build 任務

根據已成功的 prototype 任務,產生最終的帶貼圖 3D 手辦。Build 走與 影象生成 3D 相同的圖像生成 3D 管線,因此回應欄位與輸出 URL 與之完全一致。回應結構詳見 Build 任務物件

參數

  • Name
    input_task_id
    Type
    string
    必選
    Description

    透過同一個 OpenAPI 端點建立的 prototype 任務 ID。該 prototype 必須由同一 API key 建立、狀態已變為 SUCCEEDED,且產出剛好一張候選圖。

    透過 webapp 建立的 prototype 任務接受 —— build 端點只接受由 POST /openapi/creative-lab/figure/v1/prototype 產生的任務,其他來源一律回傳 404

  • Name
    name
    Type
    string
    Description

    可選的任務名稱,僅用於顯示。最長 100 個字元。

回傳值

回應的 result 欄位會回傳新建立的 figure build 任務的 id。輪詢 查詢任務 或訂閱 串流更新 直到任務狀態變為 SUCCEEDED,即可從 model_urls.glb 下載帶貼圖的 GLB;如果下游流程更習慣 Wavefront OBJ,也可以同時從 model_urls.objmodel_urls.mtl 下載 OBJ + MTL 組合。

失敗情境

  • Name
    400 - Bad Request
    Description

    請求不合法,常見原因:

    • 缺少參數input_task_id 必填。
    • UUID 不合法input_task_id 不是合法 UUID。
    • 父任務未成功:引用的 prototype 任務尚未達到 SUCCEEDED
    • 沒有候選圖:prototype 任務雖然成功,但未產出任何候選圖。
  • Name
    401 - Unauthorized
    Description

    身分驗證失敗,請檢查 API key。

  • Name
    402 - Payment Required
    Description

    點數不足,無法建立任務。

  • Name
    404 - Not Found
    Description

    引用的 prototype 任務不存在、屬於其他使用者,或是由 webapp 建立的(只接受 API 模式的 prototype 任務)。

  • Name
    429 - Too Many Requests
    Description

    請求超出速率限制。

Request

POST
/openapi/creative-lab/figure/v1/build
# Stage 2:基于已成功的 prototype 任务串联 build
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"
}
Build 範例
Build 任務會把選中的 prototype 圖轉成可下載的帶貼圖 3D 模型。
Creative Lab 手辦 build 模型預覽圖
Build 模型預覽

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

查詢手辦任務

根據有效的任務 id 查詢 prototype 或 build 任務。URL 路徑必須與任務所屬的 stage 一致 —— 透過 /prototype/:id 查詢一個 build 任務會回傳 404,反之亦然。

回應結構詳見 手辦 Prototype 任務物件手辦 Build 任務物件

參數

  • Name
    id
    Type
    path
    Description

    要查詢的 figure 任務的唯一識別碼。

回傳值

回傳 figure 任務物件,具體結構取決於請求的 stage。

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

刪除手辦任務

取消一個手辦任務。如果任務仍處於 PENDING,建立時扣除的點數會自動退還。 已經進入 IN_PROGRESS 的任務可以取消但不會退款(worker 可能已經在消耗運算資源)。 已經處於最終狀態(SUCCEEDEDFAILEDCANCELED)的任務無法取消。

URL 路徑必須與任務所屬的 stage 一致 —— 使用 /prototype/:buildId 發送 DELETE 會回傳 404

路徑參數

  • Name
    id
    Type
    path
    Description

    要取消的手辦任務的唯一識別碼。

回傳值

成功時回傳 204 No Content,回應主體為空。

失敗情境

  • Name
    400 - Bad Request
    Description

    任務已經處於最終狀態,無法取消。

  • Name
    404 - Not Found
    Description

    任務不存在、屬於其他使用者,或所屬 stage 與 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

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

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

串流訂閱手辦任務

透過 Server-Sent Events(SSE)即時訂閱手辦任務更新。URL 路徑必須與任務所屬的 stage 一致 —— 在 /prototype/:buildId/stream 上開啟 stream 會立即返回一則 event: errorstatus_code: 404 的 SSE 事件並關閉連線。

參數

  • Name
    id
    Type
    path
    Description

    要訂閱的手辦任務唯一識別碼。

回傳值

回傳一連串 手辦 Prototype手辦 Build 任務物件的 Server-Sent Events。 對於 PENDINGIN_PROGRESS 狀態的任務,事件串流只會包含必要的 progressstatus 欄位。

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

// 错误事件示例(stage 不匹配或任务不存在)
event: error
data: {
  "status_code": 404,
  "message": "Task not found"
}

// 消息事件示例:表示任务进度。
// PENDING / IN_PROGRESS 状态下,事件流不包含全部字段。
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)

列出手辦任務

依階段分頁列出目前 API 金鑰名下的手辦任務。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 時回傳 手辦 Prototype 任務物件, 列出 /build 時回傳 手辦 Build 任務物件

请求

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

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

响应(列出 Prototype 任务)

[
  {
    "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=***"
    ]
  }
]

手辦 Prototype 任務物件

手辦 Prototype 任務是 Meshy 用來追蹤「從來源照片生成 Q 版概念圖」這一階段的工作單元。 該階段的輸出會透過 input_task_id 串接至 Build 階段

欄位

  • Name
    id
    Type
    string
    Description

    任務的唯一識別碼。我們目前使用 k-sortable UUID 作為實作細節,但應對 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

    任務進度。任務尚未開始時為 0,成功後為 100

  • Name
    created_at
    Type
    timestamp
    Description

    任務建立時間戳,單位為毫秒。

  • Name
    started_at
    Type
    timestamp
    Description

    任務開始時間戳,單位為毫秒。任務尚未開始時為 0

  • Name
    finished_at
    Type
    timestamp
    Description

    任務完成時間戳,單位為毫秒。任務尚未完成時為 0

  • Name
    expires_at
    Type
    timestamp
    Description

    任務結果到期時間戳,單位為毫秒。

  • Name
    preceding_tasks
    Type
    integer
    Description

    前面尚未處理的任務數。

  • Name
    task_error
    Type
    object
    Description

    失敗任務的錯誤詳細資訊。task_error 物件的完整欄位定義詳情請參閱 錯誤

  • Name
    consumed_credits
    Type
    integer
    Description

    此任務消耗的積分數。狀態為 PENDINGIN_PROGRESSSUCCEEDED 時存在;FAILED 時回傳 0(失敗任務會退款)。

  • Name
    image_urls
    Type
    array of strings
    Description

    此 prototype 任務產出的概念圖候選 URL 陣列。目前 API 一律只回傳一張候選圖;保留陣列形式,方便未來在不破壞相容性的前提下擴充為多個候選。

手办 Prototype 任务对象示例

{
  "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 任務物件

手辦 Build 任務是 Meshy 用來追蹤「從已成功的 prototype 任務生成帶貼圖 3D 手辦」 這一階段的工作單元。它內部採用與 影象生成 3D 相同的影象生成 3D 管線, 因此輸出欄位與該端點的 任務物件 形式一致。

欄位

  • 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 物件的完整欄位定義詳情請參閱 錯誤

  • Name
    consumed_credits
    Type
    integer
    Description

    此任務消耗的積分數。FAILED 時回傳 0(失敗任務會退還積分)。

  • Name
    prompt
    Type
    string
    Description

    手辦 Build 一律為空字串。保留此欄位用於與 影象生成 3D 共用的 V2ImageTo3DTaskResponse 形式保持相容。

  • Name
    negative_prompt
    Type
    string
    Description

    手辦 Build 一律為空字串。保留此欄位用於跨端點相容。

  • Name
    texture_prompt
    Type
    string
    Description

    手辦 Build 一律為空字串。保留此欄位用於跨端點相容。

  • Name
    texture_image_url
    Type
    string
    Description

    手辦 Build 一律為空字串。保留此欄位用於跨端點相容。

  • Name
    model_urls
    Type
    object
    Description

    產生的 3D 模型檔案下載 URL。手辦 Build 輸出含貼圖的 GLB,以及偏好 Wavefront OBJ 流程使用的 OBJ + MTL 組合;欄位形式與 影象生成 3D model_urls 物件對齊,未來新增格式不會破壞相容性。

    • Name
      glb
      Type
      string
      Description

      含貼圖 GLB 檔案的下載 URL。

    • Name
      obj
      Type
      string
      Description

      Wavefront OBJ 檔案(包含幾何與 UV)的下載 URL。

    • Name
      mtl
      Type
      string
      Description

      OBJ 配套 MTL 材質檔案的下載 URL。需與 objtexture_urls[0].base_color 一併使用。

  • Name
    thumbnail_url
    Type
    string
    Description

    模型縮圖的下載 URL。

  • Name
    texture_urls
    Type
    array
    Description

    此任務產出的貼圖 URL 物件陣列。目前只包含一個物件,僅含 base color。

    • Name
      base_color
      Type
      string
      Description

      基礎顏色(base color)貼圖的下載 URL。

手办 Build 任务对象示例

{
  "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=***"
    }
  ]
}