Overview
Kling 4.0 Flash (can 4.0 Flash)Kling 4.0 height:Capability,,.supported Text-to-Video, first frame video generation, and Reference image / Reference video / Video Editing reference.
1080p, last frame, in, subject orKling 4.0; localized example textKling 3.0.
endpointPath, Request / field Kling (endpoint).complete,Base URL and API Key can, localized example text.
| localized example text | Description |
|---|---|
| Resolution | only 720p |
| Duration | 3-20 seconds, defaultModel |
| localized example text | 16:9 (default)/ 9:16 / 1:1 / 4:3 / 3:4 / 21:9, reference supportedadaptive |
| localized example text | reference supportednative (Model)/original (Reference video original audio ) |
| localized example text | output Duration; with Reference video when input and output Duration and,「Billing」 |
Base URL: https://mm-internal-cn.leonecloud.com/kling
Authentication
with endpoint in Request in API Key:```
Authorization: Bearer {YOUR_API_KEY}
> API Key can, Not required AccessKey / SecretKey JWT.
---
## and| localized example text| localized example text|
|----|--------|
| asset| http(s) URL, supported base64|
| watermark | watermark:`options.watermark_info` can, with`watermark_url` |
| query results | return`billing` field, localized example text|
| localized example text| Callback Request,「Callback Notification」 |
---
## Quick Start
**Text-to-Video**
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/kling/text-to-video/kling-4.0-flash" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "in,,,",
"settings": { "resolution": "720p", "duration": 5, "aspect_ratio": "16:9" }
}'
**first frame video generation**
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/kling/image-to-video/kling-4.0-flash" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "type": "prompt", "text": "," },
{ "type": "first_frame", "url": "https://example.com/start.jpg" }
],
"settings": { "resolution": "720p", "duration": 5 }
}'
**Reference image-to-Video**
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/kling/omni-video/kling-4.0-flash" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "type": "prompt", "text": "@image_1, in" },
{ "type": "refer_image", "url": "https://example.com/girl.jpg" }
],
"settings": { "resolution": "720p", "duration": 5, "aspect_ratio": "16:9" }
}'
**Video Editing (keep original audio )**
```bashcurl -X POST "https://mm-internal-cn.leonecloud.com/kling/omni-video/kling-4.0-flash" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "type": "prompt", "text": "after, and" },
{ "type": "base_video", "url": "https://example.com/source.mp4" }
],
"settings": { "resolution": "720p", "audio": "original" }
}'
**Query Task**
```bashcurl -X GET "https://mm-internal-cn.leonecloud.com/kling/tasks?task_ids=task_20261119185417_tivjbqzg" \
-H "Authorization: Bearer your_api_key_here"
---
## Endpoints
| Method | Path (Base URL)| localized example text|
|--------|------|------|
| POST | `/text-to-video/kling-4.0-flash` | Text-to-Video |
| POST | `/image-to-video/kling-4.0-flash` | first frame Video|
| POST | `/omni-video/kling-4.0-flash` | reference (Reference image / Reference video / Video Editing)|
| GET | `/tasks` | Query Task (Task ID or Task ID, supported )|
---
### 1. Text-to-Video
**POST** `/text-to-video/kling-4.0-flash`
#### Request Parameters
| Parameter | Type | Required | Description |
|------|------|------|------|
| prompt | string | Yes | Prompt, exceeds 2500 characters|
| settings | object | No | output,|
| options | object | No |:Callback URL, Task ID|
---
### 2. first frame video generation**POST** `/image-to-video/kling-4.0-flash`
#### Request Parameters
| Parameter | Type | Required | Description |
|------|------|------|------|
| contents | array | Yes | asset,|
| settings | object | No | output|
| options | object | No | localized example text|
#### contents
| type | field | Description |
|------|------|------|
| `prompt` | `text` | Prompt, exceeds 2500 characters|
| `first_frame` | `url` | first frame image,**Required** |
first frame,`aspect_ratio` localized example text.last frame or in[Kling 4.0](/docs/kling-4-0).
---
### 3. reference**POST** `/omni-video/kling-4.0-flash`
Reference image, Reference video and Video Editing.`prompt` Required, localized example text`@image_1` / `@video_1` asset, Type asset in`contents` localized example text.
#### Request Parameters
| Parameter | Type | Required | Description |
|------|------|------|------|
| contents | array | Yes | asset,|
| settings | object | No | output|
| options | object | No | localized example text|
#### contents
| type | field | Description |
|------|------|------|
| `prompt` | `text` | Prompt, **Required**, exceeds 2500 characters|
| `first_frame` | `url` | first frame image|
| `refer_image` | `url` | Reference image,, or|
| `feature_video` | `url` | Reference video, in the or|
| `base_video` | `url` | video, up to 1.localized example text`first_frame` |
**localized example text**
| localized example text| localized example text|
|----|------|
| image (first frame+ Reference image)| 10 |
| video (Reference video + video)| 5, in`base_video` up to 1 |
| asset (image+ video, `prompt` )| 15 |
**asset Requirements**
| Type | Requirements |
|------|------|
| Image | jpg / jpeg / png, exceeds 50MB, width and height at least 300px, Aspect ratio 1:2.5 ~ 2.5:1 |
| Video | mp4 / mov, exceeds 200MB, Duration exceeds 20 seconds|
---
### settings
| Parameter | Type | Required | default | Description |
|------|------|------|------|------|
| resolution | string | No | `720p` | **supported`720p`**, will|
| duration | int | No | Modellocalized example text| 3-20, seconds.If omittedwhen Model|
| aspect_ratio | string | No | `16:9` | `16:9` / `9:16` / `1:1` / `4:3` / `3:4` / `21:9`, reference supported`adaptive`.with first frame or reference asset when asset|
| audio | string | No | `native` | onlyreference:`native` Model/`original` Reference video original audio|
> first field will, will.
### options
| Parameter | Type | Required | Description |
|------|------|------|------|
| callback_url | string | No | taskcomplete after Callback URL, http(s), exceeds 512 characters|
| external_task_id | string | No | Task ID,, exceeds 128 characters.can use query|
### Response Example
```json{
"code": 0,
"message": "SUCCEED",
"request_id": "trace_20261119185416_7nhd8sa77zoo",
"data": {
"id": "task_20261119185417_tivjbqzg",
"status": "submitted",
"create_time": 1795085657121,
"update_time": 1795085657121,
"external_id": "my-order-001"
}
}
---
### 4. Query Task
**GET** `/tasks`
#### Request Parameters (URL query)
| Parameter | Required | Description |
|------|------|------|
| task_ids | localized example text| Create Taskreturn`data.id`, localized example text`,` localized example text|
| external_task_ids | localized example text| create when`external_task_id`, localized example text`,` localized example text|
Parameter, up to 50 task.task.
#### Response Parameters
| Parameter | Type | Description |
|------|------|------|
| data[].id | string | Task ID |
| data[].status | string | `submitted` /`processing` in /`succeeded` Success / `failed` Failure |
| data[].message | string | Failure(onlyFailure when )|
| data[].create_time | int | Created Time, Unix seconds|
| data[].update_time | int | Updated Time, Unix seconds|
| data[].external_id | string | Task ID ( with )|
| data[].outputs[] | array | generated result (onlySuccesswhen )|
| data[].outputs[].type | string | localized example text`video` |
| data[].outputs[].url | string | videolocalized example text|
| data[].outputs[].duration | string | videoDuration, seconds|
#### Response Example
```json{
"code": 0,
"message": "SUCCEED",
"request_id": "trace_20261119185903_0vogwknig0un",
"data": [
{
"id": "task_20261119185417_tivjbqzg",
"status": "succeeded",
"create_time": 1795085657000,
"update_time": 1795085829000,
"external_id": "my-order-001",
"outputs": [
{ "type": "video", "url": "https://fc-gw-sh.oss-accelerate.aliyuncs.com/downloads/20261119/xxx.mp4", "duration": "5" }
]
}
]
}
---
## Billing
- **no Reference video**:output Duration.
- **with Reference video** (`feature_video` or`base_video`):input and output Duration and.input Duration exceeds output Duration when「input+ output」, output Duration.
- If omitted `duration` when ModelDuration., after output Duration and.
- taskFailurelocalized example text.
---
## Callback Notification
Create Taskwhen`options.callback_url`, taskSuccessor Failure after will POST Request.
**Headers**Content-Type: application/json
X-Funcloud-Event: task.completed
X-Funcloud-Timestamp: 2026-11-19T18:57:09+08:00
X-Funcloud-Signature: {localized example text}
**Body**:task, field and query endpoint`data[]`, with`code` / `data` localized example text.
```json{
"id": "task_20261119185417_tivjbqzg",
"status": "succeeded",
"create_time": 1795085657000,
"update_time": 1795085829000,
"external_id": "my-order-001",
"outputs": [
{ "type": "video", "url": "https://fc-gw-sh.oss-accelerate.aliyuncs.com/downloads/20261119/xxx.mp4", "duration": "5" }
]
}
return HTTP 2xx as; not when in 5 seconds, 10 seconds after, 3.
---
## Error Codes
ErrorHTTP Status Code, as`{ "code": <localized example text>, "message": "...", "request_id": "..." }`:
| HTTP Status Code | code | Description |
|------|------|------|
| 400 | 1201 | Parameter,`message` |
| 401 | 1000 | API Key invalid or missing |
| 403 | 1103 | no ( IP in )|
| 404 | 1203 | Task not found, or Model not|
| 429 | 1101 | Insufficient balance |
| 429 | 1302 | Requestlocalized example text|
| 500 | 5000 | Internal server error |
| 503 | 5001 |, after|
taskFailure (query results `status=failed`)Failure, will.
---
## Best Practices
- **Pollinglocalized example text**:First 30 seconds3 seconds, after 10 seconds.recommended
-**when**:720p 5 secondsvideoUsually 1 ~ 3 minutes
- **with 720p**:1080p[Kling 4.0](/docs/kling-4-0), localized example text`1080p` will, will
-**asset**:`@image_1` Type asset in`contents`, and no
-**Video Editing**:`base_video` and`first_frame`, when will
-**etc.**:localized example text`external_task_id`, ID will (400/1201), when after can query task booking