comfyui_jas_nodes
Custom ComfyUI nodes for direct image generation and editing with OpenAI, Gemini, and OpenRouter API providers without extra account flows.
comfyui_jas_nodes
Custom ComfyUI nodes for direct image generation and image editing with OpenAI, Gemini, and OpenRouter.
Contents
- Why this project exists
- What it includes
- Supported nodes
- Supported providers and models
- Requirements
- Quick Start
- Installation
- API key setup
- Environment variable setup on Windows
- Environment variable setup on macOS and Linux
- Base URL support
- OpenRouter image edit sizing behavior
- Example workflows
- Development workflow
- Standard usage for other users
- Debugging
- Notes
- Security reminder
- License
Why this project exists
Many existing nodes, including some official or provider-branded ones, are tied to extra account login flows, provider dashboards, or platform-specific registration steps. This project is meant to stay simple: set an API key, restart ComfyUI, and use the nodes.
If you already have a valid API key, you should not need an extra Comfy account login just to run image generation or image editing.
What it includes
- Direct OpenAI text-to-image node
- Direct OpenAI image-edit node
- Direct Gemini / Nano Banana text-to-image node
- Direct Gemini / Nano Banana image-edit node
- OpenRouter text-to-image node
- OpenRouter image-edit node
- Example workflows for each provider
Supported nodes
JAS OpenAI Text to Image [set OPENAI_API_KEY]JAS OpenAI Image Edit [set OPENAI_API_KEY]JAS Nano Banana Text to Image [set GEMINI_API_KEY]JAS Nano Banana Image Edit [set GEMINI_API_KEY]JAS OpenRouter Text to Image [set OPENROUTER_API_KEY]JAS OpenRouter Image Edit [set OPENROUTER_API_KEY]
Supported providers and models
OpenAI: direct images API usageGemini: direct Gemini image generation / editing usageOpenRouter: currently supportsopenai/gpt-5.4-image-2andgoogle/gemini-3.1-flash-image-preview
Requirements
- ComfyUI
- Python environment used by ComfyUI
requests- Valid provider API key for the nodes you plan to use
Install dependency:
python -m pip install -r requirements.txt
Quick Start
- Clone this repository into
ComfyUI/custom_nodes/comfyui_jas_nodes - Install dependencies with
python -m pip install -r requirements.txt - Set the API key you want to use, such as
OPENAI_API_KEY,GEMINI_API_KEY, orOPENROUTER_API_KEY - Restart ComfyUI
- Search for
JASin the node menu and load one of the example workflows if needed
Installation
Recommended cross-platform layout
Place this project inside your ComfyUI custom node directory:
ComfyUI/custom_nodes/comfyui_jas_nodes
Then restart ComfyUI.
If you are developing locally and prefer to keep the source outside your main ComfyUI directory, you can also use your own loader or symlink workflow, but that is optional and not required for normal users.
API key setup
OpenAI
Required environment variable:
OPENAI_API_KEY
Gemini
Required environment variable:
GEMINI_API_KEY
Alternative supported variable:
GOOGLE_API_KEY
OpenRouter
Required environment variable:
OPENROUTER_API_KEY
Environment variable setup on Windows
Current PowerShell session:
$env:OPENAI_API_KEY = "sk-..."
$env:GEMINI_API_KEY = "your-gemini-key"
$env:OPENROUTER_API_KEY = "your-openrouter-key"
Current CMD session:
set OPENAI_API_KEY=sk-...
set GEMINI_API_KEY=your-gemini-key
set OPENROUTER_API_KEY=your-openrouter-key
Persist for the current Windows user:
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-...", "User")
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "your-gemini-key", "User")
[Environment]::SetEnvironmentVariable("OPENROUTER_API_KEY", "your-openrouter-key", "User")
Notes:
Userwrites to your Windows user environment variables, not system-wide machine variables- You will usually see these values in the Windows environment variable UI under user variables
- After changing them, restart ComfyUI completely
- Already-open terminals do not automatically pick up newly saved environment variables
Environment variable setup on macOS and Linux
Temporary shell session:
export OPENAI_API_KEY="sk-..."
export GEMINI_API_KEY="your-gemini-key"
export OPENROUTER_API_KEY="your-openrouter-key"
Persist for bash:
echo 'export OPENAI_API_KEY="sk-..."' >> ~/.bashrc
echo 'export GEMINI_API_KEY="your-gemini-key"' >> ~/.bashrc
echo 'export OPENROUTER_API_KEY="your-openrouter-key"' >> ~/.bashrc
source ~/.bashrc
Persist for zsh:
echo 'export OPENAI_API_KEY="sk-..."' >> ~/.zshrc
echo 'export GEMINI_API_KEY="your-gemini-key"' >> ~/.zshrc
echo 'export OPENROUTER_API_KEY="your-openrouter-key"' >> ~/.zshrc
source ~/.zshrc
Then restart ComfyUI from a shell that has those variables.
Base URL support
The nodes expose configurable base_url inputs.
- OpenAI nodes default to
https://api.openai.com/v1 - Gemini nodes default to
https://generativelanguage.googleapis.com/v1beta/models - OpenRouter nodes default to
https://openrouter.ai/api/v1/chat/completions
This lets you point compatible nodes to alternate endpoints when needed.
OpenRouter image edit sizing behavior
OpenRouter image edit supports:
aspect_ratio=sourcepreserve_source_size=true
When enabled, the node derives aspect ratio from the input image and also sends the original WIDTHxHEIGHT as image_config.size.
Important: this is a request to the upstream API. The final returned size still depends on what the selected model and provider actually honor.
Example workflows
example/text_to_image_example.jsonexample/image_edit_example.jsonexample/nanobanana_text_to_image_example.jsonexample/nanobanana_image_edit_example.jsonexample/openrouter_text_to_image_example.jsonexample/openrouter_image_edit_example.json
The image edit examples expect an input image such as example_input.png in your ComfyUI input directory, unless you change the filename after importing.
Development workflow
If you change node code in nodes.py:
- Save the file
- Fully restart ComfyUI
- Test the node again
In the current project structure, most normal feature work only needs changes in nodes.py. You usually do not need to edit __init__.py unless you change how modules are exported or loaded.
Standard usage for other users
For a normal installation, users do not need any special loader file outside this repository.
The standard setup is simply:
- Clone this repository into
ComfyUI/custom_nodes/comfyui_jas_nodes - Set the needed API key
- Restart ComfyUI
That is enough because this repository already exports its node mappings through its own __init__.py.
Debugging
- Start ComfyUI from a terminal so Python import errors and API failures stay visible
- If the nodes do not appear, check startup logs for
comfyui_jas_nodes - If a provider request fails, the node raises the HTTP status and response body when available
- If OpenRouter returns text instead of an image, that usually means the model refused the request or answered in text only
- OpenAI edit supports optional
MASK; mask requires exactly one input image
Notes
- OpenAI image generation is not guaranteed to be deterministic even if a
seed-like field is present in workflow compatibility logic - Gemini image generation is also not guaranteed to be deterministic even if a seed is accepted upstream
Customresolution is currently validated forgpt-image-2only in the direct OpenAI nodes- Transparent background is blocked for
gpt-image-2in the direct OpenAI nodes to match current API constraints
Security reminder
- Keep API keys in environment variables instead of hardcoding them into workflows or source files
- Do not commit real keys,
.envfiles, or private configuration files
License
This project is licensed under the MIT License. See LICENSE.