Grok Imagine Video Extension
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-video-extension",
"prompt": "The camera slowly zooms out to reveal the city skyline at sunset",
"video_url": "https://example.com/input-video.mp4",
"duration": 6
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "grok-imagine-video-extension",
"prompt": "The camera slowly zooms out to reveal the city skyline at sunset",
"video_url": "https://example.com/input-video.mp4",
"duration": 6
}
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: 'grok-imagine-video-extension',
prompt: 'The camera slowly zooms out to reveal the city skyline at sunset',
video_url: 'https://example.com/input-video.mp4',
duration: 6
})
};
fetch('https://api.aihubmax.com/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.aihubmax.com/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([
'model' => 'grok-imagine-video-extension',
'prompt' => 'The camera slowly zooms out to reveal the city skyline at sunset',
'video_url' => 'https://example.com/input-video.mp4',
'duration' => 6
]),
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.aihubmax.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"grok-imagine-video-extension\",\n \"prompt\": \"The camera slowly zooms out to reveal the city skyline at sunset\",\n \"video_url\": \"https://example.com/input-video.mp4\",\n \"duration\": 6\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.aihubmax.com/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-video-extension\",\n \"prompt\": \"The camera slowly zooms out to reveal the city skyline at sunset\",\n \"video_url\": \"https://example.com/input-video.mp4\",\n \"duration\": 6\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/v1/videos/generations")
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\": \"grok-imagine-video-extension\",\n \"prompt\": \"The camera slowly zooms out to reveal the city skyline at sunset\",\n \"video_url\": \"https://example.com/input-video.mp4\",\n \"duration\": 6\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "video.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "video"
}{
"error": {
"message": "Invalid request format",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Insufficient account balance",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Parameter validation failed",
"type": "validation_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}{
"error": {
"message": "Service temporarily unavailable, please try again later",
"type": "service_unavailable"
}
}Grok Imagine
Grok Imagine Extension
- Grok Imagine video extension model, generates continuation clips based on existing videos
- Input video must be a 2-15 second MP4, extension clip duration supports 2-10 seconds
- Async processing mode, use the returned task ID to query task status
- Generated video links are valid for 24 hours, please save them promptly
POST
/
v1
/
videos
/
generations
Grok Imagine Video Extension
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-video-extension",
"prompt": "The camera slowly zooms out to reveal the city skyline at sunset",
"video_url": "https://example.com/input-video.mp4",
"duration": 6
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "grok-imagine-video-extension",
"prompt": "The camera slowly zooms out to reveal the city skyline at sunset",
"video_url": "https://example.com/input-video.mp4",
"duration": 6
}
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: 'grok-imagine-video-extension',
prompt: 'The camera slowly zooms out to reveal the city skyline at sunset',
video_url: 'https://example.com/input-video.mp4',
duration: 6
})
};
fetch('https://api.aihubmax.com/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.aihubmax.com/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([
'model' => 'grok-imagine-video-extension',
'prompt' => 'The camera slowly zooms out to reveal the city skyline at sunset',
'video_url' => 'https://example.com/input-video.mp4',
'duration' => 6
]),
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.aihubmax.com/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"grok-imagine-video-extension\",\n \"prompt\": \"The camera slowly zooms out to reveal the city skyline at sunset\",\n \"video_url\": \"https://example.com/input-video.mp4\",\n \"duration\": 6\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.aihubmax.com/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-video-extension\",\n \"prompt\": \"The camera slowly zooms out to reveal the city skyline at sunset\",\n \"video_url\": \"https://example.com/input-video.mp4\",\n \"duration\": 6\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/v1/videos/generations")
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\": \"grok-imagine-video-extension\",\n \"prompt\": \"The camera slowly zooms out to reveal the city skyline at sunset\",\n \"video_url\": \"https://example.com/input-video.mp4\",\n \"duration\": 6\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "video.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "video"
}{
"error": {
"message": "Invalid request format",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Insufficient account balance",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Parameter validation failed",
"type": "validation_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}{
"error": {
"message": "Service temporarily unavailable, please try again later",
"type": "service_unavailable"
}
}Authorizations
All APIs require Bearer Token authentication
Add to request header:
Authorization: Bearer YOUR_API_KEY
Body
application/json
grok-imagine-video-extension: Generates continuation clips based on existing videos
Text prompt describing what should happen next in the video
Notes:
- Supports both Chinese and English
- Recommended to describe camera continuation, action progression, or scene transitions
Example:
"The camera slowly zooms out to reveal the city skyline at sunset"
Public URL of the input video
Notes:
- Must be a publicly accessible MP4 URL
- Input video duration must be between
2-15seconds
Example:
"https://example.com/input-video.mp4"
Extension clip duration in seconds
Notes:
- Range:
2-10 - Defaults to
6seconds upstream when not specified
Example:
2
Response
Task created successfully
Task creation timestamp
Example:
1757165031
Task ID
Example:
"task-unified-1757165031-uyujaw3d"
Actual model name used
Specific task type
Available options:
video.generation.task Task progress percentage (0-100)
Required range:
0 <= x <= 100Example:
0
Task status
Available options:
pending, processing, completed, failed Example:
"pending"
Asynchronous task information
Show child attributes
Show child attributes
Task output type
Available options:
video Example:
"video"