Model Information
| Model ID | kwaivgi/kling-v4.0-flash/video-edit |
| Category | Video |
| Endpoint | /api/v1/videos |
| Input Modalities | text, image, video |
| Output Modalities | video, audio |
Create Task
POST https://mogu.io/api/v1/videosAuthentication: Authorization: Bearer <api-key>
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | ✓ | Model ID: kwaivgi/kling-v4.0-flash/video-edit | |
| video | url | ✓ | Source video URL to edit | |
| images | array<url> | Up to 10 reference image URLs | ||
| prompt | string | ✓ | Describe the scene, action, camera movement or requested edit | |
| timeout | number (60..3600) | 1800 | Maximum wait time in seconds | |
| aspect_ratio | enum: | 16:9 | 9:16 | 1:1 | 21:9 | "" | Leave blank to follow the source video | |
| keep_original_sound | boolean | false | Keep the original source audio |
Multimodal Input
This model supports image, video input. Use the content array format:
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/photo.jpg"
}
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/video.mp4"
}
}
]
}Multimodal Output
This model can output video, audio. Add modalities to your request:
{
"model": "kwaivgi/kling-v4.0-flash/video-edit",
"messages": [
{
"role": "user",
"content": "Draw a cat"
}
],
"modalities": [
"video",
"audio"
]
}Image output does not support streaming. Set stream: false.
Code Examples
# Step 1: Create task
curl -X POST https://mogu.io/api/v1/videos \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "kwaivgi/kling-v4.0-flash/video-edit",
"video": "https://example.com/image.jpg",
"prompt": "Your prompt here",
"timeout": 1800,
"aspect_ratio": "",
"keep_original_sound": false
}'
# Step 2: Poll for result
curl https://mogu.io/api/v1/videos/{task-id} \
-H "Authorization: Bearer <api-key>"Response
Create Response (202)
{
"id": "task-uuid",
"status": "pending",
"polling_url": "/api/v1/videos/task-uuid"
}Poll: GET https://mogu.io/api/v1/videos/:id — Completed
{
"id": "task-uuid",
"status": "completed",
"output": {
"urls": [
"https://cdn.example.com/video.mp4"
]
},
"credit": 4000
}Poll every 3-5 seconds. Status values: pending → in_progress → completed | failed
Error Codes
| HTTP | Type | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid parameters |
| 400 | content_moderation | Content blocked by safety system |
| 400 | input_too_large | Input exceeds model limit |
| 401 | auth_error | Invalid API key |
| 402 | insufficient_credits | Not enough credits |
| 429 | rate_limit_error | Too many requests |
| 502 | provider_error | Upstream error, retry later |
| 504 | timeout_error | Request timed out |