curl --request POST \
--url https://api.wondercraft.ai/v1/video \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model_id": "<string>",
"duration": 15,
"start_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"end_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference_image_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"reference_video_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"source_video_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.wondercraft.ai/v1/video"
payload = {
"prompt": "<string>",
"model_id": "<string>",
"duration": 15,
"start_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"end_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference_image_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"reference_video_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"source_video_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model_id: '<string>',
duration: 15,
start_frame_image_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
end_frame_image_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
reference_image_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
reference_video_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
source_video_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.wondercraft.ai/v1/video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wondercraft.ai/v1/video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'model_id' => '<string>',
'duration' => 15,
'start_frame_image_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'end_frame_image_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'reference_image_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'reference_video_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'source_video_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wondercraft.ai/v1/video"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model_id\": \"<string>\",\n \"duration\": 15,\n \"start_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"end_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"reference_image_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"reference_video_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"source_video_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wondercraft.ai/v1/video")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model_id\": \"<string>\",\n \"duration\": 15,\n \"start_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"end_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"reference_image_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"reference_video_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"source_video_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wondercraft.ai/v1/video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model_id\": \"<string>\",\n \"duration\": 15,\n \"start_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"end_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"reference_image_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"reference_video_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"source_video_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"estimated_credits": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Generate a video
Starts a background job that generates a video. The mode follows from the inputs you send:
nothing extra for text-to-video, start_frame_image_id for image-to-video (plus
end_frame_image_id for first/last frame), reference_image_ids and/or reference_video_ids
for references, or source_video_id to edit a video. The response contains a job_id to poll
with GET /video/{job_id}, and the credits the job is expected to cost.
Requires a valid X-API-KEY header.
Throws:
- 400 if the model, mode, resolution, duration or aspect ratio is not supported, a clip is too short or long, or the prompt references inputs the request does not carry
- 402 if the workspace does not have enough credits, or the model is not available on its plan
- 404 if an image or video does not exist or is not accessible
- 422 if the request body is invalid, e.g. it mixes inputs from different modes
curl --request POST \
--url https://api.wondercraft.ai/v1/video \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model_id": "<string>",
"duration": 15,
"start_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"end_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference_image_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"reference_video_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"source_video_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.wondercraft.ai/v1/video"
payload = {
"prompt": "<string>",
"model_id": "<string>",
"duration": 15,
"start_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"end_frame_image_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference_image_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"reference_video_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"source_video_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model_id: '<string>',
duration: 15,
start_frame_image_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
end_frame_image_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
reference_image_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
reference_video_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
source_video_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.wondercraft.ai/v1/video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wondercraft.ai/v1/video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'model_id' => '<string>',
'duration' => 15,
'start_frame_image_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'end_frame_image_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'reference_image_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'reference_video_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'source_video_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wondercraft.ai/v1/video"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model_id\": \"<string>\",\n \"duration\": 15,\n \"start_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"end_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"reference_image_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"reference_video_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"source_video_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wondercraft.ai/v1/video")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model_id\": \"<string>\",\n \"duration\": 15,\n \"start_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"end_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"reference_image_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"reference_video_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"source_video_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wondercraft.ai/v1/video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model_id\": \"<string>\",\n \"duration\": 15,\n \"start_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"end_frame_image_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"reference_image_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"reference_video_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"source_video_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"estimated_credits": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
What to generate. Refer to references as @Image 1 or @Video 1.
1A model id from GET /video/models
One of the model's resolutions; defaults to its default_resolution
480p, 720p, 1080p, 2k, 4k One of the model's aspect_ratios; defaults to 16:9 when supported
16:9, 9:16, 1:1 Seconds, one of the model's durations; defaults to its default_duration
1 <= x <= 30Image to open the video with (image mode), from POST /image/upload or an image job
Image to end the video with (frames mode); requires start_frame_image_id
Subject or style reference images (references mode), in prompt order
Motion or style reference clips (references mode), in prompt order
Video to edit (video_to_video mode), from POST /video/upload or a video job
