Nodes/ComfyUI-JM-KLing-API/KLingAI Image Downloader
ComfyUI Node

KLingAI Image Downloader

Grab Kling's result URL and turn it into an IMAGE

By juemingai·Created about a year ago·Updated 11 months ago· 3
KLingAI Image Downloader
    • IMAGE
    • image_path
    • image_url
    image_url
    filename_prefixKLingAI
    custom_output_dir

    The Kling API hands you URLs, and URLs are not usable inside a ComfyUI graph. KLingAI Image Downloader is the bridge: it takes the url that Query Status returns for an image-generation task, downloads the file, saves it into ComfyUI's output folder with a tidy sequence name, and - this is the important part - converts it back into a proper IMAGE tensor you can wire into the next node. It closes the loop on image tasks.

    It's a plain utility node, not a task node, so no async business and no task IDs. Give it a URL, run, get an image out. It's also useful in its own right for pulling any image URL from the web into a workflow, not just Kling results.

    Inputs

    • image_url (required) - the source URL. Usually the url output from Query Status on an image-generation task.
    • filename_prefix (required) - default KLingAI. The saved file is named KLingAI_0001.png, incrementing the number if files already exist.
    • custom_output_dir (optional) - a subfolder inside ComfyUI's output directory. Leave blank to save at the top level.

    Outputs

    • IMAGE - the downloaded image as a tensor, ready for preview, image2video, upscaling, whatever. This is the one you actually wire things from.
    • image_path (STRING) - the relative path from the output folder, handy for scripts.
    • image_url (STRING) - echoes back what you fed it.

    How it behaves

    The node detects format from the URL extension - png, jpg/jpeg, webp - and saves accordingly, then loads the file back as a tensor. It also writes a small JSON preview file into the output folder's .previews directory so the image shows up in ComfyUI's history. If anything fails, it returns a small blank tensor plus an error string as image_path rather than crashing the queue - read the console for the actual message.

    Where people get burned

    • Blank URL. Nothing to download; you get the blank-tensor error path. Double-check the wire from Query Status is actually connected.
    • Custom directory confusion. Unlike the video downloader, custom_output_dir here is treated as a subfolder of the output directory, not a raw path. A path that starts with .. (pointing outside output) is rejected with a warning and falls back to the default folder.
    • Expired Kling URLs. Kling result URLs can be time-limited. If a download fails with a 403/410, re-run Query Status to get a fresh URL rather than retrying the dead one.
    • It's not a download-and-forget node. The IMAGE output is the point - if you only wanted the file on disk, it does that too, but you're leaving value on the table by not using the tensor.
    CategoryJM-KLingAI-API

    Inputs (3)

    NameTypeDefaultDescription
    image_urlSTRING
    filename_prefixSTRINGKLingAI
    custom_output_diroptSTRING

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    image_pathSTRING
    image_urlSTRING