ComfyUI Extension: ComfyUI-JM-KLing-API
This is a custom node for ComfyUI that allows you to use the KLingAI API directly within the ComfyUI environment. It is developed based on the KLingAI API documentation. For more details, please refer to the official documentation. a/KLingAI API Documentation.
Custom Nodes (0)
README
ComfyUI-JM-KlingAI-API
This is a custom node for ComfyUI that allows you to use the KLingAI API directly within the ComfyUI environment. It is developed based on the KLingAI API documentation. For more details, please refer to the official documentation.KLingAI API Documentation。
Requirements
Before using this node, you need to have a KLing AI API key.
Installation
Installing manually
- Navigate to the
ComfyUI/custom_nodes
directory. - Clone this repository:
git clone https://github.com/synthetai/ComfyUI-JM-KLing-API.git
- Install the dependencies:
- <font style="color:rgb(31, 35, 40);">Windows (ComfyUI portable): </font>
python -m pip install -r ComfyUI\custom_nodes\ComfyUI-JM-KLingAI-API\requirements.txt
- <font style="color:rgb(31, 35, 40);">Linux or MacOS: </font>
cd ComfyUI-JM-KLingAI-API && pip install -r requirements.txt
- <font style="color:rgb(31, 35, 40);">Start ComfyUI and enjoy using the KLing AI API node!</font>
<font style="color:rgb(31, 35, 40);">Nodes</font>
<font style="color:rgb(31, 35, 40);">KLingAI API Key</font>
<font style="color:rgb(31, 35, 40);">This node generates an API Token</font>
<font style="color:rgb(31, 35, 40);">Text2Video</font>
<font style="color:rgb(31, 35, 40);">This node is used to generate a video given a text prompt.</font>
<font style="color:rgb(31, 35, 40);">Image2Video</font>
<font style="color:rgb(31, 35, 40);">This node is used to generate a video given an image.</font>
<font style="color:rgb(31, 35, 40);">KLingAI Lip Sync</font>
<font style="color:rgb(31, 35, 40);">This node is used to create a lip sync task that makes a video's mouth movements match with provided audio.</font>
<font style="color:rgb(31, 35, 40);">KLingAI Lip Sync Async</font>
<font style="color:rgb(31, 35, 40);">This node processes longer audio files by automatically splitting them into segments and creates lip sync tasks asynchronously. It then monitors task progress, downloads the generated videos, and merges them into a single output video.</font>
<font style="color:rgb(31, 35, 40);">Features:</font>
- <font style="color:rgb(31, 35, 40);">Splits audio into 10-second segments (configurable)</font>
- <font style="color:rgb(31, 35, 40);">Supports both local audio files and audio URLs</font>
- <font style="color:rgb(31, 35, 40);">Maintains segment order during processing and final merging</font>
- <font style="color:rgb(31, 35, 40);">Asynchronously creates tasks for all segments</font>
- <font style="color:rgb(31, 35, 40);">Monitors task status with configurable poll interval</font>
- <font style="color:rgb(31, 35, 40);">Downloads and merges videos using FFmpeg</font>
- <font style="color:rgb(31, 35, 40);">Organizes files in a structured temporary directory</font>
<font style="color:rgb(31, 35, 40);">Note: This node requires the pydub
package and FFmpeg to be installed on your system.</font>
<font style="color:rgb(31, 35, 40);">KLingAI Image Generation</font>
<font style="color:rgb(31, 35, 40);">This node is used to generate images from text prompts using KLingAI's image generation API.</font>
<font style="color:rgb(31, 35, 40);">Features:</font>
- <font style="color:rgb(31, 35, 40);">Text-to-image generation with customizable parameters</font>
- <font style="color:rgb(31, 35, 40);">Support for reference images (both via direct upload and URL)</font>
- <font style="color:rgb(31, 35, 40);">Different reference modes: subject (clothing, pose, etc.) and face (appearance)</font>
- <font style="color:rgb(31, 35, 40);">Adjustable fidelity settings for reference images</font>
- <font style="color:rgb(31, 35, 40);">Multiple aspect ratios to choose from</font>
- <font style="color:rgb(31, 35, 40);">Ability to generate multiple images per request (up to 9)</font>
- <font style="color:rgb(31, 35, 40);">Support for both kling-v1 and kling-v1-5 models</font>
<font style="color:rgb(31, 35, 40);">KLingAI Image Downloader</font>
该节点用于从URL下载图片并保存到本地。
功能特点
- 支持从URL直接下载图片
- 自动保存到ComfyUI输出目录
- 支持自定义输出子目录
- 自动生成序列文件名(如 KLingAI_0001.png)
输入参数
image_url
(必填): 图片的URL地址filename_prefix
(必填): 图片文件名前缀,默认为 "KLingAI"custom_output_dir
(可选): 自定义输出子目录,相对于ComfyUI输出目录
输出
IMAGE
: 下载的图片,可用于后续处理image_path
: 图片在输出目录中的相对路径image_url
: 原始图片URL
使用示例
- 在ComfyUI中添加KLingAI Image Downloader节点
- 输入图片URL和可选的文件名前缀
- 运行工作流,图片将被下载并保存
- 使用ComfyUI的预览节点查看下载的图片
<font style="color:rgb(31, 35, 40);">KLingAI Video Downloader</font>
<font style="color:rgb(31, 35, 40);">This node downloads videos from a URL and saves them to a local directory.</font>
<font style="color:rgb(31, 35, 40);">Features:</font>
- <font style="color:rgb(31, 35, 40);">Downloads videos from a specified URL</font>
- <font style="color:rgb(31, 35, 40);">Saves videos with customizable filename prefixes</font>
- <font style="color:rgb(31, 35, 40);">Supports MP4 video format</font>
- <font style="color:rgb(31, 35, 40);">Optional custom output directory</font>
- <font style="color:rgb(31, 35, 40);">Returns the saved video path and original URL for further processing</font>
<font style="color:rgb(31, 35, 40);">KLingAI 混合视频生成</font>
<font style="color:rgb(31, 35, 40);">这是一个融合了文生视频和图生视频功能的节点,能够根据用户输入自动选择合适的API。</font>
<font style="color:rgb(31, 35, 40);">功能特点:</font>
- <font style="color:rgb(31, 35, 40);">智能判断:如果提供了图像则使用图生视频API,否则使用文生视频API</font>
- <font style="color:rgb(31, 35, 40);">统一界面:在一个节点中同时支持两种视频生成方式</font>
- <font style="color:rgb(31, 35, 40);">支持图像输入(Base64或URL方式)</font>
- <font style="color:rgb(31, 35, 40);">支持正向和负向提示词</font>
- <font style="color:rgb(31, 35, 40);">支持图生视频的摄像机控制功能</font>
- <font style="color:rgb(31, 35, 40);">支持尾帧图像设置</font>
- <font style="color:rgb(31, 35, 40);">兼容所有KLingAI视频模型</font>