Skip to main content

Enterprise: Text to Video Endpoint

Overview

Text to Video endpoint generates and returns a video based on a text description.

Text to video endpoint result
caution

Make sure you add your s3 details for video server, so you can receive video generated in your bucket. videos generated without s3 details being added will be delete after 24 hours

Request

--request POST 'https://modelslab.com/api/v1/enterprise/video/text2video' \

Body Attributes

ParameterDescriptionValues
keyYour unique API key used for authorization.string
model_idThe ID of the model to use.Allowed values:cogvideox
promptThe text prompt describing the content you want in the generated video.string
negative_promptItems you do not want in the video.string
seedThe seed used to reproduce results. Pass null for a random number.integer
heightThe height of the video.Maximum: 512 pixels
widthThe width of the video.Maximum: 512 pixels
num_framesThe number of frames in the generated video.Maximum: 25. Default: 16
num_inference_stepsThe number of denoising steps.Maximum: 50. Default: 20
guidance_scaleThe scale for classifier-free guidance.Min: 0, Max: 8
clip_skipThe number of CLIP layers to skip. A value of 2 leads to more aesthetic results. Default is null.integer or null
upscale_heightThe height to upscale the video to when using the zeroscope model.1024 pixels
upscale_widthThe width to upscale the video to when using the zeroscope model.1024 pixels
upscale_strengthThe strength for upscaling. Higher strength can lead to more differences between the generated and upscaled video.0-1
upscale_guidance_scaleThe guidance scale for upscaling the video when using the zeroscope model.0-8
upscale_num_inference_stepsThe number of denoising steps for upscaling the video when using the zeroscope model.Maximum: 50. Default: 20
use_improved_samplingWhether to use an improved sampling technique. This leads to better results with higher temporal consistency at the cost of being slower.true/false
improved_sampling_seedThe seed for consistent video generation when using the improved sampling technique.integer
fpsThe frames per second rate of the generated video.Max: 16
output_typeThe output type of the video.mp4 or gif
instant_responseSet to true if you want an instant response with future links for queued requests instead of waiting for a fixed amount of time.true/false
tempSet to true if you want to store your generations on temporary storage. Temporary files are cleaned every 24 hours.true/false
webhookProvide a URL to receive a POST API call once the video generation is complete.URL

Example

Body

Body
{
"key":"",
"model_id":"cogvideox",
"prompt":"An astronaut riding a horse",
"negative_prompt":"low quality",
"height":512,
"width":512,
"num_frames":16,
"num_inference_steps":20,
"guidance_scale":7,
"upscale_height":640,
"upscale_width":1024,
"upscale_strength":0.6,
"upscale_guidance_scale":12,
"upscale_num_inference_steps":20,
"output_type":"gif",
"webhook":null,
"track_id":null
}

Request

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

var raw = JSON.stringify({
"key":"",
"model_id":"cogvideox",
"prompt":"An astronaut riding a horse",
"negative_prompt":"low quality",
"height":512,
"width":512,
"num_frames":16,
"num_inference_steps":20,
"guidance_scale":7,
"upscale_height":640,
"upscale_width":1024,
"upscale_strength":0.6,
"upscale_guidance_scale":12,
"upscale_num_inference_steps":20,
"output_type":"gif",
"webhook":null,
"track_id":null
});

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

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

Response

Example Response

{
"status": "success",
"generationTime": 8.49,
"id": 147,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/video_generations/e53b8d0e-559e-407b-8674-f557c63e09e8.gif"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/2be1702e-3a1f-46ee-811c-350cee84b66e.gif"
],
"meta": {
"base64": "no",
"clip_skip": null,
"file_prefix": "2be1702e-3a1f-46ee-811c-350cee84b66e",
"fps": 7,
"guidance_scale": 7,
"height": 512,
"improved_sampling_seed": 42,
"instant_response": "no",
"model_id": "cogvideox",
"negative_prompt": "low quality",
"num_frames": 16,
"num_inference_steps": 20,
"output_type": "gif",
"prompt": "An astronaut riding a horse",
"seed": 3848624113,
"temp": "no",
"upscale_guidance_scale": 15,
"upscale_height": null,
"upscale_num_inference_steps": 20,
"upscale_strength": 0.6,
"upscale_width": null,
"use_improved_sampling": "no",
"width": 512
}
}