curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-o3-reference-to-video",
"prompt": "Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist",
"resolution": "720p",
"start_image_url": "https://picsum.photos/id/1015/1280/720.jpg",
"image_urls": [
"https://picsum.photos/id/1016/1280/720.jpg"
],
"elements": [
{
"frontal_image_url": "https://picsum.photos/id/1027/768/1024.jpg",
"reference_image_urls": [
"https://picsum.photos/id/1028/768/1024.jpg"
]
}
],
"aspect_ratio": "16:9",
"duration": 5
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "kling-o3-reference-to-video",
"prompt": "Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist",
"resolution": "720p",
"start_image_url": "https://picsum.photos/id/1015/1280/720.jpg",
"image_urls": ["https://picsum.photos/id/1016/1280/720.jpg"],
"elements": [
{
"frontal_image_url": "https://picsum.photos/id/1027/768/1024.jpg",
"reference_image_urls": ["https://picsum.photos/id/1028/768/1024.jpg"]
}
],
"aspect_ratio": "16:9",
"duration": 5
}
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: 'kling-o3-reference-to-video',
prompt: 'Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist',
resolution: '720p',
start_image_url: 'https://picsum.photos/id/1015/1280/720.jpg',
image_urls: ['https://picsum.photos/id/1016/1280/720.jpg'],
elements: [
{
frontal_image_url: 'https://picsum.photos/id/1027/768/1024.jpg',
reference_image_urls: ['https://picsum.photos/id/1028/768/1024.jpg']
}
],
aspect_ratio: '16:9',
duration: 5
})
};
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' => 'kling-o3-reference-to-video',
'prompt' => 'Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist',
'resolution' => '720p',
'start_image_url' => 'https://picsum.photos/id/1015/1280/720.jpg',
'image_urls' => [
'https://picsum.photos/id/1016/1280/720.jpg'
],
'elements' => [
[
'frontal_image_url' => 'https://picsum.photos/id/1027/768/1024.jpg',
'reference_image_urls' => [
'https://picsum.photos/id/1028/768/1024.jpg'
]
]
],
'aspect_ratio' => '16:9',
'duration' => 5
]),
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\": \"kling-o3-reference-to-video\",\n \"prompt\": \"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist\",\n \"resolution\": \"720p\",\n \"start_image_url\": \"https://picsum.photos/id/1015/1280/720.jpg\",\n \"image_urls\": [\n \"https://picsum.photos/id/1016/1280/720.jpg\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://picsum.photos/id/1027/768/1024.jpg\",\n \"reference_image_urls\": [\n \"https://picsum.photos/id/1028/768/1024.jpg\"\n ]\n }\n ],\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5\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\": \"kling-o3-reference-to-video\",\n \"prompt\": \"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist\",\n \"resolution\": \"720p\",\n \"start_image_url\": \"https://picsum.photos/id/1015/1280/720.jpg\",\n \"image_urls\": [\n \"https://picsum.photos/id/1016/1280/720.jpg\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://picsum.photos/id/1027/768/1024.jpg\",\n \"reference_image_urls\": [\n \"https://picsum.photos/id/1028/768/1024.jpg\"\n ]\n }\n ],\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5\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\": \"kling-o3-reference-to-video\",\n \"prompt\": \"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist\",\n \"resolution\": \"720p\",\n \"start_image_url\": \"https://picsum.photos/id/1015/1280/720.jpg\",\n \"image_urls\": [\n \"https://picsum.photos/id/1016/1280/720.jpg\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://picsum.photos/id/1027/768/1024.jpg\",\n \"reference_image_urls\": [\n \"https://picsum.photos/id/1028/768/1024.jpg\"\n ]\n }\n ],\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5\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 parameters",
"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"
}
}Kling-O3 Reference to Video
- Kling O3 reference-to-video model
- Generates video driven by reference images and subject elements
- Supports
720p/1080p/4k;4kis a separate native 4K tier - Optional accompanying audio generation
- Async processing mode — use the returned task ID to check task status
- Generated video links are valid for 24 hours; please save them promptly
curl --request POST \
--url https://api.aihubmax.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-o3-reference-to-video",
"prompt": "Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist",
"resolution": "720p",
"start_image_url": "https://picsum.photos/id/1015/1280/720.jpg",
"image_urls": [
"https://picsum.photos/id/1016/1280/720.jpg"
],
"elements": [
{
"frontal_image_url": "https://picsum.photos/id/1027/768/1024.jpg",
"reference_image_urls": [
"https://picsum.photos/id/1028/768/1024.jpg"
]
}
],
"aspect_ratio": "16:9",
"duration": 5
}
'import requests
url = "https://api.aihubmax.com/v1/videos/generations"
payload = {
"model": "kling-o3-reference-to-video",
"prompt": "Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist",
"resolution": "720p",
"start_image_url": "https://picsum.photos/id/1015/1280/720.jpg",
"image_urls": ["https://picsum.photos/id/1016/1280/720.jpg"],
"elements": [
{
"frontal_image_url": "https://picsum.photos/id/1027/768/1024.jpg",
"reference_image_urls": ["https://picsum.photos/id/1028/768/1024.jpg"]
}
],
"aspect_ratio": "16:9",
"duration": 5
}
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: 'kling-o3-reference-to-video',
prompt: 'Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist',
resolution: '720p',
start_image_url: 'https://picsum.photos/id/1015/1280/720.jpg',
image_urls: ['https://picsum.photos/id/1016/1280/720.jpg'],
elements: [
{
frontal_image_url: 'https://picsum.photos/id/1027/768/1024.jpg',
reference_image_urls: ['https://picsum.photos/id/1028/768/1024.jpg']
}
],
aspect_ratio: '16:9',
duration: 5
})
};
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' => 'kling-o3-reference-to-video',
'prompt' => 'Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist',
'resolution' => '720p',
'start_image_url' => 'https://picsum.photos/id/1015/1280/720.jpg',
'image_urls' => [
'https://picsum.photos/id/1016/1280/720.jpg'
],
'elements' => [
[
'frontal_image_url' => 'https://picsum.photos/id/1027/768/1024.jpg',
'reference_image_urls' => [
'https://picsum.photos/id/1028/768/1024.jpg'
]
]
],
'aspect_ratio' => '16:9',
'duration' => 5
]),
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\": \"kling-o3-reference-to-video\",\n \"prompt\": \"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist\",\n \"resolution\": \"720p\",\n \"start_image_url\": \"https://picsum.photos/id/1015/1280/720.jpg\",\n \"image_urls\": [\n \"https://picsum.photos/id/1016/1280/720.jpg\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://picsum.photos/id/1027/768/1024.jpg\",\n \"reference_image_urls\": [\n \"https://picsum.photos/id/1028/768/1024.jpg\"\n ]\n }\n ],\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5\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\": \"kling-o3-reference-to-video\",\n \"prompt\": \"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist\",\n \"resolution\": \"720p\",\n \"start_image_url\": \"https://picsum.photos/id/1015/1280/720.jpg\",\n \"image_urls\": [\n \"https://picsum.photos/id/1016/1280/720.jpg\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://picsum.photos/id/1027/768/1024.jpg\",\n \"reference_image_urls\": [\n \"https://picsum.photos/id/1028/768/1024.jpg\"\n ]\n }\n ],\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5\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\": \"kling-o3-reference-to-video\",\n \"prompt\": \"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist\",\n \"resolution\": \"720p\",\n \"start_image_url\": \"https://picsum.photos/id/1015/1280/720.jpg\",\n \"image_urls\": [\n \"https://picsum.photos/id/1016/1280/720.jpg\"\n ],\n \"elements\": [\n {\n \"frontal_image_url\": \"https://picsum.photos/id/1027/768/1024.jpg\",\n \"reference_image_urls\": [\n \"https://picsum.photos/id/1028/768/1024.jpg\"\n ]\n }\n ],\n \"aspect_ratio\": \"16:9\",\n \"duration\": 5\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 parameters",
"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
kling-o3-reference-to-video: Video generation driven by reference images and subject elements, supports 720p / 1080p / 4k
"kling-o3-reference-to-video"
Text prompt
Notes:
- Maximum 2500 characters
- Use
@Image1/@Element1to reference materials - Mutually exclusive with
multi_prompt
2500"Referencing the coastline composition of @Image1 and the character appearance of @Element1, generate a travel clip in morning mist"
Output resolution
Options:
720p— 720P SD1080p— 1080P HD4k— Native 4K UHD (independent tier, billing not affected bygenerate_audio)
"720p"
Whether to generate accompanying audio
false
First-frame reference image URL
"https://picsum.photos/id/1015/1280/720.jpg"
End-frame image URL
"https://picsum.photos/id/1016/1280/720.jpg"
Reference image URL list
Notes:
- Use
@Image1/@Image2in the prompt to reference - When
elementscontains video subjects, the total count is limited to4
[
"https://picsum.photos/id/1016/1280/720.jpg"
]
Subject element list
Notes:
- Use
@Element1/@Element2in the prompt to reference - When video subjects are included, the combined total of
elementsandimage_urlsis limited to4
Do not pass this parameter unless necessary.
Show child attributes
Show child attributes
[
{
"frontal_image_url": "https://picsum.photos/id/1027/768/1024.jpg",
"reference_image_urls": [
"https://picsum.photos/id/1028/768/1024.jpg"
]
}
]
Output video aspect ratio
Available values: 16:9, 9:16, 1:1
"16:9"
Output video duration (seconds), 3-15
5
Multi-shot segmentation mode, currently fixed to customize
Do not pass this parameter unless necessary.
"customize"
Multi-prompt sequence
Notes:
- Mutually exclusive with
prompt - The sum of all segment
durationvalues should equal the totalduration
Do not pass this parameter unless necessary.
Show child attributes
Show child attributes
Response
Task created successfully
Task creation timestamp
1757165031
Task ID
"task-unified-1757165031-uyujaw3d"
Actual model name used
Specific task type
video.generation.task Task progress percentage (0-100)
0 <= x <= 1000
Task status
pending, processing, completed, failed "pending"
Async task information
Show child attributes
Show child attributes
Task output type
video "video"