From 82008b002780de699bb26a010fe805006a1daeba Mon Sep 17 00:00:00 2001 From: Steve Tietze Date: Fri, 9 Jan 2026 15:25:46 +0700 Subject: [PATCH] clean up and docs --- README.md | 54 ++++++++++++++++++------------------- kie_api/prompt_lists.py | 10 +++++-- nodes.py | 19 +++++++++++-- web/docs/kie_prompt_grid.md | 9 +++++++ 4 files changed, 60 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 7974496..ca8e3d2 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,32 @@ -# ComfyUI KIE API Integration +# ComfyUI KIE API Nodes -ComfyUI custom nodes for the KIE API (image and video generation). +## Project overview +This repository provides a set of ComfyUI custom nodes that connect to the Kie.ai API for image and video generation workflows. -## Installation -- Clone or copy this repository into `ComfyUI/custom_nodes/ComfyUI-Kie-API`. -- Restart ComfyUI so it discovers the node package. +## Why this exists +ComfyUI users often need reliable, reusable API-backed nodes that mirror model capabilities while staying easy to update and maintain. This pack focuses on clear inputs, consistent outputs, and practical workflow integration. -## API Key Setup -- Copy `config/kie_key.example.txt` to `config/kie_key.txt`. -- Paste your KIE API key into `config/kie_key.txt` (this file is gitignored). -- Keep the key file alongside the repo so future nodes can read it. +## What’s included +- Image generation nodes +- Image-to-video and text-to-video nodes +- Utility helpers for grid slicing and prompt parsing -## Nodes -- KIE Get Remaining Credits -- KIE Nano Banana Pro (Image) -- KIE Seedream 4.5 Text-To-Image -- KIE Seedream 4.5 Edit -- KIE Seedance V1 Pro Fast (I2V) -- KIE Seedance 1.5 Pro (I2V/T2V) -- KIE Kling 2.6 (I2V/T2V) -- KIE Kling 2.6 (T2V) -- KIE Kling 2.6 Motion-Control (I2V) -- KIE Grid Slice -- KIE Parse Prompt Grid JSON (1..9) +Node-specific documentation is available in `web/docs`. -## Usage -- Drop a KIE node into your ComfyUI workflow and connect inputs. -- For video outputs, connect the VIDEO output to the SaveVideo node. -- Public node documentation lives in `web/docs`. +## About Kie.ai +Kie.ai is a unified API and model marketplace for image, video, and audio generation. This project is community-maintained and not affiliated with Kie.ai. Learn more at https://kie.ai/. -## Documentation -- See `web/docs` for per-node details and parameter lists. -- Development-only notes and tooling configs are not shipped in this repo. +## Credits and usage +Kie.ai uses a credit-based model for requests. There is no subscription requirement, and small funding amounts are supported for pay-as-you-go usage. + +## Debugging and job visibility +You can review request history and results at https://kie.ai/logs. + +## Project status +Early release. Interfaces may evolve as the Kie.ai API changes or additional nodes are added. + +## Feedback / contributions +Issues and pull requests are welcome. Please include clear repro steps for bugs and keep changes focused. + +## License +TBD. Add your preferred license file and update this section accordingly. diff --git a/kie_api/prompt_lists.py b/kie_api/prompt_lists.py index 38671c0..327c7be 100644 --- a/kie_api/prompt_lists.py +++ b/kie_api/prompt_lists.py @@ -20,7 +20,11 @@ def _extract_prompt_index(key: Any) -> int | None: normalized = key.strip().lower() if not normalized: return None - match = re.search(r"(\\d+)$", normalized) or re.search(r"(\\d+)", normalized) + prompt_match = re.match(r"^\\s*(?:p|prompt)\\s*[_\\-\\s]*([1-9]\\d*)\\s*$", normalized, re.IGNORECASE) + if prompt_match: + match = prompt_match + else: + match = re.match(r"^\\s*([1-9]\\d*)\\s*$", normalized) if not match: return None try: @@ -76,5 +80,7 @@ def parse_prompts_json(text: str, max_items: int = 9, strict: bool = False) -> l prompts = prompts[:max_items] if not prompts and strict: - raise ValueError("No prompts found in json_text.") + raise ValueError( + "No prompts found in json_text. Supported keys: prompts (array), prompt1/prompt_1/p1, numeric keys." + ) return prompts diff --git a/nodes.py b/nodes.py index 6705936..8175e3a 100644 --- a/nodes.py +++ b/nodes.py @@ -582,7 +582,19 @@ Outputs: "INT", "STRING", ) - RETURN_NAMES = ("p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "count", "prompts_list") + RETURN_NAMES = ( + "prompt 1", + "prompt 2", + "prompt 3", + "prompt 4", + "prompt 5", + "prompt 6", + "prompt 7", + "prompt 8", + "prompt 9", + "count", + "prompts_list", + ) FUNCTION = "parse" CATEGORY = "kie/helpers" @@ -606,7 +618,10 @@ Outputs: prompts = [fallback] if not prompts: - raise ValueError("No prompts found in json_text and no default_prompt provided.") + raise ValueError( + "No prompts found in json_text and no default_prompt provided. " + "Supported keys: prompts (array), prompt1/prompt_1/p1, numeric keys." + ) padded = prompts[:9] + [""] * (9 - len(prompts)) count = len(prompts) diff --git a/web/docs/kie_prompt_grid.md b/web/docs/kie_prompt_grid.md index 0cf2cad..d18090f 100644 --- a/web/docs/kie_prompt_grid.md +++ b/web/docs/kie_prompt_grid.md @@ -33,6 +33,15 @@ Object format (keyed prompts): } ``` +Object format (underscore keys): +``` +{ + "prompt_1": "Prompt 1", + "prompt_2": "Prompt 2", + "prompt_3": "Prompt 3" +} +``` + --- ## Outputs