Kling 4.0

kling-4.0
VideoKlingKling 4.0kling-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

ModeParametersNotes
Text-to-videopromptSet the frame with aspect_ratio
Image-to-video (first frame)image_url, optional promptThe output follows the aspect ratio of the image
First and last frameimage_url + last_frame_url, optional promptTransitions 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.

EndpointPurpose
POST /v1/videosCreate 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.

cURLbash
# 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.

cURLbash
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.

cURLbash
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.

cURLbash
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.

cURLbash
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.

ParameterTypeRequiredDefaultValuesDescription
promptstringNo——The prompt: describes the content, motion and camera work of the video. Required for text-to-video.
image_urlstring (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_urlstring (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.
resolutionstringNo720P720P / 1080P / 2K / 4KOutput resolution. Defaults to 720P.
durationintegerNo53–30Output duration in seconds, an integer from 3 to 30. Defaults to 5.
aspect_ratiostringNo—16:9 / 9:16 / 1:1 / 21:9Output 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).

statusMeaning
queuedWaiting in the queue.
in_progressBeing generated.
completedFinished; download the video from video_url.
failedFailed; see error for the reason. Not charged.

Query response of a completed task:

JSONjson
{
  "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:

JSONjson
{
  "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.

ResolutionUSD / secondCNY / 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_url is 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_url must be sent together with image_url; with a first frame aspect_ratio has 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 in error.message (for example InvalidParameterValue: 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 as resolution or aspect_ratio has 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 as failed, also without a charge.
  • A video takes several minutes; poll the task every 10–15 seconds, not faster.