क्विकस्टार्ट
अपनी API की बनाकर शुरुआत करें
इस गाइड में हर रिक्वेस्ट के लिए इसकी आवश्यकता होती है। की बनाने में बस कुछ सेकंड लगते हैं।
अपनी API की बनाएंMeshy API v2 के साथ चार चरणों में अपना पहला 3D मॉडल बनाएं। आप एक API की प्राप्त करते हैं, एक टास्क बनाते हैं, Tasks रूट पर उसकी स्थिति ट्रैक करते हैं, और परिणाम डाउनलोड करते हैं।
क्या आप v1 से माइग्रेट कर रहे हैं? इसके बजाय Migrate to API v2 देखें।
1अपनी API की प्राप्त करें
Developer Platform के API Keys पेज पर API की बनाएं। उस स्क्रीन को छोड़ने के बाद आप की को दोबारा नहीं देख सकते, इसलिए इसे किसी सुरक्षित स्थान पर सहेजें। इसे हर रिक्वेस्ट में Authorization हेडर में Bearer टोकन के रूप में भेजें। देखें Authentication।
API की बनाने और प्रबंधित करने के लिए आपके पास पेड प्लान होना चाहिए। Free प्लान पर, आप अपनी खुद की कीज़ नहीं बना सकते, और Playground टेस्टिंग के लिए एक बिल्ट-इन की का उपयोग करता है।

की को अपने कोड में पेस्ट करने के बजाय एक एनवायरनमेंट वेरिएबल में स्टोर करें। अपने टर्मिनल में यह चलाएं:
Export your key
export MESHY_API_KEY="<your-api-key>"
JavaScript उदाहरण fetch का उपयोग करते हैं, जो Node.js 18 और बाद के वर्जन में बिल्ट-इन है। Python उदाहरण requests (pip install requests) का उपयोग करते हैं।
2एक इमेज से 3D टास्क बनाएं
इमेज से 3D को एक इमेज भेजें। इसके बजाय टेक्स्ट prompt से या कई फ़ोटो से शुरू करने के लिए, टेक्स्ट से 3D या मल्टी-इमेज से 3D का उपयोग करें। हर एंडपॉइंट यहां से उसी तरह काम करता है।
निम्नलिखित सभी उदाहरण इसी फ़ोटो का उपयोग करते हैं और मॉडल को Meshy 7 से टेक्सचर करते हैं, जिसे texture_model चुनता है। किसी दूसरी इमेज को आज़माने के लिए, image_url बदलें। कोई अन्य टेक्सचर मॉडल चुनने के लिए, टेक्सचर मॉडल देखें।

Request
curl https://api.meshy.ai/openapi/v2/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",
"texture_model": "meshy-7"
}'
प्रतिक्रिया task object के साथ 202 Accepted होती है। इसका id सुरक्षित रखें, क्योंकि अगले हर चरण में इसकी आवश्यकता होगी। Location हेडर टास्क को पढ़ने के लिए पथ देता है।
Response: 202 Accepted
{
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"type": "image-to-3d",
"status": "PENDING",
"progress": 0,
"created_at": 1791846275575,
"started_at": null,
"finished_at": null,
"expires_at": null,
"preceding_tasks": 1,
"consumed_credits": 30,
"task_error": null,
"input": {
"image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp",
"texture_model": "meshy-7"
},
"output": null
}
3टास्क पूरा होने तक उसकी स्थिति देखें
टास्क बैकग्राउंड में चलता है और आमतौर पर लगभग 2 मिनट लेता है। status के SUCCEEDED, FAILED, या CANCELED होने तक इसे /openapi/v2/tasks/<task_id> से प्राप्त करते रहें। रिक्वेस्ट के बीच, Retry-After हेडर में दी गई सेकंड की संख्या जितना इंतज़ार करें।
यही रूट हर एंडपॉइंट के टास्क के लिए काम करता है। सामान्य प्रोसेसिंग समय, और कब तक इंतज़ार करने के बाद छोड़ देना चाहिए, इसके लिए देखें Processing times और How long to wait।
Request
curl https://api.meshy.ai/openapi/v2/tasks/<task_id> \
-H "Authorization: Bearer ${MESHY_API_KEY}"
Response: SUCCEEDED
{
"id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"type": "image-to-3d",
"status": "SUCCEEDED",
"progress": 100,
"created_at": 1791846275575,
"started_at": 1791846275578,
"finished_at": 1791846334536,
"expires_at": 1792105534536,
"preceding_tasks": 0,
"consumed_credits": 30,
"task_error": null,
"input": {
"image_url": "https://docs.meshy.ai/images/api/quick-start/source-photo.webp",
"texture_model": "meshy-7"
},
"output": {
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.glb?Expires=***"
},
"thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***",
"thumbnail_urls": null,
"texture_urls": [
{
"base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***",
"metallic": null,
"roughness": null,
"normal": null,
"metallic_roughness": null,
"emission": null
}
]
}
}
अगर टास्क विफल होता है, तो status, FAILED होगा, और task_error में इसका कारण बताया जाएगा। इनपुट को ठीक करें या एक नया टास्क बनाएं। देखें एरर।
पोलिंग करने के बजाय टास्क के पूरा होने की सूचना पाने के लिए, टास्क को स्ट्रीम करें या webhook का उपयोग करें।
4अपना मॉडल डाउनलोड करें
फ़ाइलें output में हैं। output.model_urls.glb एक साइन्ड URL है जो expires_at तक काम करता है। आप इसे अपने ब्राउज़र में पेस्ट करके भी फ़ाइल डाउनलोड कर सकते हैं।
इमेज से 3D केवल एक GLB फ़ाइल लौटाता है, जब तक कि आप टास्क बनाते समय target_formats में अन्य फॉर्मेट सूचीबद्ध न करें।
Download
curl -L "<output.model_urls.glb from the response above>" -o model.glb

Enterprise को छोड़कर हर प्लान पर, Meshy फ़ाइलों को 3 दिनों तक रखता है। उससे पहले आपको जिन फ़ाइलों की जरूरत है उन्हें डाउनलोड कर लें। देखें Asset retention।
पूरी स्क्रिप्ट एक साथ
यह स्क्रिप्ट टास्क बनाती है, उसके पूरा होने का इंतज़ार करती है, और मॉडल डाउनलोड करती है।
Full script
import { writeFile } from "node:fs/promises";
const API = "https://api.meshy.ai/openapi/v2";
const headers = {
Authorization: `Bearer ${process.env.MESHY_API_KEY}`,
"Content-Type": "application/json",
};
async function call(path, init = {}) {
const res = await fetch(`${API}${path}`, {
...init,
headers,
signal: AbortSignal.timeout(init.method === "POST" ? 60_000 : 30_000),
});
if (!res.ok) throw new Error(`${res.status}: ${(await res.json()).message}`);
return { body: await res.json(), retryAfter: Number(res.headers.get("retry-after")) || 5 };
}
// 1. Create the task
let { body: task, retryAfter } = await call("/image-to-3d", {
method: "POST",
body: JSON.stringify({
image_url: "https://docs.meshy.ai/images/api/quick-start/source-photo.webp",
texture_model: "meshy-7",
}),
});
// 2. Get the task until it finishes, for up to 60 minutes
const deadline = task.created_at + 60 * 60 * 1000;
while (!["SUCCEEDED", "FAILED", "CANCELED"].includes(task.status)) {
if (Date.now() > deadline) {
// The task is still running. Check it again later with the same ID instead of creating a new one.
throw new Error(`Task ${task.id} is still ${task.status}; check it again later`);
}
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
({ body: task, retryAfter } = await call(`/tasks/${task.id}`));
}
// 3. Download the model (only if the task succeeded)
if (task.status !== "SUCCEEDED") {
throw new Error(`Task ${task.status}: ${task.task_error?.message ?? "unknown error"}`);
}
const file = await fetch(task.output.model_urls.glb);
await writeFile("model.glb", Buffer.from(await file.arrayBuffer()));
console.log("Saved model.glb");
सामान्य वर्कफ़्लो देखें
गेम-रेडी कैरेक्टर
ह्यूमनॉइड मॉडल को स्केलेटन के साथ रिग करें ताकि यह Unity या Unreal में एनिमेट करने के लिए तैयार हो जाए।
Learn more →Smart Topology मेश
साफ़-सुथरे, गेम-रेडी ट्राएंगल मेश के लिए इमेज से 3D पर ai_model को meshy-smart-topology-latest पर सेट करें।
3D प्रिंट मॉडल
किसी तैयार मॉडल को मल्टी-कलर 3MF फ़ाइल में बदलें, जो स्लाइस और प्रिंट करने के लिए तैयार हो।
Learn more →अगले कदम
- हर endpoint द्वारा साझा किए जाने वाले task ऑब्जेक्ट और Tasks रूट्स के बारे में जानें।
- API v2 ओवरव्यू में हर endpoint को ब्राउज़ करें।
- प्रोडक्शन में जाने से पहले मूल्य निर्धारण, रेट लिमिट्स, और एरर की जाँच कर लें।
- UI पसंद है? Developer Platform आपको Playground में रिक्वेस्ट चलाने, उपयोग और रिक्वेस्ट लॉग ट्रैक करने, और Webhooks प्रबंधित करने देता है।
- Cookbook में चरण-दर-चरण रेसिपी फ़ॉलो करें, और Developer Blog पर ट्यूटोरियल पढ़ें।
- कोई फ़ीडबैक या समस्या है? Meshy Discord समुदाय से जुड़ें।