curl --request POST \
--url https://api.ttapi.io/grok/v1/videos/generations \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model": "grok-imagine-video-1.5",
"duration": 8,
"image": {
"url": "<string>"
},
"reference_images": [
{
"url": "<string>"
}
],
"reference_audios": [
{
"voice_id": "sirius"
},
{
"voice_id": "carina"
},
{
"voice_id": "leo"
}
]
}
'import requests
url = "https://api.ttapi.io/grok/v1/videos/generations"
payload = {
"prompt": "<string>",
"model": "grok-imagine-video-1.5",
"duration": 8,
"image": { "url": "<string>" },
"reference_images": [{ "url": "<string>" }],
"reference_audios": [{ "voice_id": "sirius" }, { "voice_id": "carina" }, { "voice_id": "leo" }]
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model: 'grok-imagine-video-1.5',
duration: 8,
image: {url: '<string>'},
reference_images: [{url: '<string>'}],
reference_audios: [{voice_id: 'sirius'}, {voice_id: 'carina'}, {voice_id: 'leo'}]
})
};
fetch('https://api.ttapi.io/grok/v1/videos/generations', 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.ttapi.io/grok/v1/videos/generations",
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' => 'grok-imagine-video-1.5',
'duration' => 8,
'image' => [
'url' => '<string>'
],
'reference_images' => [
[
'url' => '<string>'
]
],
'reference_audios' => [
[
'voice_id' => 'sirius'
],
[
'voice_id' => 'carina'
],
[
'voice_id' => 'leo'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-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.ttapi.io/grok/v1/videos/generations"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"grok-imagine-video-1.5\",\n \"duration\": 8,\n \"image\": {\n \"url\": \"<string>\"\n },\n \"reference_images\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"reference_audios\": [\n {\n \"voice_id\": \"sirius\"\n },\n {\n \"voice_id\": \"carina\"\n },\n {\n \"voice_id\": \"leo\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-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.ttapi.io/grok/v1/videos/generations")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"grok-imagine-video-1.5\",\n \"duration\": 8,\n \"image\": {\n \"url\": \"<string>\"\n },\n \"reference_images\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"reference_audios\": [\n {\n \"voice_id\": \"sirius\"\n },\n {\n \"voice_id\": \"carina\"\n },\n {\n \"voice_id\": \"leo\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/grok/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"grok-imagine-video-1.5\",\n \"duration\": 8,\n \"image\": {\n \"url\": \"<string>\"\n },\n \"reference_images\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"reference_audios\": [\n {\n \"voice_id\": \"sirius\"\n },\n {\n \"voice_id\": \"carina\"\n },\n {\n \"voice_id\": \"leo\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "41eb9a5f-cbd4-9f21-8d59-79005f1e61b7"
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Generate Video-Official
Grok video generation API. grok-imagine-video supports text-to-video (T2V) and image-to-video (I2V); grok-imagine-video-1.5 only supports image-to-video (I2V), image is required.
curl --request POST \
--url https://api.ttapi.io/grok/v1/videos/generations \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model": "grok-imagine-video-1.5",
"duration": 8,
"image": {
"url": "<string>"
},
"reference_images": [
{
"url": "<string>"
}
],
"reference_audios": [
{
"voice_id": "sirius"
},
{
"voice_id": "carina"
},
{
"voice_id": "leo"
}
]
}
'import requests
url = "https://api.ttapi.io/grok/v1/videos/generations"
payload = {
"prompt": "<string>",
"model": "grok-imagine-video-1.5",
"duration": 8,
"image": { "url": "<string>" },
"reference_images": [{ "url": "<string>" }],
"reference_audios": [{ "voice_id": "sirius" }, { "voice_id": "carina" }, { "voice_id": "leo" }]
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model: 'grok-imagine-video-1.5',
duration: 8,
image: {url: '<string>'},
reference_images: [{url: '<string>'}],
reference_audios: [{voice_id: 'sirius'}, {voice_id: 'carina'}, {voice_id: 'leo'}]
})
};
fetch('https://api.ttapi.io/grok/v1/videos/generations', 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.ttapi.io/grok/v1/videos/generations",
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' => 'grok-imagine-video-1.5',
'duration' => 8,
'image' => [
'url' => '<string>'
],
'reference_images' => [
[
'url' => '<string>'
]
],
'reference_audios' => [
[
'voice_id' => 'sirius'
],
[
'voice_id' => 'carina'
],
[
'voice_id' => 'leo'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-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.ttapi.io/grok/v1/videos/generations"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"grok-imagine-video-1.5\",\n \"duration\": 8,\n \"image\": {\n \"url\": \"<string>\"\n },\n \"reference_images\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"reference_audios\": [\n {\n \"voice_id\": \"sirius\"\n },\n {\n \"voice_id\": \"carina\"\n },\n {\n \"voice_id\": \"leo\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-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.ttapi.io/grok/v1/videos/generations")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"grok-imagine-video-1.5\",\n \"duration\": 8,\n \"image\": {\n \"url\": \"<string>\"\n },\n \"reference_images\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"reference_audios\": [\n {\n \"voice_id\": \"sirius\"\n },\n {\n \"voice_id\": \"carina\"\n },\n {\n \"voice_id\": \"leo\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/grok/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"grok-imagine-video-1.5\",\n \"duration\": 8,\n \"image\": {\n \"url\": \"<string>\"\n },\n \"reference_images\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"reference_audios\": [\n {\n \"voice_id\": \"sirius\"\n },\n {\n \"voice_id\": \"carina\"\n },\n {\n \"voice_id\": \"leo\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "41eb9a5f-cbd4-9f21-8d59-79005f1e61b7"
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Authorizations
You can obtain your API key from the TTAPI Dashboard.
Body
Video generation prompt. Required for grok-imagine-video text-to-video; optional for grok-imagine-video-1.5.
Model name to use.
grok-imagine-video, grok-imagine-video-1.5 "grok-imagine-video-1.5"
Video aspect ratio.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Video duration in seconds. Range: [1, 15]. Default: 8. Accepts both number (8) and string ("8") formats.
1 <= x <= 15Image object used for image-to-video generation. Required for grok-imagine-video-1.5 (I2V only); optional for grok-imagine-video (T2V when omitted, I2V when provided).
Show child attributes
Show child attributes
Array of reference images used for reference-to-video (R2V). These images serve as style/content references for video generation.
Show child attributes
Show child attributes
Video resolution.
480p, 720p, 1080p Array of voice characters, up to 3 entries. Example: [{"voice_id": "sirius"}]
3Show child attributes
Show child attributes
[
{ "voice_id": "sirius" },
{ "voice_id": "carina" },
{ "voice_id": "leo" }
]
Response
Request successful
Request ID
"41eb9a5f-cbd4-9f21-8d59-79005f1e61b7"