Skip to main content

Text to Video Endpoint

Overview

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

Text to video endpoint result

Request

--request POST 'https://stablediffusionapi.com/api/v5/text2video' \

Make a POST request to https://stablediffusionapi.com/api/v5/text2video endpoint and pass the required parameters in the request body.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization.
promptText prompt with description of the things you want in the video to be generated.
negative_promptItems you don't want in the video.
schedulerUse it to set a scheduler for video creation.
secondsDuration of the video in seconds.

Schedulers

This endpoint also supports schedulers. Use the "scheduler" parameter in the request body to set a specific scheduler to be used from the list below:

  • DDPMScheduler
  • DDIMScheduler
  • PNDMScheduler
  • LMSDiscreteScheduler
  • EulerDiscreteScheduler
  • EulerAncestralDiscreteScheduler
  • DPMSolverMultistepScheduler
  • HeunDiscreteScheduler
  • KDPM2DiscreteScheduler
  • DPMSolverSinglestepScheduler
  • KDPM2AncestralDiscreteScheduler
  • UniPCMultistepScheduler
  • DDIMInverseScheduler
  • DEISMultistepScheduler
  • IPNDMScheduler
  • KarrasVeScheduler
  • ScoreSdeVeScheduler
  • LCMScheduler

Example

Body

Body
{
"key": "",
"prompt": "man walking on the road, ultra HD video",
"negative_prompt": "Low Quality",
"scheduler": "UniPCMultistepScheduler",
"seconds": 3
}

Request

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

var raw = JSON.stringify({
"key": "",
"prompt": "man walking on the road, ultra HD video",
"negative_prompt": "Low Quality",
"scheduler": "UniPCMultistepScheduler",
"seconds": 3
});

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

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

Response

Example Response
{
"status": "success",
"generationTime": 9.029465913772583,
"id": 14758180,
"output": [
"https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/ee3e20f4-adf7-4cb2-9733-3c3b6bae8813.mp4"
]
}