Generate videos
curl --request POST \
--url https://api.gately.ai/v1/video_generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "T2V-01-Director",
"prompt": "A spaceship landing on a distant planet [camera panning right]"
}
'import requests
url = "https://api.gately.ai/v1/video_generation"
payload = {
"model": "T2V-01-Director",
"prompt": "A spaceship landing on a distant planet [camera panning right]"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'T2V-01-Director',
prompt: 'A spaceship landing on a distant planet [camera panning right]'
})
};
fetch('https://api.gately.ai/v1/video_generation', 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.gately.ai/v1/video_generation",
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([
'model' => 'T2V-01-Director',
'prompt' => 'A spaceship landing on a distant planet [camera panning right]'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.gately.ai/v1/video_generation"
payload := strings.NewReader("{\n \"model\": \"T2V-01-Director\",\n \"prompt\": \"A spaceship landing on a distant planet [camera panning right]\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.gately.ai/v1/video_generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"T2V-01-Director\",\n \"prompt\": \"A spaceship landing on a distant planet [camera panning right]\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gately.ai/v1/video_generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"T2V-01-Director\",\n \"prompt\": \"A spaceship landing on a distant planet [camera panning right]\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"base_resp": {
"status_code": 123,
"status_msg": "<string>"
}
}Media
Video Generation
Generate dynamic videos from text descriptions or images
POST
/
v1
/
video_generation
Generate videos
curl --request POST \
--url https://api.gately.ai/v1/video_generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "T2V-01-Director",
"prompt": "A spaceship landing on a distant planet [camera panning right]"
}
'import requests
url = "https://api.gately.ai/v1/video_generation"
payload = {
"model": "T2V-01-Director",
"prompt": "A spaceship landing on a distant planet [camera panning right]"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'T2V-01-Director',
prompt: 'A spaceship landing on a distant planet [camera panning right]'
})
};
fetch('https://api.gately.ai/v1/video_generation', 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.gately.ai/v1/video_generation",
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([
'model' => 'T2V-01-Director',
'prompt' => 'A spaceship landing on a distant planet [camera panning right]'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.gately.ai/v1/video_generation"
payload := strings.NewReader("{\n \"model\": \"T2V-01-Director\",\n \"prompt\": \"A spaceship landing on a distant planet [camera panning right]\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.gately.ai/v1/video_generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"T2V-01-Director\",\n \"prompt\": \"A spaceship landing on a distant planet [camera panning right]\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gately.ai/v1/video_generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"T2V-01-Director\",\n \"prompt\": \"A spaceship landing on a distant planet [camera panning right]\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"base_resp": {
"status_code": 123,
"status_msg": "<string>"
}
}Video Generation API
Generate high-quality videos from text prompts or images with camera movement control.Overview
The video generation API allows you to create dynamic videos from text descriptions or images. The process works asynchronously:- Submit a generation task
- Poll the task status using the returned task ID
- Download the video using the file ID once the task is complete
Video Generation Task
The OpenAPI playground above allows you to generate videos. After submitting, you’ll receive a
task_id that you can use to check the status.Check Generation Status
To check the status of your video generation task, use the status endpoint:GET /v1/query/video_generation?task_id={task_id}
status field shows “Success”, you’ll also receive a file_id that can be used to download the video.Camera Movement Instructions
When using the Director models (T2V-01-Director, I2V-01-Director), you can include camera movement instructions in your prompt using square brackets:
- Single movement:
[Truck left] - Combined movements:
[Truck left, Pan right]
Available Camera Movements:
- Truck:
[Truck left],[Truck right] - Pan:
[Pan left],[Pan right] - Push:
[Push in],[Pull out] - Pedestal:
[Pedestal up],[Pedestal down] - Tilt:
[Tilt up],[Tilt down] - Zoom:
[Zoom in],[Zoom out] - Other:
[Shake],[Tracking shot],[Static shot]
Download Generated Video
Once your video is ready, you can download it using the file retrieval endpoint:GET /v1/files/retrieve?file_id={file_id}
Complete Example (Python)
import requests
import time
API_KEY = "your-api-key"
BASE_URL = "https://api.gately.ai"
def create_video_task(prompt, model="T2V-01-Director"):
url = f"{BASE_URL}/v1/video_generation"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"model": model,
"prompt": prompt
}
response = requests.post(url, headers=headers, json=data)
return response.json()["task_id"]
def check_task_status(task_id):
url = f"{BASE_URL}/v1/query/video_generation"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
params = {"task_id": task_id}
response = requests.get(url, headers=headers, params=params)
return response.json()
def get_video_url(file_id):
url = f"{BASE_URL}/v1/files/retrieve"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
params = {"file_id": file_id}
response = requests.get(url, headers=headers, params=params)
return response.json()["file"]["download_url"]
# Example usage
prompt = "[Truck left,Pan right]A woman is drinking coffee"
print("Creating video task...")
task_id = create_video_task(prompt)
while True:
print("Checking status...")
status = check_task_status(task_id)
if status["status"] == "Success":
print("Video ready!")
video_url = get_video_url(status["file_id"])
print(f"Download URL: {video_url}")
break
elif status["status"] == "Fail":
print("Generation failed!")
break
print(f"Status: {status['status']}")
time.sleep(10)
Error Handling
The API uses standard HTTP status codes. Common errors include:- 400: Bad Request - Check your request parameters
- 401: Unauthorized - Invalid or missing API key
- 429: Too Many Requests - Rate limit exceeded
- 500: Internal Server Error - Contact support
error field in the response body.Authorizations
Enter your API key prefixed with 'Bearer '
Body
application/json
Video generation model to use
Available options:
T2V-01-Director, I2V-01-Director, S2V-01, I2V-01, I2V-01-live, T2V-01 Text description of the video to generate. Can include camera movement instructions in square brackets.
Base64-encoded image data for image-to-video generation
Was this page helpful?

