Skip to main content

Enterprise: Image to Video Endpoint

Overview

Text to Video endpoint generates video from image.

Text to video endpoint result
caution

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

Request

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

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

Body Attributes

ParameterDescriptionValues
keyYour unique API key used for authorization.string
model_idThe ID of the model to use.Allowed values: svd, dark-sushi-mix-vid, epicrealismnaturalsi-vid, hellonijicute25d-vid
promptA text prompt describing the specific elements you'd like to see in the video. Works only for dark-sushi-mix-vid, epicrealismnaturalsi-vid, and hellonijicute25d-vid.string
negative_promptItems you do not want in the video.string
init_imageA link or base64 equivalent of a valid PNG, JPEG, or other image format file to use as initial image conditioning.URL or base64
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
min_guidance_scaleThe start value of the guidance scale for video generation when using svd as the model.Min: 0
max_guidance_scaleThe end value of the guidance scale for video generation when using svd as the model.Max: 8
motion_bucket_idHigher values lead to more motion in generated videos.Default: 127
noise_aug_strengthThe strength for noise initialization when using svd as the model.Min: 0, Max: 1
fpsThe frames per second rate of the generated video.Max: 16
output_typeThe output type of the video.mp4, gif, base64
latent_interpolation_methodThe interpolation method for generating the video.Default: lerp. Other option: slerp
clip_skipThe number of CLIP layers to skip.Default: null. Max: 2
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.Default: false (TRUE or FALSE)
tempSet to true if you want to store your generations on temporary storage. Temporary files are cleaned every 24 hours.Default: false (TRUE or FALSE)
webhookProvide a URL to receive a POST API call once the video generation is complete.URL
track_idThis ID is returned in the response to the webhook API call and will be used to identify the webhook request.Integer

Example

Body

Body
{
"key":"",
"model_id":"svd",
"init_image": "https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/e2f9cb8e-cb87-4143-dd81-a9e77e3bb800/768",
"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,
"base64":false,
"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://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/e2f9cb8e-cb87-4143-dd81-a9e77e3bb800/768",
"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,
"base64":false,
"webhook":null,
"track_id":null
});

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

fetch("https://modelslab.com/api/v1/enterprise/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://d9jy2smsrdjcq.cloudfront.net/video_generations/59fbb932-2233-4119-ab1b-80403f4f135a.gif"
],
"proxy_links": [
"https://d9jy2smsrdjcq.cloudfront.net/video_generations/59fbb932-2233-4119-ab1b-80403f4f135a.gif"
],
"meta": {
"base64": "no",
"file_prefix": "c9173348-fbeb-4da2-9f86-e157763be54b",
"fps": 7,
"height": 512,
"init_image": "https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/e2f9cb8e-cb87-4143-dd81-a9e77e3bb800/768",
"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
}
}