Kling 4.0
kling-4.0 is the new-generation video model Kling AI (Kuaishou) launched in October 2026, aimed at professional-grade video creation: a single generation produces a long take of up to 30 seconds for continuous storytelling, with better motion continuity in fast action and complex camera work. Picture and sound are created together; it supports text-to-video, image-to-video from a first frame, and first-and-last-frame generation. Native output is 720P / 1080P, with 2K / 4K upscaled output available. For multiple reference images, reference videos, reference audio or video editing, use Kling 4.0 Omni.
Authentication
- Base URL
https://api.dreamto.ai- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- Model name (model)
kling-4.0
- Long clips: 3–30 seconds in a single generation, no stitching.
- Native synchronised audio: every video comes with sound generated together with the picture.
- Resolution: native 720P / 1080P, upscaled 2K / 4K.
- Aspect ratios: 16:9, 9:16, 1:1, 21:9.
- Modes: text-to-video, image-to-video (first frame), first-and-last-frame.
Capabilities
| Mode | Parameters | Notes |
|---|---|---|
| Text-to-video | prompt | Set the frame with aspect_ratio |
| Image-to-video (first frame) | image_url, optional prompt | The output follows the aspect ratio of the image |
| First and last frame | image_url + last_frame_url, optional prompt | Transitions from the first frame to the last frame |
Endpoints
The API is asynchronous: create a task, poll it, and download the video from video_url when it completes. Set model to kling-4.0 and put every generation parameter inside input.
| Endpoint | Purpose |
|---|---|
POST /v1/videos | Create a video task |
GET /v1/videos/{task_id} | Query a video task |
Quick start
Create a task to get a task_id, poll every 10–15 seconds, and download video_url once status is completed. $DREAMTO_API_KEY is your API Key.
# 1. Create the task
curl -X POST "https://api.dreamto.ai/v1/videos" \
-H "Authorization: Bearer $DREAMTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"input": {
"prompt": "A red panda walks slowly through fresh snow and looks back at the camera, cinematic, shallow depth of field",
"resolution": "1080P",
"duration": 5,
"aspect_ratio": "16:9"
}
}'
# 2. Query the task
curl "https://api.dreamto.ai/v1/videos/job_02b88886c4fda5be35baff61" \
-H "Authorization: Bearer $DREAMTO_API_KEY"Generation modes
Text-to-video
A prompt only; aspect_ratio sets the frame.
curl -X POST "https://api.dreamto.ai/v1/videos" \
-H "Authorization: Bearer $DREAMTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"input": {
"prompt": "A red panda walks slowly through fresh snow and looks back at the camera, cinematic, shallow depth of field",
"resolution": "1080P",
"duration": 5,
"aspect_ratio": "16:9"
}
}'Image-to-video (first frame)
image_url is the first frame of the video; the output follows the image.
curl -X POST "https://api.dreamto.ai/v1/videos" \
-H "Authorization: Bearer $DREAMTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"input": {
"prompt": "The girl turns her head and smiles at the fox as a breeze moves her hair",
"image_url": "https://your-cdn.example.com/first-frame.png",
"resolution": "720P",
"duration": 5
}
}'First and last frame
Send image_url and last_frame_url together; the video transitions from the first frame to the last.
curl -X POST "https://api.dreamto.ai/v1/videos" \
-H "Authorization: Bearer $DREAMTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"input": {
"prompt": "The camera pushes in slowly as day turns to night and the city lights come on",
"image_url": "https://your-cdn.example.com/first-frame.png",
"last_frame_url": "https://your-cdn.example.com/last-frame.png",
"resolution": "1080P",
"duration": 8
}
}'4K portrait, long clip
A 15-second 9:16 portrait video in one generation, upscaled to 4K.
curl -X POST "https://api.dreamto.ai/v1/videos" \
-H "Authorization: Bearer $DREAMTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"input": {
"prompt": "A neon street after rain: a pedestrian with an umbrella walks towards the camera, which follows as the lights reflect on the ground",
"resolution": "4K",
"duration": 15,
"aspect_ratio": "9:16"
}
}'Parameters
All parameters below go inside input in the request body.
| Parameter | Type | Required | Default | Values | Description |
|---|---|---|---|---|---|
prompt | string | No | — | — | The prompt: describes the content, motion and camera work of the video. Required for text-to-video. |
image_url | string (image URL) | No | — | — | Public URL of the first-frame image; turns the request into image-to-video. jpeg / jpg / png, up to 10MB. |
last_frame_url | string (image URL) | No | — | — | Public URL of the last-frame image. Must be used together with image_url; the video transitions from the first frame to the last frame. jpeg / jpg / png, up to 10MB. |
resolution | string | No | 720P | 720P / 1080P / 2K / 4K | Output resolution. Defaults to 720P. |
duration | integer | No | 5 | 3–30 | Output duration in seconds, an integer from 3 to 30. Defaults to 5. |
aspect_ratio | string | No | — | 16:9 / 9:16 / 1:1 / 21:9 | Output aspect ratio, for text-to-video. With a first-frame image the output follows the image. |
See Create a video task for the full request and response definitions.
Response and task status
Creating a task returns task_id, status, model, created_at and request_id. Querying it additionally returns completed_at (once finished), video_url (on success) and error (on failure).
status | Meaning |
|---|---|
queued | Waiting in the queue. |
in_progress | Being generated. |
completed | Finished; download the video from video_url. |
failed | Failed; see error for the reason. Not charged. |
Query response of a completed task:
{
"task_id": "job_02b88886c4fda5be35baff61",
"status": "completed",
"model": "kling-4.0",
"created_at": 1794846663,
"completed_at": 1794847019,
"request_id": "req_6a9a539502118ba1c33f1bfc",
"video_url": "https://cdn.example.com/videos/02b88886c4fda5be35baff61.mp4"
}Query response of a failed task:
{
"task_id": "job_02b88886c4fda5be35baff61",
"status": "failed",
"model": "kling-4.0",
"created_at": 1794846663,
"completed_at": 1794847019,
"request_id": "req_6a9a539502118ba1c33f1bfc",
"error": {
"type": "api_error",
"message": "InvalidParameterValue: Please input the ImageURL that can be retrieved from the external network."
}
}Pricing
Billed per second of output video at the price of the chosen resolution.
| Resolution | USD / second | CNY / second |
|---|---|---|
| 720P | $0.157 | ¥1.0 |
| 1080P | $0.2355 | ¥1.5 |
| 2K | $0.2826 | ¥1.8 |
| 4K | $0.471 | ¥3.0 |
These are list prices; the model price shown in the console is authoritative. Failed tasks and invalid requests are not charged.
Limits and notes
video_urlis valid for 7 days after the task completes; download the video and keep it in your own storage.- Input media must be publicly downloadable URLs; media hosted outside mainland China works as well.
- Every generated video includes audio; this model has no parameter to turn it off.
last_frame_urlmust be sent together withimage_url; with a first frameaspect_ratiohas no effect and the output follows the image.- 2K and 4K are upscaled output and are billed at the price of that resolution.
- A failed task returns
status: "failed"with the reason inerror.message(for exampleInvalidParameterValue: Please input the ImageURL that can be retrieved from the external network.) and is not charged. - When a task is created, the estimated price of the request (resolution price × duration) is reserved from the balance and settled to the actual usage when the task completes. With an insufficient balance the create request returns HTTP 402 (
insufficient_balance) and no task is created. - An invalid request returns HTTP 400; no task is created and nothing is charged. When the duration or a media count is out of range, the message names the field and the allowed range (in the form
input.duration must be a number between <min> and <max>). When an enum parameter such asresolutionoraspect_ratiohas a value outside its allowed list, the message is generic and does not name the field, so check the request against the parameter table. Media formats and content are checked by the model: a violation ends the task asfailed, also without a charge. - A video takes several minutes; poll the task every 10–15 seconds, not faster.