| name | klingai-text-to-video |
| description | Generate videos from text prompts with Kling AI. Use when creating videos from descriptions,
learning prompt techniques, or building T2V pipelines. Trigger with phrases like 'kling ai text to video',
'klingai prompt', 'generate video from text', 'text2video kling'.
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 1.18.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","kling-ai","text-to-video","video-generation"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Kling AI Text-to-Video
Overview
Generate videos from text prompts using the /v1/videos/text2video endpoint. Supports models v1 through v2.6, standard/professional modes, camera control, negative prompts, and native audio (v2.6+).
Endpoint: POST https://api.klingai.com/v1/videos/text2video
Request Parameters
| Parameter | Type | Required | Description |
|---|
model_name | string | Yes | Model version (see model catalog) |
prompt | string | Yes | Video description, max 2500 chars |
negative_prompt | string | No | What to exclude from generation |
duration | string | Yes | "5" or "10" seconds |
aspect_ratio | string | No | "16:9" (default), "9:16", "1:1", etc. |
mode | string | No | "standard" (default) or "professional" |
cfg_scale | float | No | Prompt adherence (0.0-1.0, default 0.5) |
camera_control | object | No | Camera movement config |
callback_url | string | No | Webhook URL for completion notification |
Complete Example — Python
import jwt, time, os, requests
BASE = "https://api.klingai.com/v1"
def get_headers():
ak, sk = os.environ["KLING_ACCESS_KEY"], os.environ["KLING_SECRET_KEY"]
token = jwt.encode(
{"iss": ak, : (time.time()) + , : (time.time()) - },
sk, algorithm=, headers={: , : }
)
{: , : }
response = requests.post(, headers=get_headers(), json={
: ,
:
,
: ,
: ,
: ,
: ,
: ,
})
task = response.json()
task_id = task[][]
:
time.sleep()
result = requests.get(
, headers=get_headers()
).json()
status = result[][]
status == :
video = result[][][][]
()
()
status == :
RuntimeError(result[][])