lowpoly 30 अक्टू॰ 2026 को बंद हो जाएगा। अनुरोध त्रुटियों से बचने के लिए इन तारीखों से पहले मॉडल बदल लें। सभी बहिष्करण देखें

क्विकस्टार्ट

अपनी API की बनाकर शुरुआत करें

इस गाइड में हर रिक्वेस्ट के लिए इसकी ज़रूरत होती है। एक की बनाने में बस कुछ सेकंड लगते हैं।

अपनी API की बनाएँ

Meshy REST API के साथ चार चरणों में अपना पहला 3D मॉडल बनाएँ, API की बनाने से लेकर मॉडल डाउनलोड करने तक।


1अपनी API की प्राप्त करें

Developer Platform के API Keys पेज पर एक API की बनाएँ। उस स्क्रीन को छोड़ने के बाद आप की को दोबारा नहीं देख सकते, इसलिए इसे किसी सुरक्षित जगह पर रखें। इसे हर रिक्वेस्ट में Authorization हेडर में Bearer टोकन के रूप में भेजें। प्रमाणीकरण देखें।

API की बनाने और प्रबंधित करने के लिए आपको एक पेड प्लान की ज़रूरत है। Free प्लान पर, आप अपनी खुद की की नहीं बना सकते, और Playground टेस्टिंग के लिए एक बिल्ट-इन की का उपयोग करता है।

Developer Platform में API Keys पेज खोलें, फिर अपनी की बनाएँ


2इमेज से 3D टास्क बनाएँ

इमेज से 3D पर एक इमेज भेजें। इसके बजाय टेक्स्ट prompt या कई फ़ोटो से शुरू करने के लिए, टेक्स्ट से 3D या मल्टी-इमेज से 3D का उपयोग करें।

पहले, अपनी की को एक एनवायरनमेंट वेरिएबल में स्टोर करें:

Export your key

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

निम्नलिखित सभी उदाहरण इस फ़ोटो का उपयोग करते हैं। किसी अन्य इमेज को आज़माने के लिए, image_url बदलें।

Sample fantasy character illustration used as the Image to 3D input in this guide
नमूना इनपुट

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टास्क स्टेटस जांचें

टास्क बैकग्राउंड में चलता है और आमतौर पर कुछ मिनट लेता है। status के SUCCEEDED, FAILED, या CANCELED होने तक उसी एंडपॉइंट से टास्क प्राप्त करते रहें। निम्नलिखित रिक्वेस्ट में, <task_id> को चरण 2 से प्राप्त ID से बदलें। रिक्वेस्ट के बीच, Retry-After हेडर में दी गई संख्या जितने सेकंड प्रतीक्षा करें।

सामान्य प्रोसेसिंग समय के लिए, और कब तक प्रतीक्षा करके छोड़ देना चाहिए, इसके लिए Task lifecycle देखें।

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": null
}

यदि टास्क विफल होता है, तो status, FAILED होता है, और task_error इसका कारण बताता है। इनपुट ठीक करें या दूसरा टास्क बनाएँ। एरर देखें।


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
The resulting 3D model generated from the sample fantasy character photo
आपका परिणाम

इसे सब एक साथ जोड़ें

यह स्क्रिप्ट टास्क बनाती है, इसके पूरा होने का इंतज़ार करती है, और मॉडल डाउनलोड करती है।

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, timeout: 60_000 },
);
const taskId = created.result;

// 2. Poll until it finishes, for up to 60 minutes
const deadline = Date.now() + 60 * 60 * 1000;
let task;
while (true) {
  const { data, headers: resHeaders } = await axios.get(
    `https://api.meshy.ai/openapi/v1/image-to-3d/${taskId}`,
    { headers, timeout: 30_000 },
  );
  task = data;
  if (['SUCCEEDED', 'FAILED', 'CANCELED'].includes(task.status)) break;
  if (Date.now() > deadline) {
    // The task is still running. Check it again later with the same task ID instead of creating a new one.
    throw new Error(`Task ${taskId} is still ${task.status}; check it again later`);
  }
  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');

सामान्य वर्कफ़्लो एक्सप्लोर करें


अगले कदम