Appearance
Image To Video Generation
Image-to-Video API generates desired videos via images and keywords, leveraging the latest models to produce tailored visual outputs effectively.
API documentation
Interface for removing background from the submitted video:
- Request URL: https://www.cutout.pro/api/v2/imageToVideo/generate
- Request method: POST
- Return type: json data
- Input parameters:
(1)Request parameters (Header)
Parameter | Parameter Type | Description |
---|---|---|
APIKEY | string | Your API Key |
(2) Payload
Parameter | Parameter Type | Description |
---|---|---|
imageUrl | string | Image URL, width and height restrictions: minimum 300 pixels, maximum no more than 6000 pixels, and image size cannot exceed 10MB. |
prompt | string | Keywords (optional). Filling in keywords can make the video closer to the effect you want. |
(3) Response data
{
"code":0, // 0 indicates success, and the other values are the corresponding error codes
"data": 700842286474565,
"msg":null, // if code is not 0, the error msg of the error
"time": 1615368038661, // the unix timestamp of server
"requestId": "6880539bcc69f3e9bd67a5a6fb35d0fc"
}
Sample Code
bash
curl -X POST "https://www.cutout.pro/api/v2/imageToVideo/generate" \
-H "APIKEY: The API key of the account" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "image url",
"prompt": "prompt"
}'
python
import requests
import json
url = "https://www.cutout.pro/api/v2/imageToVideo/generate"
headers = {
"APIKEY": "The API key of the account",
"Content-Type": "application/json"
}
data = {
"imageUrl": "image url",
"prompt": "prompt"
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
php
<?php
$url = 'https://www.cutout.pro/api/v2/imageToVideo/generate';
$data = array(
'imageUrl' => 'image url',
'prompt' => 'prompt'
);
$options = array(
'http' => array(
'method' => 'POST',
'header' => "APIKEY: The API key of the account\r\n" .
"Content-Type: application/json\r\n",
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
java
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.client.RestTemplate;
public class RequestExample {
public static void main(String[] args) {
RestTemplate restTemplate = new RestTemplate();
String url = "https://www.cutout.pro/api/v2/imageToVideo/generate";
// setting header
HttpHeaders headers = new HttpHeaders();
headers.set("APIKEY", "The API key of the account");
headers.setContentType(MediaType.APPLICATION_JSON);
// request body json
String jsonBody = "{\"imageUrl\":\"image url\",\"prompt\":\"prompt\"}";
HttpEntity<String> request = new HttpEntity<>(jsonBody, headers);
// send post request
String response = restTemplate.postForObject(url, request, String.class);
System.out.println(response);
}
}
nodejs
const https = require('https');
const postData = JSON.stringify({
"imageUrl": "https://example.com/your-image.jpg",
"prompt": "prompt"
});
const options = {
hostname: 'www.cutout.pro',
path: '/api/v2/imageToVideo/generate',
method: 'POST',
headers: {
'APIKEY': 'your_api_key_here',
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData)
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log('request success:');
console.log(JSON.parse(responseData));
});
});
req.on('error', (e) => {
console.error('request error:', e.message);
});
req.write(postData);
req.end();
Query generation results:
- Request URL: https://www.cutout.pro/api/v2/imageToVideo/getResult
- Request method: GET
- Input parameters:
(1) Request parameters (Header)
Parameter | Parameter Type | Description |
---|---|---|
APIKEY | string | Your API key |
(2) Query String
Parameter | Parameter Type | Description |
---|---|---|
id | long | the task id returned by the submission |
(3) Response data
{
"code": 0,
"data": {
"id": 700842286474565,
"userId": 528874,
"imageUrl": "https://example.com/your-image.jpg",
"originalPrompt": "Request keywords",
"resultUrl": "The resulting video URL",
"cover": "The video cover URL of the generated result",
"width": 1024,
"height": 1024,
"status": 1, //0 = process | 1 = success | 2 = failed
"percentage": 100,
"waitNumber": 0,
"createdAt": 1753240476000
},
"msg": "",
"time": 1753241547143,
"requestId": "688057cb0234b17e58a64906f583ae12"
}
Return result parameter:
id | The task id returned when generating. |
---|---|
userId | The id used by the current APIKEY. |
imageUrl | The image URL requested when generating. |
originalPrompt | Keywords requested when generating. |
resultUrl | Generate the resulting URL for the video. |
cover | Generate video cover. |
width | Generate the width of the video, calculated based on the video cover |
height | The height of the generated video is calculated based on the video cover |
status | The status of the generated video, 0 = generating, 1 = generating successfully, 2 = generating failed |
percentage | The progress of processing the video. When the progress is 100, the video generation is complete. |
waitNumber | The number of requests currently waiting in queue |
createdAt | Time when the video was created |
(4) Error Reponse
{
"code": 9011,
"data": null,
"msg": "Image contains inappropriate content, cannot be processed.",
"time": 1753241547143,
"requestId": "688057cb0234b17e58a64906f583ae12"
}
Error Code:
Code | Msg |
---|---|
9011 | Image contains inappropriate content, cannot be processed. |
1001 | The server is abnormal. Please contact us. |
4002 | No results were found for the current ID. Please check if the ID input is incorrect. |
Sample Code
bash
curl -H 'APIKEY: INSERT_YOUR_API_KEY_HERE' \
'https://www.cutout.pro/api/v2/imageToVideo/getResult?id=1111'
python
import requests
api_key = "your_api_key_here"
id_value = "your_id_here"
url = f"https://www.cutout.pro/api/v2/imageToVideo/getResult?id={id_value}"
headers = {
"APIKEY": api_key
}
response = requests.get(url, headers=headers)
print(response.text)
php
<?php
$apiKey = "your_api_key_here";
$id = "your_id_here";
$url = "https://www.cutout.pro/api/v2/imageToVideo/getResult?id=$id";
$headers = array(
'APIKEY: ' . $apiKey
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
java
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
public class Main {
public static void main(String[] args) {
RestTemplate restTemplate = new RestTemplate();
String apiKey = "your_api_key_here";
String id = "your_id_here";
String url = "https://www.cutout.pro/api/v2/imageToVideo/getResult?id=" + id;
HttpHeaders headers = new HttpHeaders();
headers.set("APIKEY", apiKey);
HttpEntity<String> entity = new HttpEntity<>(headers);
ResponseEntity<String> response = restTemplate.exchange(
url,
HttpMethod.GET,
entity,
String.class
);
System.out.println(response.getBody());
}
}
nodejs
const https = require('https');
const apiKey = "your_api_key_here";
const id = "your_id_here";
const options = {
hostname: 'www.cutout.pro',
path: `/api/v2/imageToVideo/getResult?id=${id}`,
method: 'GET',
headers: {
'APIKEY': apiKey
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(data);
});
}).on('error', (error) => {
console.error(error);
});
req.end();
The cost incurred by the request
Each request will consume 5 video credits.