Better-Gemini
A ComfyUI node that provides a better interface with Google Gemini models.
Perfil del paquete
- Estado
- Verificado
- Publicador
- @ttulttul
- Fuente
- GitHub
Léeme
ComfyUI Better Gemini
ComfyUI V3 nodes for generating images and text with Google Gemini and xAI Grok, plus image generation and editing through OpenRouter.
This repo provides three nodes:
Better Geminifor Gemini image and text generationBetter Grokfor Grok image generation, image editing, and text chatBetter OpenRouterfor OpenRouter image generation and reference-guided editing
Install
- Clone into your ComfyUI
custom_nodesdirectory:cd /path/to/ComfyUI/custom_nodesgit clone https://github.com/<you>/ComfyUI-Better-Gemini.git
- Install Python deps with
uv:uv syncuv pip install --python /path/to/ComfyUI/python/bin/python -e ./ComfyUI-Better-Gemini
- Set API keys as needed:
export GOOGLE_API_KEY="..."orexport GEMINI_API_KEY="..."export XAI_API_KEY="..."(optional for Grok Imagine after OAuth login)export OPENROUTER_API_KEY="..."
- Restart ComfyUI.
Nodes
Better Gemini
- Inputs: prompt, model,
response_modalities(IMAGE,IMAGE+TEXT,TEXT), optional prompt images, aspect ratio, resolution or width+height, temperature, top_p, top_k, max tokens, thinking controls, seed, optional output caching - Outputs:
IMAGE,STRING - Use it when you want one node that can handle both Gemini image models and Gemini text-only models
Better Grok
- Inputs: prompt, model, authentication mode (
auto,oauth,api_key),response_modalities(IMAGE,IMAGE+TEXT,TEXT), reasoning effort (none,low,medium,high), optional prompt images, aspect ratio, resolution,n, optional output caching - Outputs:
IMAGE,STRING - Use it when you want Grok image generation, image editing, or a text-only Grok call from the same node
xAI OAuth Login
Better Grok can use xAI device authorization for Imagine image generation and editing without storing an API key in the workflow:
- Add or open a Better Grok node with ComfyUI's V3 node renderer.
- Click
Loginin the node header. - Open the xAI verification page, sign in, enter the displayed code if requested, and approve access.
- Leave ComfyUI running while the node polls for approval. The button changes to
Logoutwhen authorization completes, and the initiating node switches toauth_mode=oauth.
Authentication modes:
autopreserves existing workflows: an inline API key wins, then a saved OAuth login is used for Imagine requests, thenXAI_API_KEYremains the fallback.oauthrequires a completed node-header login and never uses the API-key field.api_keyuses the inline key orXAI_API_KEYand ignores saved OAuth credentials.
OAuth credentials are stored server-side under ComfyUI's protected system-user directory (user/__better_gemini/xai_oauth.json), not in workflows or browser storage. The directory and token file use private permissions where the platform supports them. Each workflow run checks token expiry asynchronously; near-expiry credentials refresh in the background, while an already expired token is refreshed before the xAI request is sent. Logout cancels pending login/refresh work and deletes the stored credentials.
The OAuth client follows xAI's Grok-compatible device endpoints at auth.x.ai and sends the resulting bearer only to xAI's public Imagine image endpoints. Better Grok TEXT mode continues to require an API key because xAI OAuth chat traffic uses a separate CLI-proxy wire contract. This OAuth surface is not documented as a stable public xAI integration API and may require maintenance if xAI changes it.
xAI Rate Limiting
All Better Grok calls in one ComfyUI process share a thread-safe, per-model request coordinator. By default it starts no more than 5 requests per second and allows no more than 5 logical requests for the same model in flight. Starts are evenly spaced instead of released in one burst. The coordinator retains one minute of attempt timestamps for accounting and removes active entries in a finally block af
Nodos de este paquete
3 nodos
Nodos de este paquete
3 nodos- BetterGemini
- BetterGrok
- BetterOpenRouter
Fuentes
3 fuentes
Fuentes
3 fuentesVerificado 23 oct
Verificado 23 oct
Extractos de fuentes
1 extracto
Extractos de fuentes
1 extractoSource context: Repo ttulttul/Better-Gemini
