meshy-5 將於 2026年10月10日 下線。 lowpoly 將於 2026年10月30日 下線。 請在這些日期前切換模型,以免請求出錯。

快速開始

從建立你的 API key 開始

本指南中的每個請求都需要用到它。建立一個 key 只需幾秒鐘。

建立你的 API key

使用 Meshy REST API,只需四個步驟即可產生你的第一個 3D 模型。


1取得你的 API key

在 Developer Platform 的 API Keys 頁面建立一個 API key——離開該頁面後你將無法再次檢視它,因此請妥善保存。每個請求都透過 Authorization 請求標頭中的 Bearer 權杖進行 authentication——參見 Authentication。

在 Developer Platform 中開啟 API Keys 頁面,然後建立你的 key


2發起你的第一個 Image-to-3D 請求

匯出你的 key,然後使用 Image to 3D 建立你的第一個任務。想用文字 prompt 或多張照片作為輸入?請參見 Text to 3D 或 Multi-Image to 3D。

Export your key

export MESHY_API_KEY="<your-api-key>"

下方所有範例都使用這張照片——你可以替換為自己的 image_url 來嘗試其他內容。

用作本指南中 Image to 3D 輸入的範例奇幻角色插圖
範例輸入

Request

POST
/openapi/v1/image-to-3d
curl https://api.meshy.ai/openapi/v1/image-to-3d \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp"
  }'

3檢查任務狀態

請求會立即傳回一個任務 ID。輪詢同一個 endpoint,直到 status 變為 SUCCEEDED——請將下方的 <task_id> 替換為第 2 步中傳回的 ID。

Request

GET
/openapi/v1/image-to-3d/:id
curl https://api.meshy.ai/openapi/v1/image-to-3d/<task_id> \
  -H "Authorization: Bearer ${MESHY_API_KEY}"

Response — SUCCEEDED

{
  "id": "018a210d-8ba4-705c-b111-1f1776f7f578",
  "status": "SUCCEEDED",
  "progress": 100,
  "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=***"
  },
  "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
  "task_error": {
    "message": ""
  }
}

4下載你的模型

從上方回應中的 model_urls 取得模型。每種格式(GLB、FBX、OBJ、USDZ、STL)都是一個帶簽章、限時有效的 URL——你也可以跳過命令列,直接將 URL 貼到瀏覽器網址列中進行下載。

Download

model_urls.glb
curl -L "<model_urls.glb from the response above>" -o model.glb
由範例奇幻角色照片產生的 3D 模型結果
你的結果

整合到一起

更想要一個能完成全部流程的腳本——建立、輪詢、下載?

Full script

import axios from 'axios';
import fs from 'fs';

const headers = { Authorization: `Bearer ${process.env.MESHY_API_KEY}` };
const imageUrl = 'https://docs.meshy.ai/images/api/quick-start/source-photo.webp';

// 1. Create the task
const { data: created } = await axios.post(
  'https://api.meshy.ai/openapi/v1/image-to-3d',
  { image_url: imageUrl },
  { headers },
);
const taskId = created.result;

// 2. Poll until it finishes
let task;
while (true) {
  const { data, headers: resHeaders } = await axios.get(`https://api.meshy.ai/openapi/v1/image-to-3d/${taskId}`, { headers });
  task = data;
  if (task.status === 'SUCCEEDED' || task.status === 'FAILED') break;
  const waitSeconds = Number(resHeaders['retry-after']) || 5;
  await new Promise((resolve) => setTimeout(resolve, waitSeconds * 1000));
}

// 3. Download the result (only if the task succeeded)
if (task.status !== 'SUCCEEDED') {
  throw new Error(`Task ${task.status}: ${task.task_error?.message || 'unknown error'}`);
}
const { data: model } = await axios.get(task.model_urls.glb, { responseType: 'arraybuffer' });
fs.writeFileSync('model.glb', model);
console.log('Saved model.glb');

探索常見工作流程


後續步驟

  • 更喜歡 UI?開啟 Developer Platform——在 Playground 中執行請求、追蹤用量和請求紀錄,並管理 webhook。
  • 瀏覽完整的 API reference,瞭解每一個 endpoint。
  • 從可執行的範例中學習:跟隨 Cookbook 中的逐步教學操作,並閱讀 Developer Blog 上的教學和開發故事。
  • 在投入正式環境之前,請查看 Pricing、Rate Limits 和 Errors。
  • 關注 更新日誌,瞭解更新和錯誤修正情況。
  • 有意見回饋或遇到問題?歡迎加入我們的 Discord community——我們很樂意聽到你的聲音!