Guides
Video Generation
Generate videos from text or images with the AirCube API.
Available video models
| Model slug | Display name | Tasks |
|---|---|---|
seedance-2.0 | Seedance 2.0 | text-to-video, image-to-video |
kling-v3.0-std | Kling 3.0 | text-to-video, image-to-video |
veo3.1 | Veo 3.1 | text-to-video |
sora-2 | Sora 2 | text-to-video, image-to-video |
wan-2.1 | Wan 2.1 | text-to-video, image-to-video |
hailuo-v2 | Hailuo V2 | text-to-video, image-to-video |
luma-ray-2 | Luma Ray 2 | text-to-video, image-to-video |
For the full list, see the model catalog.
Text to video
Generate a video from a text prompt.
cURL
curl -X POST https://aircube.ai/api/v3/seedance-2.0/text-to-video \
-H "Authorization: Bearer $AIRCUBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a drone shot flying over a mountain lake at sunrise, cinematic",
"duration": "5",
"aspect_ratio": "16:9"
}'Python
import os
import time
import requests
API_KEY = os.environ["AIRCUBE_API_KEY"]
BASE_URL = "https://aircube.ai/api/v3"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
# Submit
response = requests.post(
f"{BASE_URL}/seedance-2.0/text-to-video",
headers=HEADERS,
json={
"prompt": "a drone shot flying over a mountain lake at sunrise, cinematic",
"duration": "5",
"aspect_ratio": "16:9",
},
)
generation_id = response.json()["data"]["id"]
# Poll (use longer interval for video)
while True:
result = requests.get(f"{BASE_URL}/status/{generation_id}", headers=HEADERS).json()
if result["data"]["status"] == "completed":
print(result["data"]["output_url"])
break
elif result["data"]["status"] == "failed":
print("Failed")
break
time.sleep(5)JavaScript
const API_KEY = process.env.AIRCUBE_API_KEY;
const BASE_URL = "https://aircube.ai/api/v3";
const submitRes = await fetch(`${BASE_URL}/seedance-2.0/text-to-video`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "a drone shot flying over a mountain lake at sunrise, cinematic",
duration: "5",
aspect_ratio: "16:9",
}),
});
const { data } = await submitRes.json();
while (true) {
const pollRes = await fetch(`${BASE_URL}/status/${data.id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const result = await pollRes.json();
if (result.data.status === "completed") {
console.log(result.data.output_url);
break;
} else if (result.data.status === "failed") {
throw new Error("Failed");
}
await new Promise((r) => setTimeout(r, 5000));
}Image to video
Animate a still image into a video. Provide the source image via the image parameter.
cURL
curl -X POST https://aircube.ai/api/v3/kling-v3.0-std/image-to-video \
-H "Authorization: Bearer $AIRCUBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "the character turns and smiles at the camera",
"image": "https://example.com/character.jpg",
"duration": "5"
}'Python
response = requests.post(
f"{BASE_URL}/kling-v3.0-std/image-to-video",
headers=HEADERS,
json={
"prompt": "the character turns and smiles at the camera",
"image": "https://example.com/character.jpg",
"duration": "5",
},
)
generation_id = response.json()["data"]["id"]
while True:
result = requests.get(f"{BASE_URL}/status/{generation_id}", headers=HEADERS).json()
if result["data"]["status"] in ("completed", "failed"):
print(result["data"])
break
time.sleep(5)JavaScript
const submitRes = await fetch(`${BASE_URL}/kling-v3.0-std/image-to-video`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "the character turns and smiles at the camera",
image: "https://example.com/character.jpg",
duration: "5",
}),
});Parameters
duration
Controls the length of the generated video in seconds. Pass it as a string:
{ "duration": "5" }Common values: "3", "5", "10". Longer videos cost more credits. Available durations depend on the model.
aspect_ratio
Controls the output aspect ratio. Common values:
| Value | Use case |
|---|---|
16:9 | Landscape — standard widescreen |
9:16 | Portrait — vertical/mobile video |
1:1 | Square — social media |
resolution
Specify an exact output resolution:
{ "resolution": "1280x720" }image
A URL to a source image for image-to-video tasks. The image is downloaded and stored automatically:
{ "image": "https://example.com/source.jpg" }Tips
- Descriptive prompts produce better results. Include camera movement, lighting, and action descriptions.
- Image-to-video tends to produce more consistent results than text-to-video since the model has a visual reference.
- Poll every 5 seconds for video — generation typically takes 30 seconds to several minutes depending on the model and duration.
- Download output promptly — signed output URLs expire after 7 days.