Skip to main content

Text to 3D

Overview

This endpoint generates 3D image from text prompt while passing appropriate parameters

Request

--request POST 'https://modelslab.com/api/v3/txt_to_3d' \

Make a POST request to https://modelslab.com/api/v3/txt_to_3d endpoint and pass the required parameters as a request body.

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorization.key
promptText prompt with description of the things you want in the image to be generated.string
negative_promptItems you don't want in the image.string
stepsNumber of denoising steps.21, 31, 41
guidance_scaleScale for classifier-free guidance.Minimum: 1, Maximum: 20
frame_sizeNumber of frames for the 3D image.256
seedSeed used to reproduce results. Pass null for a random number.integral value
secondsNumber of seconds for the 3D image animation.
output_typeType of the 3D image to generate."gif" or "ply"
webhookURL to receive a POST API call once the image generation is complete.url
track_idID returned in the response to the webhook API call for identification.integral value

Example

Body

Body
{
"key": "",
"prompt":"human face",
"guidance_scale":20,
"steps":31,
"frame_size":256,
"output_type":"gif",
"webhook": null,
"track_id": null
}

Request

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

var raw = JSON.stringify({
"key": "",
"prompt":"human face",
"guidance_scale":20,
"steps":31,
"frame_size":256,
"output_type":"gif",
"webhook": null,
"track_id": null
});

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

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

Response

{
"status": "success",
"generationTime": 10,
"id": 109658485,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/1d98b880-b44f-48c4-8966-fec335475ec9.gif"
],
"meta": {
"file_prefix": "1d98b880-b44f-48c4-8966-fec335475ec9",
"frame_size": 256,
"guidance_scale": 20,
"instant_response": "no",
"n_samples": 1,
"negative_prompt": "",
"outdir": "out",
"output_type": "gif",
"prompt": "human face",
"safetychecker": "no",
"seconds": 3,
"seed": 2593936086,
"steps": 31,
"temp": "no"
}
}