Mogu IO/Models/

Kling 4.0 Video Edit

Video

Model Information

Model IDkwaivgi/kling-v4.0/video-edit
CategoryVideo
Endpoint/api/v1/videos
Input Modalitiestext, image, video, audio
Output Modalitiesvideo, audio

Create Task

POST https://mogu.io/api/v1/videos

Authentication: Authorization: Bearer <api-key>

Request Parameters

ParameterTypeRequiredDefaultDescription
modelstring✓Model ID: kwaivgi/kling-v4.0/video-edit
videourl✓Source video URL to edit
audiosarray<url>Up to 3 reference audio URLs; each 5-30 seconds
imagesarray<url>Up to 10 reference image URLs
promptstring✓Describe the scene, action, camera movement or requested edit
timeoutnumber (60..3600)1800Maximum wait time in seconds
durationenum: | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30""Leave blank to follow the source video duration
resolutionenum: 720p | 1080p"720p"Output resolution
aspect_ratioenum: | 16:9 | 9:16 | 1:1 | 21:9""Leave blank to follow the source video
keep_original_soundbooleanfalseKeep the original source audio

Multimodal Input

This model supports image, video, audio 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/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/video-edit",
  "video": "https://example.com/image.jpg",
  "prompt": "Your prompt here",
  "timeout": 1800,
  "duration": "",
  "resolution": "720p",
  "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

HTTPTypeDescription
400invalid_request_errorInvalid parameters
400content_moderationContent blocked by safety system
400input_too_largeInput exceeds model limit
401auth_errorInvalid API key
402insufficient_creditsNot enough credits
429rate_limit_errorToo many requests
502provider_errorUpstream error, retry later
504timeout_errorRequest timed out
Try in PlaygroundAPI ReferenceAll Models