POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 const axios = require('axios'); const FormData = require('form-data'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/hunyuan3d-2.1"; const reqBody = { "seed": 42, "image": "https://segmind-resources.s3.amazonaws.com/output/f9e83c41-45aa-4ac0-b126-50e17b2ff935-kangaroo.jpg", "steps": 30, "num_chunks": 8000, "max_facenum": 20000, "guidance_scale": 7.5, "generate_texture": true, "octree_resolution": 256, "remove_background": true }; (async function() { try { const formData = new FormData(); // Append regular fields for (const key in reqBody) { if (reqBody.hasOwnProperty(key)) { formData.append(key, reqBody[key]); } } // Convert and append images as Base64 if necessary const response = await axios.post(url, formData, { headers: { 'x-api-key': api_key, ...formData.getHeaders() } }); console.log(response.data); } catch (error) { console.error('Error:', error.response ? error.response.data : error.message); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


seedint ( default: 42 )

Sets the random seed


imagestr ( default: https://segmind-resources.s3.amazonaws.com/output/f9e83c41-45aa-4ac0-b126-50e17b2ff935-kangaroo.jpg )

URL of the input image for 3D conversion. Use clear images for best results.


stepsint ( default: 30 )

Defines inference steps. Lower for speed, higher for quality.

min : 5,

max : 50


num_chunksint ( default: 8000 )

Sets mesh generation chunk count. 5000 for speed, 8000 for detail.

min : 1000,

max : 200000


max_facenumint ( default: 20000 )

Controls max mesh faces. 15000 for smaller models, 20000 for larger.

min : 10000,

max : 200000


guidance_scalefloat ( default: 7.5 )

Adjusts guidance scale. 7.5 for balanced generation, 10 for creative.

min : 1,

max : 20


generate_texturebool ( default: true )

Enables texture generation. Set true for detailed texture.


octree_resolutionenum:int ( default: 256 )

Choose octree resolution. 256 for balance, 512 for detailed meshes.

Allowed values:


remove_backgroundbool ( default: true )

Option to remove image background. Enable for isolated objects.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Hunyuan3D 2.1 – Advanced 3D Asset Generation Model

What is Hunyuan3D 2.1?

Hunyuan3D 2.1 is an open-source generative AI model for converting 2D images into high-fidelity 3D assets. It combines two specialized modules—Hunyuan3D-Shape for precise image-to-mesh reconstruction and Hunyuan3D-Paint for physically based rendering (PBR) texture synthesis. Designed to run on MacOS, Windows, and Linux, Hunyuan3D 2.1 supports full fine-tuning and customization. Developers and 3D artists benefit from photorealistic outputs with accurate reflections, subsurface scattering, and metalness effects, outpacing many closed-source and research models.

Key Features

  • Image-to-Shape Conversion: Automatically generate clean, watertight meshes from input images.
  • PBR Texture Synthesis: Realistic material maps (albedo, roughness, normal) with advanced light interaction.
  • Fully Open Source: Includes pretrained weights, training scripts, and extensibility for custom datasets.
  • Cross-Platform Support: Native compatibility with MacOS, Windows, and Linux command-line workflows.
  • High Detail Control: Adjustable num_chunks (1,000–200,000) and max_facenum (10,000–200,000) for mesh complexity.
  • Tunable Guidance: guidance_scale (1–20) balances adherence to input vs. creative variation.

Best Use Cases

  • Game Development: Rapidly generate production-ready 3D props and environment assets with PBR textures.
  • AR/VR Prototyping: Turn real-world product photos into interactive 3D models for immersive demos.
  • E-commerce: Create photorealistic 3D previews of merchandise from catalog images.
  • Film & Animation: Prototype detailed 3D characters or objects with fine control over mesh resolution and texture realism.
  • 3D Printing: Export optimized meshes for physical prototyping and small-batch manufacturing.

Prompt Tips and Output Quality

To maximize output quality and consistency:

  • Seed: Use seed=42 for reproducible results or random for exploration.
  • Inference Steps: Set steps=30 (range 5–50) for a balance of speed and fidelity.
  • Mesh Detail: Increase num_chunks to 8,000+ and max_facenum to 20,000+ for detailed surfaces.
  • Texture Generation: Enable generate_texture=true and choose octree_resolution=512 for higher texture resolution.
  • Background Removal: Toggle remove_background=true to isolate objects cleanly.
  • Guidance Scale: A default guidance_scale=7.5 preserves input likeness; increase to 10 for creative variations.

FAQs

Q: How do I convert a product image to a 3D model?
A: Pass your image URL to the image parameter and run Hunyuan3D-Shape. Adjust steps and max_facenum to refine mesh fidelity.

Q: Can I fine-tune Hunyuan3D 2.1 on my own dataset?
A: Yes. The repository includes training scripts and weight checkpoints. You can fine-tune on domain-specific images.

Q: What file formats are supported for export?
A: Generated meshes export as OBJ or glTF, with PBR textures in PNG or JPEG maps.

Q: Is Hunyuan3D 2.1 suitable for real-time applications?
A: For real-time, reduce steps and num_chunks settings, then optimize output in your engine’s LOD pipeline.

Q: Where can I get the code and weights?
A: Visit the official GitHub repository under an open-source license for full access and community contributions.