ComfyUI General API Node Pack
Created by FeiMao-326
<<<<<<< HEAD English | 中文
e9ec5ee (feat: Release v1.0.6 with 6 new advanced text nodes and Nodes 2.0 (Vue UI) optimization)
🇬🇧 English
A suite of powerful and versatile utility nodes for ComfyUI, designed to streamline complex workflows involving Large Language Models and text manipulation. This pack is created by FeiMao-326.
✨ Nodes Included
This pack contains the following nodes, all available under the FeiMao-326 category:
- General API Node: A robust Vision LLM API node.
- Supports multi-image inputs.
- Features automatic GPU cleanup for local Ollama.
- [NEW] Native Google Gemini API support (Chat & Image Generation).
- Includes advanced seed control (
fixed,increment,randomize). =======
🇬🇧 English
A suite of powerful and versatile utility nodes for ComfyUI, designed to streamline complex workflows involving Large Language Models and text manipulation. This pack is created by FeiMao-326 and is modernized for 2026 models.
✨ Nodes Included
This pack contains the following nodes available under the FeiMao-326 category:
- General API Node: [Core] The Ultimate Multimodal LLM Engine.
- 2026 SOTA Model Support: Native adaptation for Gemini 3.1 Pro/Flash, GPT-5.4, Llama 4, and Claude 3.5.
- Smart Task Routing: Automated redirection for Google Gemini. Use standard names like
gemini-3.1-proorgemini-3.1-pro-image-previewfor chat/vision; it automatically switches to Image Gen mode when the model name includes theimage-keyword. - Double VRAM Cleanup: Specialized for local Ollama. When
cleanup_local_gpuis enabled, the node triggers a REST APIkeep_alive: 0and a CLI fallback to physically purge model data from VRAM immediately after execution. - Advanced Multimodal Vision: Supports concurrent parsing and comparison of 2 or more images.
- Seed Logic: Includes industrial-grade seed control (
fixed,increment,randomize).
e9ec5ee (feat: Release v1.0.6 with 6 new advanced text nodes and Nodes 2.0 (Vue UI) optimization)
- Text Batch Replace: A powerful text utility for performing up to 8 find-and-replace operations in a single node.
- JSON Parser: Deconstructs complex, nested JSON payloads into multiple separate text outputs with a built-in labeled preview. It deeply searches for user-defined keys, perfect for handling structured prompts.
- Show Text: Displays input text directly on the node UI.
- Simple Text: A simple text input node for passing strings to other nodes.
- Text Split By Delimiter: Splits a text string into a list based on a delimiter.
- Get List Element: Retrieves a specific element from a list by index.
- Text Iterator: Splits text by delimiter and outputs it as a batch, triggering batch execution for downstream nodes. <<<<<<< HEAD =======
- Markdown Extractor: Intelligent regex-based extraction of
```jsonor code blocks from LLM responses. - Text Template (Dynamic): [Recommended] Dynamic slot template.
{var}automatically generates input ports. Supports all languages. - Prompt Cleaner: Normalizes prompts by removing duplicates, extra commas, and empty brackets.
- Text Logic Switch: Flow control (If-Else) based on content matching (Contains, Regex, Exact, etc.).
- Regex Extractor Pro: Advanced pattern capture with capture group support.
- Dictionary Translator: Bulk mapping/replacement via JSON or Key=Value dictionaries.
e9ec5ee (feat: Release v1.0.6 with 6 new advanced text nodes and Nodes 2.0 (Vue UI) optimization)
🔧 Installation
-
Clone the Repository
- Open your terminal.
- Navigate to your ComfyUI
custom_nodesdirectory:cd path/to/your/ComfyUI/custom_nodes/ - Clone this repository:
git clone https://github.com/FeiMao-326/Comfyui-General-API-Node.git
-
Install Dependencies
- Navigate into the newly cloned folder:
cd Comfyui-General-API-Node - Install the required dependencies:
pip install -r requirements.txt
- Navigate into the newly cloned folder:
-
Restart ComfyUI
- After completing the steps above, please restart ComfyUI completely.
💡 How to Use
General API Node
-
Finding the Node: In ComfyUI, you can find the node by right-clicking ->
Add Node->FeiMao-326->FeiMao-326 General API Node. -
Seed Control Setup: To enable automatic seed changes (e.g.,
randomize), connect theseedoutput of the node back to its ownseedinput. This creates a loop that updates the seed after each run. -
Usage Scenarios:
- 📝 Text-Only Generation: Leave both
image_1andimage_2disconnected. - 🖼️ Single Image Description: Connect an image to
image_1. - 🎬 Dual Image for Video Transitions: Connect a start frame to
image_1and an end frame toimage_2. - 📸 Multi-Image Analysis: You can connect multiple images (
image_1,image_2,image_3...etc) for complex analysis tasks. <<<<<<< HEAD
- 📝 Text-Only Generation: Leave both
-
API Connection Examples:
- Local Ollama:
api_baseurl:http://127.0.0.1:11434/v1api_key:ollamamodel:gemma3:4b(or another vision-capable model)cleanup_local_gpu: Keep it checked (True).
- External API (e.g., OpenAI):
api_key: Your OpenAI API key (sk-xxxxxxxx)model:gpt-4o
- Google Gemini (Native):
api_baseurl:https://generativelanguage.googleapis.com/v1beta/api_key: Your Google AI Studio Keymodel:gemini-1.5-pro(Chat) orimagen-3.0-generate-001(Image) Below is a complete example workflow for the dual image transition task:
- Local Ollama:
Text Batch Replace
- Input any text into the
textfield. - Fill in the
find_xandreplace_xfields to perform sequential replacements.
JSON Parser
- Paste your complex JSON into the
json_payloadfield. - In the
keys_to_extractfield, enter the keys you want to extract, separated by commas (e.g.,shot, subject, audio). - The node will find these keys anywhere in the JSON, output their combined values to the corresponding
output_xports, and show a preview inside the node.
Show Text
- Connect any string output to the
textinput. - The text will be displayed on the node itself.
Simple Text
- Enter your text in the text box.
- Connect the
textoutput to any node requiring string input.
Text Split By Delimiter
- Input text and a delimiter (default is comma).
- Outputs a
LISTtype that can be used withGet List Element.
Get List Element
- Connect a
LISTinput. - Specify the index (0-based) to retrieve a specific string.
Text Iterator
- Input text and a delimiter.
- Outputs each split item as a separate batch item.
- Useful for iterating over a list of prompts or parameters.

📜 License
This project is licensed under the Apache 2.0 License. See the LICENSE and NOTICE files for details.
🇨🇳 中文
一套为 ComfyUI 设计的、功能强大且用途广泛的实用节点包,旨在简化涉及大语言模型和文本处理的复杂工作流。本节点包由 FeiMao-326 创作。
✨ 包含的节点
本节点包包含以下节点,您都可以在 FeiMao-326 分类下找到它们:
- General API Node: 一个强大的视觉LLM API节点。
- 支持多图像输入。
- 为本地 Ollama 提供自动 GPU 清理功能。
- [新增] 原生 Google Gemini API 支持 (对话 & 绘图)。
- 包含高级种子控制(
固定,递增,随机等)。
- Text Batch Replace: 一个强大的文本工具,可在单个节点中执行多达8次的查找与替换操作。
- JSON Parser: 可将复杂的、深度嵌套的JSON结构,解析为多个独立的文本输出,并自带带标签的预览功能。它会深度搜索用户定义的关键字,非常适合处理结构化提示词。
- Show Text: 直接在节点界面上显示输入的文本。
- Simple Text: 一个简单的文本输入节点,用于将字符串传递给其他节点。
- Text Split By Delimiter: 根据分隔符将文本字符串分割为列表。
- Get List Element: 通过索引从列表中检索特定元素。
- Text Iterator: 根据分隔符分割文本并作为批次输出,触发下游节点的批次执行。
🔧 安装方法
-
克隆仓库
- 打开您的终端。
- 导航到您的 ComfyUI
custom_nodes文件夹:cd path/to/your/ComfyUI/custom_nodes/ - 克隆此仓库:
git clone https://github.com/FeiMao-326/Comfyui-General-API-Node.git
-
安装依赖
- 导航到刚刚克隆下来的节点文件夹:
cd Comfyui-General-API-Node - 安装所需的依赖项:
pip install -r requirements.txt
- 导航到刚刚克隆下来的节点文件夹:
-
重启 ComfyUI
- 完成以上步骤后,请完全重启 ComfyUI。
💡 如何使用
General API Node
-
找到节点: 在 ComfyUI 中,您可以通过右键菜单 ->
Add Node->FeiMao-326->FeiMao-326 General API Node找到它。 -
设置种子控制: 若要启用自动种子变更(例如
randomize),请将节点的seed输出端口连接回它自身的seed输入端口。这个“循环”连接会在每次运行后自动更新种子值。 -
使用场景:
- 📝 纯文本生成: 将
image_1和image_2保持断开。 - 🖼️ 单图描述: 连接一张图片到
image_1接口。 - 🎬 双图视频转场: 连接起始帧到
image_1,连接结束帧到image_2。 - 📸 多图分析: 您最多可以连接多张图片 (
image_1,image_2,image_3...等) 进行复杂的分析任务。
- 📝 纯文本生成: 将
-
API 连接示例:
- 本地 Ollama:
api_baseurl:http://127.0.0.1:11434/v1api_key:ollamamodel:gemma3:4b(或其他支持视觉的模型)cleanup_local_gpu: 保持勾选 (True)。
- 外部 API (以 OpenAI 为例):
api_baseurl:https://api.openai.com/v1api_key: 填入您的 OpenAI 密钥 (sk-xxxxxxxx)model:gpt-4o
- Google Gemini (原生):
api_baseurl:https://generativelanguage.googleapis.com/v1beta/api_key: 填入您的 Google AI Studio 密钥model:gemini-1.5-pro(对话) 或imagen-3.0-generate-001(绘图) 下面是一个完整的双图转场任务的示例工作流:
- 本地 Ollama:
Text Batch Replace
JSON Parser
- 将您的复杂JSON粘贴到
json_payload字段中。 - 在
keys_to_extract字段中,输入您想提取的关键字,用逗号分隔(例如shot, subject, audio)。 - 节点会在JSON的任何位置找到这些关键字,将其合并后的值输出到对应的
output_x端口,并在节点内显示预览。
Show Text
- 将任何字符串输出连接到
text输入。 - 文本将直接显示在节点上。
Simple Text
- 在文本框中输入您的文本。
- 将
text输出连接到任何需要字符串输入的节点。
Text Split By Delimiter
Get List Element
- 连接
LIST输入。 - 指定索引(从0开始)以检索特定字符串。
Text Iterator
📜 许可证
本项目采用 Apache 2.0 许可证。详情请参阅 LICENSE 和 NOTICE 文件。
-
API Connection Examples:
- NVIDIA NIM (Official/Local):
api_baseurl:https://integrate.api.nvidia.com/v1api_key: Your NVIDIA API Key (nvapi-xxxxxxxx)model:meta/llama-4-maverick,nvidia/nemotron-3-ultra
- OpenAI GPT-5 (Latest):
api_baseurl:https://api.openai.com/v1api_key: Your OpenAI API keymodel:gpt-5.4-thinkingoro3-pro(Reasoning model)
- Local Ollama:
api_baseurl:http://127.0.0.1:11434/v1api_key:ollamamodel:gemma4:e4b(Current default, supports vision analysis)cleanup_local_gpu: Keep it checked (True).
- Google Gemini (Native):
api_baseurl:https://generativelanguage.googleapis.com/v1beta/api_key: Your Google AI Studio Keymodel:gemini-3.1-pro(Chat/Vision) orgemini-3.1-pro-image-preview(Image Gen)-
Tip
-
Important
: For Image Generation, the model name MUST contain the keyword
image-(e.g.,gemini-3.1-pro-image-preview). For Chat/Reasoning, use standard names likegemini-3.1-pro.
- NVIDIA NIM (Official/Local):
Text Batch Replace
JSON Parser
Simple Text / Show Text
- Basic input and visual display modules.
Text Split / Get Element / Iterator
Markdown Extractor
- Problem: LLMs often reply with chatter like "Sure! Here is your JSON:
json ...". - Solution: Automatically identifies and extracts clean content from Markdown code blocks.
- Scenario: When LLM generates a JSON structure, passing it directly to JsonParser would crash due to Markdown syntax. This node ensures a "smooth" connection.

Text Template (Dynamic)
- Concept: Write a template with variables:
A {subject} in {style} lighting, {mood} background. - Magic: The node instantly creates input slots for
subject,style, andmood. - Note: In Nodes 2.0 (Vue UI), right-click and "Refresh" the node after modifying variables.

Prompt Cleaner
- Function: Removes duplicate keywords, merges extra commas, and cleans inconsistent spaces.
- Scenario: Multiple prompt concatenations often result in messy punctuation (e.g.,
, ,). Use this as a "final touch" before KSampler.
Text Logic Switch
- Function: Flow control (If-Else). If input text contains a keyword (or matches regex), output travels to the "True" port, otherwise "False".
- Scenario: Check if LLM output contains "Error" to stop the workflow or switch to a fallback model.
Regex Extractor Pro
- Function: Precise data extraction using Capture Groups.
- Scenario: Extract specific info like HEX color codes (#FFFFFF) or numeric coordinates from a long LLM description.
Dictionary Translator
- Function: Bulk tag replacement using a mapping table (JSON or Simple Text Pairs).
- Scenario: Map common Chinese terms to professional SD tags (e.g., replace "Cinematic" with "cinematic lighting, 8k, highly detailed").
📜 License
This project is licensed under the Apache 2.0 License.
e9ec5ee (feat: Release v1.0.6 with 6 new advanced text nodes and Nodes 2.0 (Vue UI) optimization)

