Skip to main content
Kling 4.0 uses capability-specific creation paths. The model name is part of each path; do not send model or model_name in the request body. Configure output with settings and general options with options.

Create task

POST /kling/v2/text-to-video/kling-4.0
cURL

Request headers

string
required
Bearer authentication. Use Bearer YOUR_ANYFAST_API_KEY.
string
default:"application/json"
required
Request body format.

Request body

string
required
Video description. You can include both desired and unwanted content. Prompt limits depend on character type; see the prompt length section.
object
Output resolution, duration, and aspect ratio.
string
720p or 1080p. Explicitly setting a value is recommended.
integer
Integer from 3 to 30 seconds. Explicitly setting a value is recommended. If omitted, the prompt duration is used when clear; otherwise the default is 10 seconds.
string
21:9, 16:9, 9:16, or 1:1. adaptive is also supported by the shared output settings.
object
General task options.
boolean
default:false
Whether to additionally generate a watermarked version.
string
Caller-defined task identifier. Keep it unique within the current user scope. It does not replace the system task ID or guarantee duplicate-charge prevention.
string
Task-status callback URL defined by the official protocol. Confirm support on the current channel before use.

Create response

200
integer
Business status code; the success example is 0.
string
API message.
string
Request tracing identifier, when returned.
string
System task ID. Save it for querying.
string
Current task status.
integer
Creation time as a Unix timestamp in milliseconds.
integer
Update time as a Unix timestamp in milliseconds.
string
Caller-defined task ID; may be empty if unset.
Creation is asynchronous. A successful create response means the task was accepted; query the returned data.id to retrieve its status and result.