### Example Prompt Structure Source: https://docs.meshy.ai/en/webapp/guides/prompting An example illustrating the prompt structure formula, breaking down each component. ```text A medieval knight's helmet ← Subject with scratched iron surface ← Material in dark fantasy art style ← Style low-poly, game-ready asset ← Technical constraints ``` -------------------------------- ### Advanced Multi-Image to 3D Request with PBR (Python) Source: https://docs.meshy.ai/en/api/multi-image-to-3d This Python example shows how to make an advanced request with PBR texturing and GLB format. Ensure the 'requests' library is installed and parameters are correctly set. ```python # With PBR texturing and GLB format advanced_payload = { "image_urls": [ "", "" ], "should_texture": True, "enable_pbr": True, "target_formats": ["glb"], } response = requests.post( "https://api.meshy.ai/openapi/v1/multi-image-to-3d", headers=headers, json=payload, ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### Example Lamp Prototype Task Object Source: https://docs.meshy.ai/en/api/creative-lab-lamp An example of the Lamp Prototype Task object, illustrating its structure and typical values. ```APIDOC ## Example Lamp Prototype Task Object ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "creative-lab-lamp-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=***" ] } ``` ``` -------------------------------- ### Example Response: List Prototype Tasks Source: https://docs.meshy.ai/en/api/creative-lab-fridge-magnet This is an example JSON response when listing prototype fridge magnet tasks. It includes details such as task ID, status, creation times, and image URLs. ```json [ { "id": "01a3d8f1-8c2e-7d04-b223-3f3776a1c8c9", "type": "creative-lab-fridge-magnet-prototype", "name": "", "status": "SUCCEEDED", "progress": 100, "created_at": 1729543210000, "started_at": 1729543215000, "finished_at": 1729543242000, "expires_at": 1729802442000, "preceding_tasks": 0, "task_error": null, "consumed_credits": 6, "image_urls": [ "https://assets.meshy.ai/***/concept.png?Expires=***" ] } ] ``` -------------------------------- ### Advanced Multi-Image to 3D Request with PBR (JavaScript) Source: https://docs.meshy.ai/en/api/multi-image-to-3d This JavaScript example demonstrates making an advanced request with PBR texturing and GLB format. Ensure your Axios setup and payload are correct. ```javascript // With PBR texturing and GLB format const advancedPayload = { image_urls: [ "", "" ], should_texture: true, enable_pbr: true, target_formats: ["glb"], }; try { const response = await axios.post( 'https://api.meshy.ai/openapi/v1/multi-image-to-3d', advancedPayload, { headers } ); console.log(response.data); } catch (error) { console.error(error); } ``` -------------------------------- ### Retrieve Convert Task using Python (Requests) Source: https://docs.meshy.ai/en/api/convert This Python example shows how to get a convert task's details using the Requests library. Remember to substitute YOUR_API_KEY. ```python import requests task_id = "a43b5c6d-7e8f-901a-234b-567c890d1e2f" headers = { "Authorization": f"Bearer {YOUR_API_KEY}" } response = requests.get( f"https://api.meshy.ai/openapi/v1/convert/{task_id}", headers=headers, ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### Install Meshy MCP Server Source: https://docs.meshy.ai/en/api/ai Detects installed AI clients and configures Meshy for each. Ensure you replace 'msy_YOUR_API_KEY' with your actual Meshy API key. ```bash # Detects installed AI clients and configures Meshy for each npx add-mcp @meshy-ai/meshy-mcp-server --env MESHY_API_KEY=msy_YOUR_API_KEY ``` -------------------------------- ### Install smee-client for Local Testing Source: https://docs.meshy.ai/en/api/webhooks Install the smee-client globally using npm to forward webhooks to your local development environment. This is necessary for testing webhook functionality without deploying to a public server. ```bash npm install --global smee-client ``` -------------------------------- ### Multi-Image to 3D Task Response Stream Examples Source: https://docs.meshy.ai/en/api/multi-image-to-3d Examples of Server-Sent Events received from the multi-image to 3D task stream. Includes error events and message events showing task progress and final results. ```text // Error event example event: error data: { "status_code": 404, "message": "Task not found" } // Message event examples illustrate task progress. // For PENDING or IN_PROGRESS tasks, the response stream will not include all fields. event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "progress": 0, "status": "PENDING" } event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "multi-image-to-3d", "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=***", "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***", "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***", "stl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.stl?Expires=***", "pre_remeshed_glb": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/pre_remeshed_model.glb?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***", "thumbnail_urls": { "front": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview_front.png?Expires=***", "right": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview_right.png?Expires=***", "back": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview_back.png?Expires=***", "left": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview_left.png?Expires=***" }, "texture_prompt": "", "progress": 100, "started_at": 1692771667037, "created_at": 1692771650657, "expires_at": 1692771679037, "finished_at": 1692771669037, "status": "SUCCEEDED", "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***", "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX", "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX", "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX", "emission": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_emission.png?Expires=XXX" } ], "preceding_tasks": 0, "task_error": { "message": "" }, "consumed_credits": 30 } ``` -------------------------------- ### Good vs Bad Prompt Example (General) Source: https://docs.meshy.ai/en/webapp/guides/prompting Illustrates a good, descriptive prompt versus a vague, unhelpful one for general 3D generation. ```text Good Prompt : "A sci-fi plasma rifle with glowing blue energy core, carbon fiber body with chrome accents, cyberpunk style, game-ready low-poly asset" Bad Prompt : "cool gun" ``` -------------------------------- ### Install Meshy 3D Agent Skill Pack Source: https://docs.meshy.ai/en/api/ai Installs the open-source meshy-3d-agent skill pack, which provides pre-written Meshy workflows. This method calls the Meshy REST API directly and does not require an MCP server. ```bash npx skills add meshy-dev/meshy-3d-agent ``` -------------------------------- ### Image to Image Task Response Stream Examples Source: https://docs.meshy.ai/en/api/image-to-image These examples illustrate the Server-Sent Events format for Image to Image tasks. The first shows an error event, while the subsequent ones demonstrate progress and completion messages, with varying fields based on task status. ```text // Error event example event: error data: { "status_code": 404, "message": "Task not found" } // Message event examples illustrate task progress. // For PENDING or IN_PROGRESS tasks, the response stream will not include all fields. event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "progress": 0, "status": "PENDING" } event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "image-to-image", "ai_model": "nano-banana", "prompt": "Transform this into a cyberpunk style artwork", "status": "SUCCEEDED", "progress": 100, "created_at": 1692771650657, "started_at": 1692771667037, "finished_at": 1692771669037, "expires_at": 1692771679037, "image_urls": [ "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/image.png?Expires=***" ] } ``` -------------------------------- ### Good vs Bad Prompt Example (3D Printing) Source: https://docs.meshy.ai/en/webapp/guides/prompting Compares a detailed prompt for 3D printing with a minimal one, highlighting the need for structural guidance. ```text Good Prompt (3D Printing) : "A chess rook piece, medieval castle tower design, solid structure, no thin overhangs, 8cm tall, printable without supports" Bad Prompt (3D Printing) : "chess piece" (no structural guidance for printability) ``` -------------------------------- ### Retrieve Analyze Printability Task (Python) Source: https://docs.meshy.ai/en/api/analyze-printability This Python example uses the requests library to get an analyze printability task. It shows how to include the Authorization header and process the JSON response. ```python import requests task_id = "a43b5c6d-7e8f-901a-234b-567c890d1e2f" headers = { "Authorization": f"Bearer {YOUR_API_KEY}" } response = requests.get( f"https://api.meshy.ai/openapi/v1/print/analyze/{task_id}", headers=headers, ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### Generate Lamp Prototype from Text Prompt (cURL) Source: https://docs.meshy.ai/en/api/creative-lab-lamp Use this cURL command to generate a 3D prototype from a text description. The text prompt should clearly describe the desired lamp concept. ```bash # Stage 1 (text-to-3D): generate from a text prompt curl https://api.meshy.ai/openapi/creative-lab/lamp/v1/prototype \ -X POST \ -H "Authorization: Bearer ${YOUR_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "text": "a stylized owl perched on a tree branch under moonlight" }' ``` -------------------------------- ### Server-Sent Events Stream Examples for Retexture Task Source: https://docs.meshy.ai/en/api/retexture These examples illustrate the structure of Server-Sent Events (SSE) received when streaming a Retexture task. They include an error event and examples of message events for different task statuses (PENDING, IN_PROGRESS, SUCCEEDED), showing the varying fields available at each stage. ```javascript // Error event example event: error data: { "status_code": 404, "message": "Task not found" } // Message event examples illustrate task progress. // For PENDING or IN_PROGRESS tasks, the response stream will not include all fields. event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "progress": 0, "status": "PENDING" } event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "progress": 50, "status": "IN_PROGRESS" } event: message data: { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "retexture", "progress": 100, "status": "SUCCEEDED", "created_at": 1692771650657, "started_at": 1692771667037, "finished_at": 1692771669037, "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=***", "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***", "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***", "mtl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.mtl?Expires=***", "stl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.stl?Expires=***" }, "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***", "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX", "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX", "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX", "emission": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_emission.png?Expires=XXX" } ], "preceding_tasks": 0, "task_error": { "message": "" }, "consumed_credits": 10 } ``` -------------------------------- ### List Convert Tasks using Python (requests) Source: https://docs.meshy.ai/en/api/convert This Python example shows how to list convert tasks using the requests library, including setting the Authorization header and passing query parameters for pagination. ```python import requests headers = { "Authorization": f"Bearer {YOUR_API_KEY}" } response = requests.get( "https://api.meshy.ai/openapi/v1/convert", headers=headers, params={"page_size": 10} ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### 3D Agent Workflow Diagram Source: https://docs.meshy.ai/en/webapp/3d-agent Illustrates the step-by-step process of using the 3D Agent, from initial input to final download. ```text Idea / Input → Brainstorm → Visual Concepts (batch) → Refine → 3D Generation → Download ``` -------------------------------- ### List Build Fridge Magnet Tasks Source: https://docs.meshy.ai/en/api/creative-lab-fridge-magnet Use this cURL command to list build fridge magnet tasks. Ensure you replace YOUR_API_KEY with your actual API key and adjust page_size as needed. ```bash # List build tasks curl https://api.meshy.ai/openapi/creative-lab/fridge-magnet/v1/build?page_size=10 \ -H "Authorization: Bearer ${YOUR_API_KEY}" ``` -------------------------------- ### Example Repair Printability Task Response Source: https://docs.meshy.ai/en/api/repair-printability This is an example JSON response for a successfully completed repair-printability task. Note that `model_urls` are populated only when the task status is `SUCCEEDED`. ```json { "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9", "type": "print-repair", "status": "SUCCEEDED", "progress": 100, "created_at": 1699999999000, "started_at": 1700000000000, "finished_at": 1700000030000, "expires_at": 1715725401000, "task_error": null, "model_urls": { "glb": "", "fbx": "", "obj": "", "stl": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.stl?Expires=***", "usdz": "", "3mf": "", "mtl": "" }, "thumbnail_url": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/preview.png?Expires=***", "texture_urls": [], "consumed_credits": 10 } ``` -------------------------------- ### GET /openapi/v1/balance -- Get Balance Source: https://docs.meshy.ai/en/api/balance This endpoint retrieves the current credit balance for the authenticated user. It returns an object containing the current balance of credits. ```APIDOC ## GET /openapi/v1/balance -- Get Balance ### Description This endpoint retrieves the current credit balance for the authenticated user. ### Method GET ### Endpoint /openapi/v1/balance ### Request Example ```bash curl https://api.meshy.ai/openapi/v1/balance \ -H "Authorization: Bearer ${YOUR_API_KEY}" ``` ### Response #### Success Response (200) - **balance** (integer) - The current credit balance. #### Response Example ```json { "balance": 1000 } ``` ``` -------------------------------- ### Negative Prompt Examples Source: https://docs.meshy.ai/en/webapp/guides/prompting Examples of negative prompts to exclude specific elements from generations. Use phrases like 'no background elements' or 'without floating particles'. ```text "no background elements" "without floating particles" "no text or labels" ``` -------------------------------- ### Get Balance using Python (Requests) Source: https://docs.meshy.ai/en/api/balance This Python code uses the requests library to get your credit balance. It demonstrates how to set the Authorization header for the API request. ```python import requests headers = { "Authorization": f"Bearer {YOUR_API_KEY}" } response = requests.get( "https://api.meshy.ai/openapi/v1/balance", headers=headers, ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### List Prototype Tasks using Python (requests) Source: https://docs.meshy.ai/en/api/creative-lab-lamp This Python snippet shows how to list prototype lamp tasks using the requests library. Remember to substitute YOUR_API_KEY and set the desired page_size. ```python import requests headers = { "Authorization": f"Bearer {YOUR_API_KEY}" } response = requests.get( "https://api.meshy.ai/openapi/creative-lab/lamp/v1/prototype", headers=headers, params={"page_size": 10}, ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### List Prototype Tasks using cURL Source: https://docs.meshy.ai/en/api/creative-lab-lamp Use this cURL command to list prototype lamp tasks. Ensure you replace YOUR_API_KEY with your actual API key and adjust page_size as needed. ```bash # List prototype tasks curl https://api.meshy.ai/openapi/creative-lab/lamp/v1/prototype?page_size=10 \ -H "Authorization: Bearer ${YOUR_API_KEY}" ``` -------------------------------- ### Retexture Task Object Response Example Source: https://docs.meshy.ai/en/api/retexture This is an example of the JSON response structure when successfully retrieving a Retexture task. It includes details like model URLs, progress, and timestamps. ```json { "id": "018a210d-8ba4-705c-b111-1f1776f7f578", "type": "retexture", "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=***", "obj": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.obj?Expires=***", "usdz": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.usdz?Expires=***", "mtl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.mtl?Expires=***", "stl": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/model.stl?Expires=***" }, "thumbnail_url": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/preview.png?Expires=***", "text_style_prompt": "red fangs, Samurai outfit that fused with japanese batik style", "texture_image_url": "", "progress": 100, "started_at": 1692771667037, "created_at": 1692771650657, "expires_at": 1692771679037, "finished_at": 1692771669037, "status": "SUCCEEDED", "texture_urls": [ { "base_color": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0.png?Expires=***", "metallic": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_metallic.png?Expires=XXX", "normal": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_normal.png?Expires=XXX", "roughness": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_roughness.png?Expires=XXX", "emission": "https://assets.meshy.ai/***/tasks/018a210d-8ba4-705c-b111-1f1776f7f578/output/texture_0_emission.png?Expires=XXX" } ], "task_error": { "message": "" }, "consumed_credits": 10 } ``` -------------------------------- ### Example 400 Bad Request Error Source: https://docs.meshy.ai/en/api/errors This is an example of a 400 Bad Request error response. It indicates that the request was malformed or contained invalid parameters, such as an unsupported file extension. ```bash { "message": "Invalid model file extension: .3dm" } ``` -------------------------------- ### Prompt Do's and Don'ts Comparison Source: https://docs.meshy.ai/en/webapp/guides/prompting Compares effective prompting techniques (Do's) with common pitfalls (Don'ts) for clarity and actionability. ```text ✅ Do| ❌ Don't ---|--- "a wooden treasure chest with iron bands"| "a box" (too vague) "front-facing, centered, white background"| "amazing beautiful epic" (empty adjectives) "low-poly cartoon style, 5000 faces"| "make it look good" (not actionable) "weathered stone surface with moss"| "stone and wood and metal and glass" (too many materials) ``` -------------------------------- ### Figure Build Task Response Example Source: https://docs.meshy.ai/en/api/creative-lab-figure This is an example of the JSON response received after successfully creating a figure build task. The 'result' field contains the ID of the new build task. ```json { "result": "019c320e-9a8f-7a1c-9c11-2a1876f8a9bb" } ``` -------------------------------- ### Retexture with Image Style Source: https://docs.meshy.ai/en/api/retexture This example shows how to retexture a 3D model using an image as a style reference. This method also supports PBR and original UV preservation. ```APIDOC ## POST /openapi/v1/retexture ### Description Retextures a 3D model using an image as a style reference. ### Method POST ### Endpoint https://api.meshy.ai/openapi/v1/retexture ### Parameters #### Request Body - **model_url** (string) - Required - The URL of the 3D model to retexture. - **image_style_url** (string) - Required - The URL of the image to use as a style reference. - **ai_model** (string) - Optional - Specifies the AI model to use (e.g., "latest"). - **enable_pbr** (boolean) - Optional - Whether to enable Physically Based Rendering (PBR) materials. - **enable_original_uv** (boolean) - Optional - Whether to preserve the original UV mapping. - **input_task_id** (string) - Required - The ID of a previous task to use as input (alternative to `model_url`). ### Request Example ```json { "model_url": "https://cdn.meshy.ai/model/example_model_2.glb", "image_style_url": "https://cdn.meshy.ai/image/example_image.jpg", "ai_model": "latest", "enable_pbr": true, "enable_original_uv": true } ``` ### Response #### Success Response (200) - **result** (string) - The ID of the retexturing task. #### Response Example ```json { "result": "018a210d-8ba4-705c-b111-1f1776f7f578" } ``` ### Failure Modes - `400 - Bad Request`: Invalid input parameters (missing required fields, invalid task ID, unsupported model format, unreachable URL). - `401 - Unauthorized`: Invalid API key. - `402 - Payment Required`: Insufficient credits. - `429 - Too Many Requests`: Rate limit exceeded. ``` -------------------------------- ### Server-Sent Events Stream Examples Source: https://docs.meshy.ai/en/api/animation Examples of Server-Sent Events (SSE) data received when streaming animation task updates. Includes error events and message events for different task statuses. ```javascript // Error event example event: error data: { "status_code": 404, "message": "Task not found" } // Message event examples illustrate task progress. // For PENDING or IN_PROGRESS tasks, the response stream will not include all fields. event: message data: { "id": "018c425b-b2c6-727e-d333-3c1887i9h791", "progress": 0, "status": "PENDING" } event: message data: { "id": "018c425b-b2c6-727e-d333-3c1887i9h791", "progress": 50, "status": "IN_PROGRESS" } event: message data: { // Example of a SUCCEEDED task stream item, mirroring The Animation Task Object structure "id": "018c425b-b2c6-727e-d333-3c1887i9h791", "type": "animate", "status": "SUCCEEDED", "created_at": 1747032440896, "progress": 100, "started_at": 1747032441210, "finished_at": 1747032457530, "expires_at": 1747291657530, "task_error": { "message": "" }, "consumed_credits": 3, "result": { "animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?", "animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?", "processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?", "processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?", "processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?" }, "preceding_tasks": 0 } ``` -------------------------------- ### Generate Lamp Prototype from Image URL (cURL) Source: https://docs.meshy.ai/en/api/creative-lab-lamp Use this cURL command to generate a matte-white lampshade concept image from a provided image URL. Ensure the image URL is publicly accessible and in a supported format. ```bash # Stage 1 (image-to-3D): generate a matte-white lampshade concept image curl https://api.meshy.ai/openapi/creative-lab/lamp/v1/prototype \ -X POST \ -H "Authorization: Bearer ${YOUR_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "image_url": "", "image_subject": "character" }' ``` -------------------------------- ### Server-Sent Events Message Examples Source: https://docs.meshy.ai/en/api/resize These examples illustrate the structure of Server-Sent Events messages received when streaming a resize task. They show initial progress updates and the final success message with model details. ```javascript // Message event examples illustrate task progress. event: message data: { "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9", "progress": 0, "status": "PENDING" } event: message data: { "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9", "type": "resize", "model_urls": { "glb": "https://assets.meshy.ai/.../model.glb?Expires=..." }, "progress": 100, "status": "SUCCEEDED", "created_at": 1699999999000, "started_at": 1700000000000, "finished_at": 1700000001000, "task_error": null, "consumed_credits": 1 } ``` -------------------------------- ### List Build Tasks using cURL Source: https://docs.meshy.ai/en/api/creative-lab-lamp Use this cURL command to list build lamp tasks. Ensure you replace YOUR_API_KEY with your actual API key and adjust page_size as needed. ```bash # List build tasks curl https://api.meshy.ai/openapi/creative-lab/lamp/v1/build?page_size=10 \ -H "Authorization: Bearer ${YOUR_API_KEY}" ``` -------------------------------- ### Server-Sent Events Message Examples Source: https://docs.meshy.ai/en/api/convert These examples illustrate the structure of Server-Sent Events messages received when streaming convert task updates. They show progress updates and the final success message with model URLs. ```javascript // Message event examples illustrate task progress. event: message data: { "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9", "progress": 0, "status": "PENDING" } event: message data: { "id": "0193bfc5-ee4f-73f8-8525-44b398884ce9", "type": "convert", "model_urls": { "fbx": "https://assets.meshy.ai/.../model.fbx?Expires=...", "stl": "https://assets.meshy.ai/.../model.stl?Expires=..." }, "progress": 100, "status": "SUCCEEDED", "created_at": 1699999999000, "started_at": 1700000000000, "finished_at": 1700000001000, "task_error": null, "consumed_credits": 1 } ``` -------------------------------- ### List Multi-Image to 3D Tasks (JavaScript) Source: https://docs.meshy.ai/en/api/multi-image-to-3d This JavaScript example demonstrates how to fetch a list of Multi-Image to 3D tasks using the axios library. Ensure your API key is correctly set in the Authorization header. ```javascript import axios from 'axios' const headers = { Authorization: `Bearer ${YOUR_API_KEY}` }; try { const response = await axios.get( `https://api.meshy.ai/openapi/v1/multi-image-to-3d?page_size=10`, { headers } ); console.log(response.data); } catch (error) { console.error(error); } ``` -------------------------------- ### Server-Sent Events Stream Examples Source: https://docs.meshy.ai/en/api/rigging These examples illustrate the structure of Server-Sent Events received from the rigging task stream. They include an error event and various message events showing task progress and final status. ```javascript // Error event example event: error data: { "status_code": 404, "message": "Task not found" } // Message event examples illustrate task progress. // For PENDING or IN_PROGRESS tasks, the response stream will not include all fields. event: message data: { "id": "018b314a-a1b5-716d-c222-2f1776f7f579", "progress": 0, "status": "PENDING" } event: message data: { "id": "018b314a-a1b5-716d-c222-2f1776f7f579", "progress": 50, "status": "IN_PROGRESS" } event: message data: { // Example of a SUCCEEDED task stream item, mirroring The Rigging Task Object structure "id": "018b314a-a1b5-716d-c222-2f1776f7f579", "type": "rig", "status": "SUCCEEDED", "created_at": 1747032400453, "progress": 100, "started_at": 1747032401314, "finished_at": 1747032418417, "expires_at": 1747291618417, "task_error": { "message": "" }, "consumed_credits": 5, "result": { "rigged_character_fbx_url": "https://assets.meshy.ai/.../Character_output.fbx?", "rigged_character_glb_url": "https://assets.meshy.ai/.../Character_output.glb?", "basic_animations": { "walking_glb_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin.glb?", "walking_fbx_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin.fbx?", "walking_armature_glb_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin_armature.glb?", "running_glb_url": "https://assets.meshy.ai/.../Animation_Running_withSkin.glb?", "running_fbx_url": "https://assets.meshy.ai/.../Animation_Running_withSkin.fbx?", "running_armature_glb_url": "https://assets.meshy.ai/.../Animation_Running_withSkin_armature.glb?" } }, "preceding_tasks": 0 } ``` -------------------------------- ### Create Resize Task (Simple) - Python Source: https://docs.meshy.ai/en/api/resize This Python example demonstrates creating a resize task with a specific height using an input task ID. It uses the requests library for the POST request. ```python import requests headers = { "Authorization": f"Bearer {YOUR_API_KEY}" } # Simple: resize to a specific height payload = { "input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578", "resize_height": 1.8 } response = requests.post( "https://api.meshy.ai/openapi/v1/resize", headers=headers, json=payload, ) response.raise_for_status() print(response.json()) ``` -------------------------------- ### List Prototype Fridge Magnet Tasks Source: https://docs.meshy.ai/en/api/creative-lab-fridge-magnet Use this cURL command to list prototype fridge magnet tasks. Ensure you replace YOUR_API_KEY with your actual API key and adjust page_size as needed. ```bash # List prototype tasks curl https://api.meshy.ai/openapi/creative-lab/fridge-magnet/v1/prototype?page_size=10 \ -H "Authorization: Bearer ${YOUR_API_KEY}" ```