Grok Imagine Reference-to-Video
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-reference-to-video",
"prompt": "A @Image1 astronaut walking through glowing blue fog, cinematic slow motion",
"reference_image_urls": [
"https://example.com/ref-1.jpg"
],
"duration": 8,
"aspect_ratio": "16:9",
"resolution": "480p"
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "grok-imagine-reference-to-video",
"prompt": "A @Image1 astronaut walking through glowing blue fog, cinematic slow motion",
"reference_image_urls": ["https://example.com/ref-1.jpg"],
"duration": 8,
"aspect_ratio": "16:9",
"resolution": "480p"
}
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-reference-to-video',
prompt: 'A @Image1 astronaut walking through glowing blue fog, cinematic slow motion',
reference_image_urls: ['https://example.com/ref-1.jpg'],
duration: 8,
aspect_ratio: '16:9',
resolution: '480p'
})
};
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-reference-to-video',
'prompt' => 'A @Image1 astronaut walking through glowing blue fog, cinematic slow motion',
'reference_image_urls' => [
'https://example.com/ref-1.jpg'
],
'duration' => 8,
'aspect_ratio' => '16:9',
'resolution' => '480p'
]),
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-reference-to-video\",\n \"prompt\": \"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion\",\n \"reference_image_urls\": [\n \"https://example.com/ref-1.jpg\"\n ],\n \"duration\": 8,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"480p\"\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-reference-to-video\",\n \"prompt\": \"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion\",\n \"reference_image_urls\": [\n \"https://example.com/ref-1.jpg\"\n ],\n \"duration\": 8,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"480p\"\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-reference-to-video\",\n \"prompt\": \"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion\",\n \"reference_image_urls\": [\n \"https://example.com/ref-1.jpg\"\n ],\n \"duration\": 8,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"480p\"\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 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 Reference-to-Video
- Grok Imagine reference-to-video generation model
- 1-7 reference images, supports @Image1 references in prompt
- Supports
480p/720poutput, 1-10 seconds duration - Asynchronous 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 Reference-to-Video
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-reference-to-video",
"prompt": "A @Image1 astronaut walking through glowing blue fog, cinematic slow motion",
"reference_image_urls": [
"https://example.com/ref-1.jpg"
],
"duration": 8,
"aspect_ratio": "16:9",
"resolution": "480p"
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "grok-imagine-reference-to-video",
"prompt": "A @Image1 astronaut walking through glowing blue fog, cinematic slow motion",
"reference_image_urls": ["https://example.com/ref-1.jpg"],
"duration": 8,
"aspect_ratio": "16:9",
"resolution": "480p"
}
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-reference-to-video',
prompt: 'A @Image1 astronaut walking through glowing blue fog, cinematic slow motion',
reference_image_urls: ['https://example.com/ref-1.jpg'],
duration: 8,
aspect_ratio: '16:9',
resolution: '480p'
})
};
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-reference-to-video',
'prompt' => 'A @Image1 astronaut walking through glowing blue fog, cinematic slow motion',
'reference_image_urls' => [
'https://example.com/ref-1.jpg'
],
'duration' => 8,
'aspect_ratio' => '16:9',
'resolution' => '480p'
]),
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-reference-to-video\",\n \"prompt\": \"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion\",\n \"reference_image_urls\": [\n \"https://example.com/ref-1.jpg\"\n ],\n \"duration\": 8,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"480p\"\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-reference-to-video\",\n \"prompt\": \"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion\",\n \"reference_image_urls\": [\n \"https://example.com/ref-1.jpg\"\n ],\n \"duration\": 8,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"480p\"\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-reference-to-video\",\n \"prompt\": \"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion\",\n \"reference_image_urls\": [\n \"https://example.com/ref-1.jpg\"\n ],\n \"duration\": 8,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"480p\"\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 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-reference-to-video: Reference image to video generation
Example:
"grok-imagine-reference-to-video"
Text prompt describing the video content to generate
Notes:
- Supports both Chinese and English
- Use
@Image1,@Image2… to reference images - Maximum
4096characters
Maximum string length:
4096Example:
"A @Image1 astronaut walking through glowing blue fog, cinematic slow motion"
Reference image URL list
Notes:
- Count:
1-7images - Use
@Image1~@Image7in prompt to reference corresponding images
Required array length:
1 - 7 elementsExample:
["https://example.com/ref-1.jpg"]
Output video duration (seconds)
Notes:
- Range:
1-10 - Defaults to
8if not provided
Example:
8
Output video aspect ratio
Options:
16:9,4:3,3:2,1:1,2:3,3:4,9:16
Notes:
- Defaults to
16:9if not provided
Example:
"16:9"
Output video resolution
Options:
480p720p
Notes:
- Defaults to
480pif not provided
Example:
"480p"
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"