ComfyUI Node

Kling Auth

The only node in ComfyUI-KlingAI that doesn't call Kling's API

By awsl1110·Created 5 months ago·Updated 5 months ago· 0
Kling Auth
    • api_token
    访问密钥
    安全密钥
    有效期秒1800

    The name is a lie, in the best way. Kling Auth never calls any API and needs no network. It just builds the token that every other node in this pack demands - the api_token string you're supposed to hang off your generation node's "API令牌" (API token) input. If you've ever pasted a JWT and wondered how it was made, this is the boring, local half of that story.

    Kling is Kuaishou's closed video model, and this pack is an API wrapper for it - the "when the model isn't on your machine" category: you pay per call, your prompts and images leave your machine, and you get a video_url back instead of a local render. There is no open-weight Kling to fall back on, so the API is the only door. Auth is the door handle.

    How it works

    You get two keys from the Kling AI open platform (klingai.com): an Access Key and a Secret Key. The node signs a JWT locally with them - payload iss = your Access Key, exp = now + validity, nbf = now − 5s - using HS256. That's it. The Secret Key never leaves your machine; only the resulting token is sent with your requests. For a third-party wrapper pack, that's a genuinely good design, and worth checking for: a node that asks you to paste a secret into a field that then phones it home is exactly the attack shape this ecosystem has been burned by once already.

    The three inputs that matter

    • 访问密钥 (Access Key) and 安全密钥 (Secret Key) - paste from your klingai.com app page. Both are required; empty fields raise "访问密钥和安全密钥不能为空".
    • 有效期秒 (Validity seconds) - INT, default 1800, range 300–86400. The token's lifespan. If a long generation workflow sits around longer than this, the token expires mid-poll and your task fails; bump it if you're hitting auth errors on slow renders.

    One output: api_token (STRING), which you run into the generation node's "API令牌" input. Re-running the workflow regenerates the token, which is fine - that's how it's meant to be used.

    Install

    Same as the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/awsl1110/ComfyUI-KlingAI
    pip install -r ComfyUI-KlingAI/requirements.txt   # just requests + PyJWT
    

    Restart ComfyUI. Or search ComfyUI-KlingAI in ComfyUI Manager. There are no model downloads - nothing runs locally, so there's no VRAM cost and no checkpoint to fetch. That's the point.

    Where people get burned

    • api_token is required at generation time means you never wired Kling Auth's output into the "API令牌" input. Easy fix: reconnect.
    • The fields are Chinese. 访问密钥, 安全密钥, 有效期秒, API令牌 - don't panic, they map exactly to what's above.
    • Your data still leaves the machine. The keys stay local, but every prompt, reference image, and video you generate goes to Kuaishou's servers and is subject to their logging and moderation. There are real Reddit threads from people who generated client work through a Kling ComfyUI wrapper and then couldn't get the data deleted from Kling's side. Treat anything you send here as something you won't be able to take back.
    • This pack is brand-new (first commit April 2026, a handful of stars). It's tiny and readable, which is a point in its favor for an API wrapper - you can skim the ~500 lines and see exactly what it does before handing it a secret.
    CategoryKlingAI

    Inputs (3)

    NameTypeDefaultDescription
    访问密钥STRING
    安全密钥STRING
    有效期秒optINT1800300–86400

    Outputs (1)

    NameTypeDescription
    api_tokenSTRING