
Text to Image
Create AI images from text prompts
Extend videos with Kling 4.0 API by Kuaishou using text prompts and an optional target end frame, keeping the source aspect ratio for creative work on Flaq AI.
// Step 1: Submit generation request
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
model_name: 'kling-v4.0-video-extend',
prompt: 'Continue the camera movement forward through the valley as the sun rises above the mountains',
video_url: 'https://example.com/source.mp4',
resolution: '720p',
duration: 5
})
});
const { data } = await response.json();
const taskId = data.task_id;
// Step 2: Poll for results
const taskId = data.task_id;
const pollResult = async (taskId) => {
const res = await fetch(`https://api.flaq.ai/api/v1/video/${taskId}`, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
return res.json();
};
while (true) {
const pollResultData = await pollResult(taskId);
const status = pollResultData.data.task_status;
if (status === 'succeed') {
console.log(pollResultData.data.task_result.videos[0].url);
break;
}
if (status === 'failed') {
console.error(pollResultData.data.task_status_msg);
break;
}
await new Promise(resolve => setTimeout(resolve, 10000));
}
# Step 1: Submit generation request
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/video/task',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
json={
'model_name': 'kling-v4.0-video-extend',
'prompt': 'Continue the camera movement forward through the valley as the sun rises above the mountains',
'video_url': 'https://example.com/source.mp4',
'resolution': '720p',
'duration': 5
}
)
result = response.json()
task_id = result['data']['task_id']
# Step 2: Poll for results
task_id = response.json()['data']['task_id']
poll_url = f"https://api.flaq.ai/api/v1/video/{task_id}"
while True:
poll_result = requests.get(poll_url, headers={'Authorization': 'Bearer YOUR_API_KEY'}).json()
status = poll_result['data']['task_status']
if status == 'succeed':
print(poll_result['data']['task_result']['videos'][0]['url'])
break
if status == 'failed':
print(poll_result['data']['task_status_msg'])
break
time.sleep(10)
# Step 1: Submit generation request
curl -X POST https://api.flaq.ai/api/v1/video/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model_name": "kling-v4.0-video-extend",
"prompt": "Continue the camera movement forward through the valley as the sun rises above the mountains",
"video_url": "https://example.com/source.mp4",
"resolution": "720p",
"duration": 5
}'
# Step 2: Poll for results
# Replace {task_id} with the task_id returned from the submit response
curl -X GET "https://api.flaq.ai/api/v1/video/{task_id}" \
-H "Authorization: Bearer YOUR_API_KEY"
| Parameters | Price | Original Price | Discount |
|---|
Kuaishou Kling 4.0 Video Extend API helps developers and creative teams continue existing footage through Flaq AI. Build on a source clip with written direction for the next action or scene, using an optional ending image to guide the final composition. This Kling video continuation API supports longer product stories, campaign endings, and social videos, returning the original footage and generated continuation together in the source video's aspect ratio.
Existing Video Continuation: Use a source video as the starting point and describe the next action or scene development in a written prompt.
Optional Target Ending Frame: Supply an ending image when the added segment should move toward a particular final composition.
Added-Segment Duration Control: Set the amount of new footage to generate independently of the source clip's existing length.
Complete Video Output: Receive the original footage and generated continuation together for use in editing workflows, campaign production, and content delivery.
Source Aspect Ratio Preservation: The output follows the source video's aspect ratio, keeping the continuation in the same framing format.
Selectable Output Resolution: Choose 720p or 1080p according to the delivery requirements of the extended video.
Developer-Friendly Integration: Add video continuation to creative tools and automated workflows for extending product clips, campaign footage, and narrative sequences.
Input: A required source video URL and a natural-language prompt describing the intended continuation, with an optional target ending image URL.
Output: The complete video containing both the original clip and the newly generated segment.
Ending Frame: Add an optional image to guide the visual destination of the extension.
Resolution: Select a supported output resolution for every request.
Aspect Ratio: The result follows the source video. A separate output aspect ratio cannot be set for this workflow.
Duration: Explicitly request an added segment from 3 to 30 seconds. The complete video's duration is the source clip length plus the requested extension.
Billing: Usage is based on the extension duration and selected resolution. The extension duration range does not define the source video's upload limits.
Capabilities: Prompt-based video continuation, optional ending-frame guidance, adjustable extension duration, source aspect ratio preservation, and complete video output.
Narrative Video Production: Continue an existing clip with the next action, environmental change, or scene beat for visual stories and creative sequences.
Product & Campaign Endings: Extend product showcases and brand sequences with additional footage that guides the video toward its intended conclusion.
Target-Frame Sequences: Supply a final image when the continuation should approach a planned closing composition.
Social Video Pacing: Add a continuation to a selected clip while retaining its framing format for the intended publishing placement.
Automated Video Workflows: Integrate source uploads, continuation prompts, and optional ending images into creative applications that deliver complete extended videos.
Note Please ensure prompts and media comply with Kuaishou and Flaq AI content safety requirements, and use footage and ending images you have the right to use.
Kling 4.0 vs. Veo 3.1 Video Extension
Veo 3.1 supports extending videos previously generated with Veo.
Kling 4.0 Video Extend accepts a source video URL and an optional ending image, returning the original clip together
with its continuation.
Kling 4.0 vs. Luma Ray2 Video Extension
Luma's Ray2 extension workflow continues completed generated videos
and supports ending-frame guidance. Kling 4.0 Video Extend uses a source video URL, an explicit added duration, and
optional target-frame guidance on Flaq AI.
Kling 4.0 Video Extend vs. Kling 4.0 Video Edit
Video Edit applies changes to footage and uses a total output duration. Video Extend adds the requested duration to
the existing clip and returns the complete extended result.
Kling 4.0 Video Extend vs. Kling 4.0 Image-to-Video
Image-to-Video creates a sequence from an opening image with optional ending and intermediate frames. Video Extend
starts from existing footage when the task is to generate what happens next.
Kling 4.0 Video Extend vs. Kling 4.0 Reference-to-Video
Reference-to-Video uses optional media to guide generation. Video Extend requires the clip to continue, keeps its
aspect ratio, and treats the requested duration as additional footage.
Explore several AI creation tools for quick image and video workflows in your browser, then scale successful ideas with Flaq AI's production-ready model APIs. Flaq AI provides a unified API layer for all models, making it easy to use and scale your workflows.

Create AI images from text prompts

Create AI images from images and text prompts

Create AI videos from text prompts

Animate images into AI videos

Create AI images and videos in one unified workspace

Create consistent videos from reference media

Build visual AI image and video workflows on an infinite canvas