Skip to main content

Text to 3D Endpoint

Overview

The Text to 3D endpoint generates a 3D object from a text-based prompt.

Open in Playground 🚀

Request

--request POST 'https://modelslab.com/api/v6/3d/text_to_3d' \

Make a POST request to https://modelslab.com/api/v6/3d/text_to_3d endpoint and pass the required parameters as a request body.

Body Attributes

ParameterDescriptionValues
key (required)API key for request authorization.String
prompt (required)Text prompt to describe the 3D model to generate.Default: "A full body mesh of a dog"
resolution (required)Resolution of the generated 3D model.Integer (max: 512, default: 256)
output_format (optional)Format of the generated 3D model.obj, stl, ply (default: glb)
render (optional)Whether to render a NeRF video of the generated 3D model.Boolean (default: false)
negative_prompt (optional)Text to exclude specific elements from the generated model.String (default: "")
guidance_scale (optional)Balances the adherence to the prompt versus creativity in the generation.Float (default: 1.0)
num_inference_steps (optional)Number of steps for generating the 3D model.Integer (default: 10)
ss_guidance_strength (optional)Strength of style-space guidance for 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 for 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)Degree of mesh simplification to optimize the output model.Float (range: 0.90–0.98, default: 0.90)
foreground_ratio (optional)Ratio of the foreground size to the overall image size (used if remove_bg is enabled).Float (default: 0.85)
remove_bg (optional)Removes the background from the generated model if enabled.Boolean (default: false)
chunk_size (optional)Size of processing chunks (affects VRAM usage).Integer (max: 12000, default: 8192)
seed (optional)Random seed for reproducibility; 0 generates a random seed.Integer (default: 0)
temp (optional)Save output files in a temporary directory when set to "yes".String (default: "no")
Open in Playground 🚀

Example

Body

Body
{
"key": "",
"foreground_ratio": "0.85",
"prompt": "a ghost wearing white bedsheet",
"num_inference_steps": "30",
"resolution": 512,
"guidance_scale": "3",
"ss_sampling_steps": 50,
"slat_sampling_steps": 50,
"seed": 0,
"temp": "no",
"webhook": null,
"track_id": null
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"foreground_ratio": "0.85",
"prompt": "a ghost wearing white bedsheet",
"num_inference_steps": "30",
"resolution": 512,
"guidance_scale": "3",
"ss_sampling_steps": 50,
"slat_sampling_steps": 50,
"seed": 0,
"temp": "no",
"webhook": null,
"track_id": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v6/3d/text_to_3d", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response


{
"status": "success",
"generationTime": 15.47,
"id": 109657557,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/out/ba5dd616-eb74-482c-8ee8-f8046687a8f3.obj"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/out/ba5dd616-eb74-482c-8ee8-f8046687a8f3.obj"
],
"meta": {
"chunk_size": 8192,
"file_prefix": "ba5dd616-eb74-482c-8ee8-f8046687a8f3",
"foreground_ratio": ".85",
"guidance_scale": 10,
"negative_prompt": "low quality",
"num_inference_steps": 10,
"prompt": "human face",
"remove_bg": true,
"render": false,
"resolution": 256,
"seed": 3815040680,
"temp": "no"
}
}