1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/wan2.1-i2v-720p";
const data = {
"prompt": "A young woman with light skin and wavy brown hair sits at a desk in a modern podcast studio, wearing over-ear headphones and speaking into a sleek black microphone. She is dressed casually in a fitted blazer and a neutral-toned shirt, exuding confidence and professionalism. The studio is warmly lit, with soft overhead lighting and accent lights creating a cozy ambiance. In the background, a soundproofed wall with stylish acoustic panels is visible, along with a small shelf holding books and a potted plant. A laptop sits on the desk in front of her, alongside a cup of coffee and a notebook with scribbled notes. The camera angle is a medium close-up, focused on her upper body and face as she engages in a lively conversation, her expressive hands occasionally gesturing while she speaks. The scene is vibrant and modern, capturing the energy of a podcast recording in progress.",
"negative_prompt": "blurry, bad quality, camera shake, distortion, poor composition, low resolution, artifact, watermark",
"image": "toB64('https://segmind-resources.s3.amazonaws.com/input/209f6f09-7fc6-47c0-8b6e-128ae75db915-wan-720-ip.png')",
"seed": 63088745,
"video_length": 3,
"resolution": 720,
"steps": 30,
"base64": false
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
Prompt for video generation
Negative prompt for video generation
Reference image for video generation
Seed number for video generation
Length of the generated video in seconds
min : 1,
max : 5
Resolution of the generated video (longest side of the video)
Allowed values:
Number of steps for video generation
min : 10,
max : 70
Output as base64
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Wan2.1 is a cutting-edge video foundation model that excels in image-to-video generation. It outperforms existing open-source and state-of-the-art commercial solutions. The I2V-14B model can generate high-definition 720P videos and has surpassed other models in human evaluations.
SOTA Performance: Consistently outperforms existing open-source and commercial models across multiple benchmarks.
Powerful Video VAE: Wan-VAE delivers exceptional efficiency and performance, encoding and decoding 1080P videos of any length while preserving temporal information.
Architecture: Designed on the mainstream diffusion transformer paradigm with innovations like a novel spatio-temporal variational autoencoder (VAE).
Data: Trained on a vast amount of curated and deduplicated image and video data, processed through a four-step data cleaning process.
The models are licensed under the Apache 2.0 License.
This version can generate videos at 720P resolution.
Extensive manual evaluations confirm that Wan2.1 outperforms both closed-source and open-source models.