cURL
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>"
}
]
}
'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>" }]
}
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>'}]
})
};
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>'
]
]
]),
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}")
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}")
.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}"
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."
}Grok
生成视频-官转
Grok 视频生成接口。grok-imagine-video 支持文生视频(T2V)和图生视频(I2V);grok-imagine-video-1.5 仅支持图生视频(I2V),必须传入 image。
注意:同步官方规则,内容审核失败的场景也会扣费。
POST
/
grok
/
v1
/
videos
/
generations
cURL
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>"
}
]
}
'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>" }]
}
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>'}]
})
};
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>'
]
]
]),
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}")
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}")
.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}"
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."
}请求体
application/json
视频生成提示词。grok-imagine-video 模型支持文生视频时必填;grok-imagine-video-1.5 模型可选。
使用的模型名称。
可用选项:
grok-imagine-video, grok-imagine-video-1.5 示例:
"grok-imagine-video-1.5"
视频宽高比。
可用选项:
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 视频时长(秒)。范围:[1, 15]。默认:8。同时接受数字(8)和字符串("8")格式。
必填范围:
1 <= x <= 15图生视频时使用的图片对象。grok-imagine-video-1.5 模型必须传入(仅支持图生视频);grok-imagine-video 模型可选,传入时执行图生视频,不传时执行文生视频。
Show child attributes
Show child attributes
参考生视频(R2V)时使用的参考图片数组。提供这些图片作为风格/内容参考来生成视频。
Show child attributes
Show child attributes
视频分辨率。
可用选项:
480p, 720p, 1080p 响应
请求成功
请求ID
示例:
"41eb9a5f-cbd4-9f21-8d59-79005f1e61b7"
最后修改于 2026年6月4日
⌘I