Skip to main content

Image to Video Endpoint

Overview

Text to Video endpoint generates video from image.

Text to video endpoint result

Request

--request POST 'https://modelslab.com/api/v6/video/img2video' \

Make a POST request to https://modelslab.com/api/v6/video/img2video endpoint and pass the required parameters in the request body.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization.
model_idThe ID of the model to use. Can be svd , dark-sushi-mix-vid,epicrealismnaturalsi-vid,hellonijicute25d-vid
negative_promptItems you don't want in the video.
heightMax height: 1024px.
promptText prompt with description of the things you want in the video to be generated
widthMax width: 1024px.
num_framesNumber of frames in generated video. Max: 25. Defaults to 16.
num_inference_stepsNumber of denoising steps. Max: 50. Defaults to 20.
init_imageLink equivalent of a valid png, jpeg or other valid image format file to use as initial image conditioning.
min_guidance_scaleStart value of guidance scale for video generation when using svd as model. Defaults to 1.0.
max_guidance_scaleEnd value of guidance scale for video generation when using svd as model. Defaults to 3.0.
motion_bucket_idHigher value leads to more motion in generated videos. Defaults to 127.
noise_aug_strengthStrength for noise initialization when using svd as model.
fpsFrames per second rate of generated video.
output_typeThe output type could be mp4,gif.
latent_interpolation_methodinterpolation method, default is lerp. Other slerp
clip_skipclip skips - default is null
instant_responsetrue if you'd like a response with future links for queued requests instantly instead of waiting for a fixed amount of time. Defaults to false.
temptrue if you want to store your generations on our temporary storage. Temporary files are cleaned every 24 hours. Defaults to false.
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body
{
"key":"",
"model_id":"svd",
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/2231684321704267390.png",
"height":512,
"width":512,
"num_frames":25,
"num_inference_steps":20,
"min_guidance_scale":1,
"max_guidance_scale":3,
"motion_bucket_id":200,
"noise_aug_strength":0.02,
"webhook":null,
"track_id":null
}

Request

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

var raw = JSON.stringify({
"key":"",
"model_id":"svd",
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/2231684321704267390.png",
"height":512,
"width":512,
"num_frames":25,
"num_inference_steps":20,
"min_guidance_scale":1,
"max_guidance_scale":3,
"motion_bucket_id":200,
"noise_aug_strength":0.02,
"webhook":null,
"track_id":null
});

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

fetch("https://modelslab.com/api/v6/video/img2video", 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": 146,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/c9173348-fbeb-4da2-9f86-e157763be54b.mp4"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/c9173348-fbeb-4da2-9f86-e157763be54b.mp4"
],
"meta": {
"file_prefix": "c9173348-fbeb-4da2-9f86-e157763be54b",
"fps": 7,
"height": 512,
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/2231684321704267390.png",
"instant_response": "no",
"max_guidance_scale": 3,
"min_guidance_scale": 1,
"model_id": "svd",
"motion_bucket_id": 200,
"noise_aug_strength": 0.02,
"num_frames": 25,
"num_inference_steps": 20,
"seed": 3811131349,
"temp": "no",
"width": 512
}
}