Skip to content

Task: Image to 3D Model

Short description: Use the image-to-3D API to quickly convert a 2D image into a 3D model file.


Overview

  • Method: POST
  • Path: /task/gi/image-to-3d
  • Content-Type: multipart/form-data

Authentication

  • Header: Authorization: Bearer <token>

Request Example

Form Parameters

ParameterTypeRequiredDescription
modelstringYesSupported models: Hunyuan3D-2, Hi3DGen, Step1X-3D
imagefileYesPNG image file with transparent background for 3D generation
texturebooleanNoWhether to generate texture; default is false
num_inference_stepsnumberNoNumber of inference steps; higher values typically improve quality, range 2-50, default 5
octree_resolutionnumberNo3D rendering/voxel detail resolution; range 16-400, default 128
guidance_scalenumberNoControls prompt adherence; higher values enforce prompt more strictly, range 1-20, default 5
file_formatstringNoOutput format: glb or stl; not supported by Hunyuan3D-2; default is glb
typestringNoOutput format for Hunyuan3D-2 only, e.g. glb
seednumberNoRandom seed; range 0-10000000, default 1234

curl Example

bash
curl -X POST "https://api.gpt.ge/task/gi/image-to-3d" \
  -H "Authorization: Bearer sk-xxxx" \
  -F "model=Hunyuan3D-2" \
  -F "image=@/path/to/image.png" \
  -F "texture=false" \
  -F "num_inference_steps=5" \
  -F "octree_resolution=128" \
  -F "guidance_scale=5" \
  -F "file_format=glb" \
  -F "seed=1234"

JavaScript (fetch) Example

javascript
const formData = new FormData();
formData.append('model', 'Hunyuan3D-2');
formData.append('image', fileInput.files[0]);
formData.append('texture', 'false');
formData.append('num_inference_steps', '5');
formData.append('octree_resolution', '128');
formData.append('guidance_scale', '5');
formData.append('file_format', 'glb');
formData.append('seed', '1234');

fetch('https://api.gpt.ge/task/gi/image-to-3d', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-xxxx'
  },
  body: formData
}).then(r => r.json()).then(console.log);

Python (requests) Example

python
import requests

url = 'https://api.gpt.ge/task/gi/image-to-3d'
headers = {
    'Authorization': 'Bearer sk-xxxx'
}

files = {
    'image': open('image.png', 'rb')
}
data = {
    'model': 'Hunyuan3D-2',
    'texture': 'false',
    'num_inference_steps': 5,
    'octree_resolution': 128,
    'guidance_scale': 5,
    'file_format': 'glb',
    'seed': 1234
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())

Response Example (200)

json
{
  "task_id": "SPC6X7SLGD0HCJMWFQ3RTLRUNZZV4I1M",
  "status": "waiting",
  "created_at": 1744534393609,
  "urls": {}
}

Note: Hunyuan3D-2 does not support the file_format parameter. Set texture to true if you need a textured model. Upload a PNG image with a transparent background for the best results.