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
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.7-videoedit";
const data = {
"prompt": "Convert the entire scene to a claymation style",
"video": "https://segmind-resources.s3.amazonaws.com/input/wan27videoedit-input.mp4",
"image": "toB64('undefined')",
"resolution": "720P"
};
(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);
}
})();Text instruction describing the desired edit. Up to 5000 characters.
URL of the video to edit. Duration 2-10s, resolution 240-4096px.
Optional style reference image for style transfer.
Content to avoid.
Output video resolution tier.
Allowed values:
Random seed.
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.