Image to 3D Endpoint
Overview
The Image to 3D API generates a 3D character from an input image.
Open in Playground 🚀Request
--request POST 'https://modelslab.com/api/v6/3d/image_to_3d' \
Make a POST
request to https://modelslab.com/api/v6/3d/image_to_3d endpoint and pass the required parameters as a request body to the endpoint.
Body Attributes
Parameter | Description | Values |
---|---|---|
key (required) | API key for request authorization. | String |
image (required) | The input image to be used for 3D conversion. | File (PNG, JPEG, etc.) |
output_format (optional) | Specifies the format of the generated 3D object. | obj , stl , ply (default: glb ) |
render (optional) | Indicates whether to render a NeRF video of the 3D model. | Boolean (default: false ) |
resolution (optional) | Resolution of the generated 3D model. | Integer (max: 512 , default: 256 ) |
multi_image (optional) | Processes multiple images together when set to true. Input should include multiple POVs in a transparent PNG. | Boolean (default: false ) |
ss_guidance_strength (optional) | Adjusts the strength of style-space guidance for better model refinement. | Float (default: 7.5 ) |
ss_sampling_steps (optional) | Number of steps for style-space sampling. | Integer (range: 1–50, default: 12 ) |
slat_guidance_strength (optional) | Strength of slat guidance to refine model details. | Float (range: 0.0–10.0, default: 3.0 ) |
slat_sampling_steps (optional) | Number of steps for slat guidance sampling. | Integer (range: 1–50, default: 12 ) |
mesh_simplify (optional) | Controls the degree of mesh simplification to optimize the output. | Float (range: 0.90–0.98, default: 0.90 ) |
chunk_size (optional) | Specifies the size of processing chunks, which affects VRAM usage. | Integer (max: 12000 , default: 8192 ) |
seed (optional) | Sets a random seed for reproducibility; 0 generates a random seed. | Integer (default: 0 ) |
temp (optional) | Saves the output files in a temporary directory if set to "yes" . | String ("yes" or "no" , default: "no" ) |
Example
Body
Body
{
"key": "",
"image": "https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg",
"ss_sampling_steps" : 50,
"slat_sampling_steps" : 50,
"output_format":"glb",
"webhook": null,
"track_id": null,
"temp": "no"
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "",
"image": "https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg",
"ss_sampling_steps" : 50,
"slat_sampling_steps" : 50,
"output_format":"glb",
"webhook": null,
"track_id": null,
"temp": "no"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v6/3d/image_to_3d", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"image" => "https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg",
"ss_sampling_steps" => 50,
"slat_sampling_steps" => 50,
"output_format" => "glb",
"webhook" => null,
"track_id" => null,
"temp" => "no"
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v6/3d/image_to_3d',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://modelslab.com/api/v6/3d/image_to_3d',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key": "",
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/0335d02b-958a-4a7f-b7e4-a5f1e61efbf1-0.png",
"foreground_ratio": 0.85,
"remove_bg": false,
"resolution": 256,
"chunk_size": 8192,
"webhook": null,
"track_id": null
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://modelslab.com/api/v6/3d/image_to_3d"
payload = json.dumps({
"key": "",
"image": "https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg",
"ss_sampling_steps" : 50,
"slat_sampling_steps" : 50,
"output_format":"glb",
"webhook": None,
"track_id": None,
"temp": "no"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"key\" : \"\",\r\n \"foreground_ratio\" : \"0.85\",\r\n \"image\": \"https://i.pinimg.com/736x/7c/83/64/7c83645c903677dd93ef50fe953dceea.jpg\",\r\n \"ss_sampling_steps\" : 50,\r\n \"slat_sampling_steps\" : 50,\r\n \"output_format\":\"glb\",\r\n \"webhook\": null,\r\n \"track_id\": null\r\n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v6/3d/image_to_3d")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
Example Response
{
"status": "success",
"generationTime": 10.62,
"id": 109655545,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/out/ae46c488-b66c-4aaa-9540-7355261d8d71.obj"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/out/ae46c488-b66c-4aaa-9540-7355261d8d71.obj"
],
"meta": {
"chunk_size": 8192,
"file_prefix": "ae46c488-b66c-4aaa-9540-7355261d8d71",
"foreground_ratio": ".85",
"image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/0335d02b-958a-4a7f-b7e4-a5f1e61efbf1-0.png",
"remove_bg": true,
"render": false,
"resolution": 256,
"seed": 3480183101,
"temp": "no"
}
}