Kling 4.0 Reference to Video
Model id: kling-video/v4/reference-to-video. Kling 4.0 reference-to-video keeps characters, objects and scenes from up to 10 reference images and 7 elements consistent across 3-30 second videos.
Model Overview
Kling 4.0 reference-to-video keeps characters, objects and scenes from up to 10 reference images and 7 elements consistent across 3-30 second videos.
Setup your API Key
If you don't have an API key yet, use our Quickstart guide.
How to Make a Call
API Schemas
Create a video generation task and send it to the server
Text prompt for video generation. Refer to the references as @Image1, @Image2, … and @Element1, @Element2, …. Mutually exclusive with multi_prompt.
Optional first frame of the video. It counts toward the 10-image limit of image_urls.
Reference images, referred to in the prompt as @Image1, @Image2, … (up to 10). Max 30MB each, at least 300px per side, aspect ratio 0.4-2.5.
Video duration in seconds (3-30). With multi_prompt the video length is the sum of the shot durations instead.
5The resolution of the output video, where the number refers to the short side in pixels.
1080pPossible values: The aspect ratio of the generated video. auto follows the references.
16:9Possible values: Successful response.
The ID of the generated video.
60ac7c34-3224-4b14-8e7d-0aa0db708325The current status of the generation task.
completedPossible values: curl --request POST \
--url 'https://api.aimlapi.com/v2/video/generations' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
--header 'Content-Type: application/json' \
--data '{"model": "kling-video/v4/reference-to-video", "prompt": "Describe what you want the model to generate.", "image_url": "https://example.com/input.jpg", "duration": 5}'Successful response.
{
"id": "60ac7c34-3224-4b14-8e7d-0aa0db708325",
"status": "completed",
"video": {
"url": "https://cdn.aimlapi.com/generations/hedgehog/1759866285599-0cdfb138-c03a-49d4-a601-4f6413e27b15.mp4"
},
"error": {
"name": "text",
"message": "text"
},
"meta": {
"usage": {
"credits_used": 120000,
"usd_spent": 0.06
}
}
}Retrieve the generated video from the server
Poll this endpoint with the generation_id returned by the submit request. When the status is completed, the response includes the generated video URL.
Bearer key
<REPLACE_WITH_YOUR_GENERATION_ID>The ID of the generated video.
60ac7c34-3224-4b14-8e7d-0aa0db708325The current status of the generation task.
completedPossible values: curl -L \
--request GET \
--url 'https://api.aimlapi.com/v2/video/generations?generation_id=<REPLACE_WITH_YOUR_GENERATION_ID>' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'{
"id": "60ac7c34-3224-4b14-8e7d-0aa0db708325",
"status": "completed",
"video": {
"url": "https://cdn.aimlapi.com/generations/hedgehog/1759866285599-0cdfb138-c03a-49d4-a601-4f6413e27b15.mp4"
},
"error": {
"name": "text",
"message": "text"
},
"meta": {
"usage": {
"credits_used": 120000
}
}
}Code Example
The examples submit a generation task and poll every 15 seconds until the final result is available.
Last updated
Was this helpful?