Skip to main content
POST
Kling 4.0

Headers

Authorization
string

Body

application/json

Kling 4.0 text-to-video and image-to-video (first frame, optional middle keyframes, optional last frame).

Pricing — per second of generated video:

  • 720p — 10.205 tokens ($0.2041)
  • 1080p — 15.275 tokens ($0.3055)
model
enum<string>
required

Model name. Must be kling-4-0 on this page.

Available options:
kling-4-0
prompt
string
required

Text prompt describing the scene, motion and camera. Required, up to 2500 characters.

Maximum string length: 2500
image_url
string<uri>

First-frame image URL. If provided, runs image-to-video (the aspect ratio follows this image); otherwise text-to-video.

JPG or PNG, up to 10MB, width and height at least 300px, aspect ratio between 1:2.5 and 2.5:1. Smaller images are upscaled automatically.

keyframes
string<uri>[]

Optional middle-frame image URLs (1-8), in playback order. The model spaces them evenly between the first and last frame. Requires image_url.

First, middle and last frames together allow at most 10 images and at most duration + 1 (a 3-second video takes up to 4). Same image requirements as image_url.

Maximum array length: 8
image_end_url
string<uri>

Optional last-frame image URL. Requires image_url. Same image requirements as image_url.

duration
integer
default:5

Video duration in seconds, any integer from 3 to 30.

Required range: 3 <= x <= 30
resolution
enum<string>
default:720p

Output resolution. quality is accepted as a compatible alias.

Available options:
720p,
1080p
ratio
enum<string>
default:16:9

Aspect ratio. Text-to-video only; ignored when image_url is provided.

Available options:
16:9,
9:16,
1:1,
21:9
custom_callback_url
string<uri>

Optional. A publicly accessible HTTPS URL. When the task status changes (processing / success / failed), GoEnhance sends a POST request to this URL. The request body is identical to the response of GET /api/v1/jobs/detail. If your server does not respond with HTTP 200, the notification is retried up to 3 times, with a 3-second timeout per attempt.

Example:

"https://your-server.com/goenhance/callback"

Response

code
integer
required
msg
string
required
data
object
required