Text-to-video
Submit text-to-video tasks using the Kling 4.0 native format.
Prompts can describe both desired and unwanted content. Use settings for duration, resolution, and aspect ratio, and options for callbacks and watermarks.
/kling/text-to-video/kling-4.0Generate Kling 4.0 video from a prompt. The path specifies the model; no model field is needed in the body.
Authorization
bearerAuth Use a platform API Key: Authorization: Bearer your-api-key.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
Common errors and troubleshooting
| Response or error | What to check |
|---|---|
HTTP 401, Invalid token | Check Bearer authentication and whether the API Key belongs to the requested site |
HTTP 400, prompt cannot be empty | Provide a nonempty text prompt |
HTTP 400, prompt value type is invalid | prompt must be a string, not an array or object |
HTTP 400, invalid_request | Check types such as settings.duration; duration must be an integer |
| HTTP 400, resolution or aspect-ratio validation error | Use the documented enum values for settings.resolution and settings.aspect_ratio |
HTTP 400, invalid JSON request body | Check JSON syntax and remove comments from the request body |
Generic validation errors may list values beyond those available for this model. Use integer durations of 3–30 seconds and 720p or 1080p as documented here; do not infer other durations or resolutions from error messages alone.
Creation errors may return code/message/data or an error object rather than the success response structure. Find the cause of fail_to_fetch_task in message, which may be a JSON string containing code/message/request_id. Keep the request ID for troubleshooting, but do not share your API Key.