Nodes/ComfyUI-JM-KLing-API/KLingAI Text to Video
ComfyUI Node

KLingAI Text to Video

Text to video on Kling's servers, from inside ComfyUI

By juemingai·Created about a year ago·Updated 11 months ago· 3
KLingAI Text to Video
    • task_id
    • task_status
    • created_at
    • updated_at
    • seed
    api_token
    prompt
    model_namekling-v1
    negative_prompt
    cfg_scale0.5
    modestd
    aspect_ratio16:9
    duration5
    seed-1

    You want Kling-quality video - the closed model people rate roughly on par with Wan 2.2 at its best - but you don't want to babysit a 30 GB video checkpoint on a GPU you may not even have. This node is the answer to that specific trade-off. It fires a text-to-video job at the Kling AI API and hands back a task ID. Everything heavy runs on Kling's servers, so your rig just needs to run ComfyUI.

    Before you wire anything, get the mental model straight, because it's the one thing that confuses every first-timer with this pack: Kling generation is asynchronous. The node does not return a video. It returns a task ID plus a status, and you're expected to feed that into the KLingAI Query Status node, which polls until the job finishes and hands you the result URL. Then a downloader node pulls it to disk. Three-hop pipeline, always.

    How it works

    The node POSTs your prompt to https://api.klingai.com/v1/videos/text2video with Authorization: Bearer <your jwt>, where the JWT comes from the KLingAI API Key node. On success the API returns task_id, task_status, created_at, updated_at - and those four strings plus the local seed are exactly what the node outputs. The request itself is a couple of seconds; the actual generation takes minutes on Kling's side.

    Inputs that matter

    • api_token (required) - wire in the api_token output from the API Key node.
    • prompt (required) - up to 2500 characters. This is your main lever; Kling reads long, specific prompts well.
    • model_name - this node only offers kling-v1 and kling-v1-6. The fancier kling-v2-* models live on the image2video node.
    • negative_prompt - up to 2500 chars, used the way you'd expect.
    • mode - std or pro. Pro is better quality and costs more credits.
    • duration - 5 or 10 seconds.
    • aspect_ratio - 16:9, 9:16, or 1:1.
    • cfg_scale - 0 to 1, default 0.5.
    • seed - here's the trap: the seed is local only. The code literally prints "Using local seed (not sent to API)." It controls whether ComfyUI re-runs the node (set a fixed value to stop re-firing) but does not give you reproducible generations on Kling's side.

    The output

    task_id, task_status, created_at, updated_at (all STRING) and seed (INT). The one you care about is task_id → into Query Status. task_status at creation time is basically always submitted or similar - don't read anything into it.

    Getting it running

    Install the pack first (ComfyUI Manager → search "ComfyUI-JM-KLing-API", or git clone into custom_nodes + pip install -r requirements.txt). Then: API Key node → this node → Query Status → Video Downloader, run the queue, wait, collect.

    Where people get burned

    • Prompt too long. Over 2500 characters and the node doesn't raise - it returns "Error: ..." as your task_id and "failed" as status. Check the console.
    • Missing token. Same pattern: "API token is required" comes back as a string, not a crash.
    • Cost shock. Every successful run bills your Kling account, and this pack re-executes when inputs change. The KB has people quoting roughly $1.50 for a 5-second 1080p clip on Kling's pricier tier. A fixed seed stops the node from re-firing on workflow edits - worth knowing before you queue something overnight.
    • Expecting a video out. Not here. If your graph ends at this node you get a task ID and nothing to watch. It's always Task → Query → Download.
    CategoryJM-KLingAI-API/text-2-video

    Inputs (9)

    NameTypeDefaultDescription
    api_tokenSTRING
    promptSTRING
    model_nameoptCOMBOkling-v12 options: kling-v1, kling-v1-6
    negative_promptoptSTRING
    cfg_scaleoptFLOAT0.50–1
    modeoptCOMBOstd2 options: std, pro
    aspect_ratiooptCOMBO16:93 options: 16:9, 9:16, 1:1
    durationoptCOMBO52 options: 5, 10
    seedoptINT-1-1–18446744073709550000

    Outputs (5)

    NameTypeDescription
    task_idSTRING
    task_statusSTRING
    created_atSTRING
    updated_atSTRING
    seedINT