This extension integrates Google's Gemini API and Ollama into ComfyUI, allowing users to leverage these powerful language models directly within their ComfyUI workflows.
Clone this repository into your ComfyUI's custom_nodes
directory:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/yourusername/GeminiOllama.git
Install the required dependencies:
pip install google-generativeai requests vtracer
config.json
file in the extension directory with the following content:
{
"GEMINI_API_KEY": "your_api_key_here"
}
http://localhost:11434
).config.json
:
{
"GEMINI_API_KEY": "your_api_key_here",
"OLLAMA_URL": "http://localhost:11434"
}
After installation and configuration, a new node called "Gemini Ollama API" will be available in ComfyUI.
api_choice
: Choose between "Gemini" and "Ollama"prompt
: The text prompt for the AI modelgemini_model
: Select the Gemini model (for Gemini API)ollama_model
: Specify the Ollama model (for Ollama API)stream
: Enable/disable streaming responsesimage
(optional): Input image for vision-based taskstext
: The generated response from the chosen AI modelget_gemini_api_key()
: Retrieves the Gemini API key from the config file.get_ollama_url()
: Gets the Ollama URL from the config file.generate_content()
: Main function to generate content based on the chosen API and parameters.generate_gemini_content()
: Handles content generation for Gemini API.generate_ollama_content()
: Manages content generation for Ollama API.tensor_to_image()
: Converts a tensor to a PIL Image for vision-based tasks.Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.