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

創建方頭手辦 Prototype 任務

從源照片生成一張方頭手辦風格的概念圖。返回的任務 ID 即作為後續 build 端點的 input_task_id。響應結構詳見 Prototype 任務對象

參數

  • Name
    image_url
    Type
    string
    必選
    Description

    提供給 Meshy 用於方頭手辦風格化的源照片。目前支持 .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 欄位返回新創建的方頭手辦 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/vinyl-figure/v1/prototype
# Stage 1:生成方頭手辦風格的概念圖
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 範例
從一張源照片開始,生成 build 階段會使用的 prototype 圖。
Source photo used as the Creative Lab Vinyl Figure input
Prototype 輸入
Big-head vinyl figure prototype image generated from the source photo
Prototype 輸出
POST/openapi/creative-lab/vinyl-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/vinyl-figure/v1/prototype 產生的任務,其它來源一律返回 404

  • Name
    name
    Type
    string
    Description

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

返回值

響應的 result 字段返回新創建的方頭手辦 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/vinyl-figure/v1/build
# Stage 2:基於已成功的 prototype 任務串聯 build
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 查詢 prototype 或 build 任務。URL 路徑必須與任務所屬的 stage 一致 —— 透過 /prototype/:id 查詢一個 build 任務會返回 404,反之亦然。

回應結構詳見 方頭手辦 Prototype 任務對象方頭手辦 Build 任務對象

參數

  • Name
    id
    Type
    path
    Description

    要查詢的方頭手辦任務的唯一標識。

返回值

返回方頭手辦任務對象,具體形狀取決於請求的 stage。

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

刪除方頭手辦任務

取消一個方頭手辦任務。如果任務仍處於 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/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

// 成功時返回 204 No Content(響應體為空)。
GET/openapi/creative-lab/vinyl-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/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 事件示例(stage 不匹配或任務不存在)
event: error
data: {
  "status_code": 404,
  "message": "Task not found"
}

// message 事件示例,展示任務進度。
// 對 PENDING 或 IN_PROGRESS 狀態的任務,事件流不會包含全部欄位。
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)

列出方頭手辦任務

按階段分頁列出當前 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/vinyl-figure/v1/prototype
# 列出 Prototype 任務
curl https://api.meshy.ai/openapi/creative-lab/vinyl-figure/v1/prototype?page_size=10 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

# 列出 Build 任務
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=***"
    ]
  }
]

方頭手辦 Prototype 任務物件

方頭手辦 Prototype 任務是 Meshy 用來追蹤「從源照片生成方頭手辦概念圖」這一階段的工作單元。 該階段的輸出透過 input_task_id 連結到 建構階段

字段

  • Name
    id
    Type
    string
    Description

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

    任務進度。任務未開始時為 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 對象的完整字段定義詳情請參閱 Errors

  • Name
    consumed_credits
    Type
    integer
    Description

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

  • Name
    image_urls
    Type
    array of strings
    Description

    該 prototype 任務產出的概念圖候選 URL 陣列。目前 API 始終只返回一張候選;保留陣列形態,方便未來在不破壞兼容性的前提下擴展到多候選。

方頭手辦 Prototype 任務物件範例

{
  "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 任務對象

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

字段

  • 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

    該任務消耗的積分數。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": "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=***"
    }
  ]
}