Install this extension via the ComfyUI Manager by searching
for ComfyUI_ChatGLM_API
1. Click the Manager button in the main menu
2. Select Custom Nodes Manager button
3. Enter ComfyUI_ChatGLM_API in the search bar
After installation, click the Restart button to
restart ComfyUI. Then, manually
refresh your browser to clear the cache and access
the updated list of nodes.
Visit
ComfyUI Online
for ready-to-use ComfyUI environment
ComfyUI_ChatGLM_API enables users to utilize Chatglm's API within ComfyUI for translating and describing images, functioning similarly to OpenAI's API.
ComfyUI_ChatGLM_API Introduction
ComfyUI_ChatGLM_API is an extension designed to integrate advanced language models like ChatGLM-4 and GLM-3 into ComfyUI. This extension allows you to use these models for various tasks such as translating text, describing images, and more. It functions similarly to other well-known APIs like OpenAI's API or Claude API. This tool is particularly useful for AI artists who want to enhance their creative workflows with powerful language models without needing extensive technical knowledge.
How ComfyUI_ChatGLM_API Works
At its core, ComfyUI_ChatGLM_API works by connecting to external language models via API calls. When you input text or images into ComfyUI, the extension sends this data to the selected language model, which processes it and returns the desired output. For example, if you input a piece of text in one language, the model can translate it into another language. Similarly, if you input an image, the model can generate a descriptive text about the image.
Think of it as having a smart assistant that can understand and generate human-like text based on the data you provide. This assistant can help you with tasks like writing prompts, translating content, or even generating creative descriptions for your artwork.
ComfyUI_ChatGLM_API Features
Text Translation and Description
Text-to-Text (txt2txt): This feature allows you to translate text or generate descriptive text. You can input text in any language, and the model will translate or describe it based on your settings.
Example: Input a story in Chinese, and the model can translate it into English or expand it with more details.
Image Description
Image-to-Text (img2txt): This feature uses the ChatGLM-4V model to analyze and describe images. It's similar to other image captioning tools but leverages the advanced capabilities of ChatGLM-4V.
Example: Upload an image, and the model will generate a detailed description of the scene or objects in the image.
Customizable Parameters
Language: Choose the output language for translations or descriptions.
Max Tokens: Control the length of the generated text.
Temperature: Adjust the randomness of the output. Higher values make the output more creative, while lower values make it more precise.
Role and Drawing Models
Role Models: Interact with custom-defined characters for more personalized and engaging conversations.
Drawing Models: Generate text-based descriptions that can be used as prompts for creating images.
ComfyUI_ChatGLM_API Models
The extension supports several models, each suited for different tasks:
ChatGLM-4: Ideal for high-quality text generation and translation.
GLM-3-Turbo: A cost-effective option for general-purpose text tasks.
ChatGLM-4V: Specialized in image description and analysis.
When to Use Each Model
ChatGLM-4: Use this model when you need high accuracy and quality in text generation or translation.
GLM-3-Turbo: Opt for this model if you are looking for a budget-friendly option that still delivers good performance.
ChatGLM-4V: Best for tasks involving image analysis and description.
What's New with ComfyUI_ChatGLM_API
Updates as of 2024-06-06
New Model Support: Added support for "THUDM/glm-4-9b chat" and "THUDM/glm-4v-9b" models.
Transformers Update: Requires the latest version of the Transformers library to use the new models.
Recent Additions
Language Options: Control the output language with the language parameter.
Max Tokens and Temperature: Fine-tune the output length and creativity.
Translation Mode: A new option to translate prompts into English only.
Role and Drawing Models: Added APIs for interacting with custom characters and generating image prompts.
Troubleshooting ComfyUI_ChatGLM_API
Common Issues and Solutions
API Key Issues: Ensure your API key is correctly entered in the config file. If you encounter authentication delays, double-check your network connection.
Image Upload Problems: Before uploading, use the "Image Crop or Scale" node to reduce the image size to under 5MB.
Output Language Not Changing: Verify that the language parameter is set correctly in your settings.
Frequently Asked Questions
Q: How do I get an API key?
A: Register on the Zhipu AI website and apply for an API key. New users receive free tokens for initial use.
Q: What happens if I upload NSFW content?
A: NSFW content is filtered out due to legal regulations, and violating this can result in your account being banned.
Learn More about ComfyUI_ChatGLM_API
For additional resources, tutorials, and community support, consider the following:
Official Documentation: Detailed guides and API references.
Community Forums: Join discussions with other AI artists and developers.
Tutorials: Step-by-step guides to help you get started and make the most of the extension.
By leveraging these resources, you can enhance your understanding and usage of ComfyUI_ChatGLM_API, making your creative process more efficient and enjoyable.