Files
synthetai-ComfyUI-JM-KLing-API/README.md
T
2025-05-06 15:22:22 +08:00

6.6 KiB

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

  1. Navigate to the ComfyUI/custom_nodes directory.
  2. Clone this repository: git clone https://github.com/synthetai/ComfyUI-JM-KLing-API.git
  3. Install the dependencies:
  • Windows (ComfyUI portable): python -m pip install -r ComfyUI\custom_nodes\ComfyUI-JM-KLingAI-API\requirements.txt
  • Linux or MacOS: cd ComfyUI-JM-KLingAI-API && pip install -r requirements.txt
  1. Start ComfyUI and enjoy using the KLing AI API node!

Nodes

KLingAI API Key

This node generates an API Token

Text2Video

This node is used to generate a video given a text prompt.

Image2Video

This node is used to generate a video given an image.

KLingAI Lip Sync

This node is used to create a lip sync task that makes a video's mouth movements match with provided audio.

KLingAI Lip Sync Async

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.

Features:

  • Splits audio into 10-second segments (configurable)
  • Supports both local audio files and audio URLs
  • Maintains segment order during processing and final merging
  • Asynchronously creates tasks for all segments
  • Monitors task status with configurable poll interval
  • Downloads and merges videos using FFmpeg
  • Organizes files in a structured temporary directory

Note: This node requires the pydub package and FFmpeg to be installed on your system.

KLingAI Image Generation

This node is used to generate images from text prompts using KLingAI's image generation API.

Features:

  • Text-to-image generation with customizable parameters
  • Support for reference images (both via direct upload and URL)
  • Different reference modes: subject (clothing, pose, etc.) and face (appearance)
  • Adjustable fidelity settings for reference images
  • Multiple aspect ratios to choose from
  • Ability to generate multiple images per request (up to 9)
  • Support for both kling-v1 and kling-v1-5 models

KLingAI Image Downloader

This node downloads images from a URL and saves them to a local directory.

Features:

  • Downloads images from a given URL
  • Saves images with customizable filename prefixes
  • Supports PNG, JPG, JPEG, and WebP formats
  • Automatically detects image format from URL
  • Optional custom output directory
  • Returns the saved image path, original URL, and loaded image for further processing

KLingAI Video Downloader

This node downloads videos from a URL and saves them to a local directory.

Features:

  • Downloads videos from a specified URL
  • Saves videos with customizable filename prefixes
  • Supports MP4 video format
  • Optional custom output directory
  • Returns the saved video path and original URL for further processing

KLingAI 混合视频生成

这是一个融合了文生视频和图生视频功能的节点,能够根据用户输入自动选择合适的API。

功能特点:

  • 智能判断:如果提供了图像则使用图生视频API,否则使用文生视频API
  • 统一界面:在一个节点中同时支持两种视频生成方式
  • 支持图像输入(Base64或URL方式)
  • 支持正向和负向提示词
  • 支持图生视频的摄像机控制功能
  • 支持尾帧图像设置
  • 兼容所有KLingAI视频模型