
Text to Image
Create AI images from text prompts
Edit videos with Kling 4.0 API by Kuaishou using text prompts and optional reference images, with original audio control for creative workflows 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-edit',
prompt: 'Replace the background with warm sunset colors while preserving the subject and camera movement',
video_url: 'https://example.com/source.mp4',
resolution: '720p',
duration: 8,
aspect_ratio: '16:9'
})
});
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-edit',
'prompt': 'Replace the background with warm sunset colors while preserving the subject and camera movement',
'video_url': 'https://example.com/source.mp4',
'resolution': '720p',
'duration': 8,
'aspect_ratio': '16:9'
}
)
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-edit",
"prompt": "Replace the background with warm sunset colors while preserving the subject and camera movement",
"video_url": "https://example.com/source.mp4",
"resolution": "720p",
"duration": 8,
"aspect_ratio": "16:9"
}'
# 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 Edit API helps developers and creative teams transform existing footage with natural-language instructions on Flaq AI. Combine a source video with optional reference images to guide edits for brand campaigns, product videos, and social content. Flexible output settings and original-sound retention support creative revisions and automated editing workflows through this Kling video editing API.
Source-Based Video Editing: Start with an existing video and describe the desired changes in a natural-language prompt.
Optional Image References: Supply multiple reference images alongside the source video to provide visual guidance for the requested edit.
Original Sound Retention: Choose whether the edited result should preserve the original audio from the source footage.
Selectable Output Resolution: Set 720p or 1080p output to match the requirements of the intended delivery workflow.
Flexible Video Duration: Set the edited video's total length to suit campaign pacing, product stories, and short-form publishing needs.
Multiple Aspect Ratios: Choose a supported output format for horizontal, vertical, square, and widescreen publishing contexts.
Developer-Friendly Integration: Add prompt-based video editing to creative tools and production pipelines that manage footage and reference assets.
Input: A required source video URL and a text prompt explaining the intended edit, with optional reference image URLs.
Output: An edited video based on the supplied footage, editing instructions, and any image guidance.
Visual Direction: Describe the requested changes clearly and use reference images when they help communicate the desired result.
Sound Control: Explicitly enable original-sound retention when the source video's audio should be kept.
Resolution and Aspect Ratios: Select a supported resolution for every request and choose the appropriate output aspect ratio.
Duration: Explicitly set the total edited video length from 3 to 30 seconds. This includes the source video's duration and is not an amount of time to append.
Billing: Usage depends on input video billing duration, output video duration, and resolution. Optional image references and original-sound retention add no separate charge.
Capabilities: Prompt-based video editing, optional image guidance, original-sound retention, and flexible output duration, resolution, and aspect ratio.
Marketing & Brand Campaigns: Refresh existing campaign footage with prompt-based edits and reference imagery for promotional videos and brand content.
Reference-Guided Revisions: Pair footage with reference imagery to communicate the intended visual changes to a product, editorial, or brand sequence.
E-commerce Product Videos: Revise product clips for online stores, launch campaigns, and promotional placements with image guidance and output settings suited to the project.
Social Video Adaptation: Edit existing footage for horizontal, vertical, and square social placements while choosing whether to retain the original audio.
Application Editing Workflows: Add source-based AI video editing to a creative tool or production pipeline that already manages footage and image references.
Note Please ensure prompts and media comply with Kuaishou and Flaq AI content safety requirements, and use footage and images you have the right to use. The output duration range does not define source-video upload limits; use Video Extend to add time to an existing clip.
Kling 4.0 vs. Runway Aleph 2.0
Runway Aleph 2.0 edits videos with text prompts and
optional timed keyframe images. Kling 4.0 Video Edit combines source footage with optional reference images, output
settings, and an original-sound retention option.
Kling 4.0 vs. Luma Modify Video
Luma Modify Video supports prompt-based modification of
source clips with optional first-frame guidance. Kling 4.0 Video Edit offers a Flaq AI workflow with multiple image
references and explicit total-duration control.
Kling 4.0 Video Edit vs. Kling 4.0 Reference-to-Video
Reference-to-Video accepts optional media to guide a new generation. Video Edit requires the specific footage that
should be edited and optionally uses image references to guide the requested changes.
Kling 4.0 Video Edit vs. Kling 4.0 Video Extend
Video Extend adds a continuation to a source clip and returns the complete video. Video Edit processes existing
footage, with the requested duration describing the edited output's total length.
Kling 4.0 Video Edit vs. Kling 4.0 Image-to-Video
Image-to-Video generates motion from a starting image. Video Edit begins with footage, making it the relevant workflow
when the project already has a video that needs changes.
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