Banana Studio
Gemini image generation and prompt utility nodes for ComfyUI.
Banana Studio for ComfyUI
Banana Studio is a ComfyUI custom node pack centered on Gemini image generation plus a small set of prompt-building and workflow utility nodes.
Included Nodes
Banana Studio: generate images with Gemini image models, with optional image inputs and batch supportBanana Prompt: build a structured prompt from named sectionsZ-Image Prompt: build an image prompt with framing, subject, lighting, style, and constraints sectionsPrompt Editor: expand prompt variables and strip inline commentsString Concat: join strings with an optional separatorSingle Parameter Dispatcher: emit per-batch values for parameter sweepsFormat Path: expand path templates with%date:...%formatting for downstream save nodes
Installation
Clone this repository into ComfyUI/custom_nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/tjcccc/comfyui_banana_studio.git
Restart ComfyUI after installation.
Gemini API Key
Create a local config.ini file in the repository root:
[auth]
GEMINI_API_KEY = your_gemini_api_key_here
You can copy config.ini.example to config.ini and replace the placeholder value.
API key resolution order in the Banana Studio node:
config.ini- The node
api_keyinput - Raise an error if neither is set
The api_key input remains available for temporary local testing, but config.ini takes priority when both are present.
Main Node Inputs
The Banana Studio node supports:
- Gemini image models:
gemini-3.1-flash-image-preview,gemini-3-pro-image-preview,gemini-2.5-flash-image - text prompt input
- optional image inputs for image-conditioned generation
- batch generation
- aspect ratio, resolution, temperature,
top_p, thinking level, seed, and proxy controls
Node Usage
Banana Studio
Use this as the main Gemini image generation node.
- Set
promptto your text instruction. - Set
modelto the Gemini image model you want to use. - Set
batch_sizeto generate multiple images in one run. - Connect up to 6 optional
IMAGEinputs when you want image-conditioned generation or reference images. - Use
aspect_ratioandresolutionto control the output format. - Use
temperature,top_p,thinking_level, andseedwhen you want more control over sampling behavior. - Leave
api_keyempty if you already configuredconfig.ini. - Set
proxyonly when you really need it. Large inline image uploads are more likely to fail through unstable proxies.
Outputs:
images: generated image tensor output for downstream image nodeslogs: text summary with generation status and token usage
Typical use:
- Build a prompt directly or with
Banana Prompt. - Connect that string to
Banana Studio. - Optionally connect one or more input images.
- Feed the returned
imagesinto preview, save, or post-processing nodes.
Banana Prompt
Use this when you want a structured cinematic prompt assembled from labeled sections.
medium_or_techis the main required field. Use it for medium, camera, lens, and composition context.- Fill optional sections such as
identify_reference,subject_or_presence,action_or_state,environment,clothing_body, andfinal_styleonly when needed. - If only
medium_or_techis filled, the node returns that value directly. - If any optional section is filled, the node formats all non-empty sections into a readable multi-section prompt.
Output:
prompt: the assembled text prompt string
Good fit:
- character consistency workflows
- portrait, fashion, editorial, and cinematic prompt writing
- reusable prompt blocks where each section has a clear role
Z-Image Prompt
Use this when you want a separate structured image-prompt helper based on framing, subject, scene, lighting, and constraints.
composition_or_framingis required and usually defines the shot first.- Add
subject_or_identity,wardrobe_or_appearance,environment_or_scene,lighting,mood_or_style_or_quality, andconstraintsas needed. - The
constraintsfield is useful for hard requirements likeno text,no watermark, orphotorealistic. - If only the required field is filled, the node returns it directly.
- Otherwise it builds a bracketed multi-section prompt.
Output:
prompt: the assembled text prompt string
Good fit:
- image prompting with explicit framing and lighting control
- prompts that need hard exclusions or quality constraints
- workflows outside the Banana Studio node
Prompt Editor
Use this to turn prompt code into a final prompt string.
- Put your editable prompt source into
prompt_code. - The parser removes comments, extracts variables, resolves substitutions, and returns the final prompt text.
- This is useful when you want prompt templates instead of manually rewriting full prompts each time.
Output:
prompt: the parsed final prompt string
Good fit:
- reusable prompt templates
- variable-driven prompt authoring
- prompt text that should stay maintainable over time
Example:
# Variables
character = cinematic portrait of a young woman
location = neon street at night
style = soft rim light, shallow depth of field, highly detailed
# Prompt body
prompt = {
A realistatic photo.
{character}. She is in a {location}.
{style}.
}
Expected output:
A realistatic photo.
cinematic portrait of a young woman. She is in a neon street at night.
soft rim light, shallow depth of field, highly detailed.
String Concat
Use this to merge two text blocks before sending them into prompt-consuming nodes.
string_ais required.string_bis optional.separatordefaults to a blank line.- Escape sequences such as
\nare decoded when the input is plain ASCII text, so you can type separators like\n,\n\n, or,directly.
Output:
a + b: the merged string
Good fit:
- joining a base prompt and a style suffix
- appending reusable negative or constraint text
- building prompts from smaller blocks
Single Parameter Dispatcher
Use this for simple batch-time parameter sweeps.
valueis the starting value.deltais the amount added for each next item.max_valueclamps the sequence when increasing or decreasing.batchsets the total queue length.reset_markforces the sequence to rebuild when changed.output_tag_formatlets you generate a label string using placeholders:%current_value%,%index%,%delta%,%max%,%batch%
Outputs:
dispatch_value: current numeric value for the current batch itemindex: 1-based position in the batchoutput_tag: formatted text tag using the placeholders abovelog: debug text for the current dispatched value
Good fit:
- varying guidance-like numeric inputs across queued runs
- generating per-image labels for save paths or metadata
- simple sweep workflows without a larger parameter system
Format Path
Use this when a downstream save node accepts a path or filename-prefix string and you want the path to be generated from a reusable template.
path_templatesupports custom date tokens such as%date:yyyy-MM-dd%,%date:yyyyMMdd-HHmmss%, and%date:yyyy/MM/dd/ComfyUI%.- Connect
formatted_pathto any save node input that accepts aSTRINGpath or filename prefix.
Output:
formatted_path: the formatted path string
Notes
- If you use a proxy, upload timeouts can happen before Gemini returns a response, especially when sending large inline image payloads.
- The repository keeps
config.inigit-ignored so local keys do not end up in commits. banana_studio.pyresolves the API key before making the Gemini request, so saved workflows no longer need to store the real key whenconfig.iniis present.
Development
Relevant local validation for this repository:
python3 -m py_compile banana_studio.py gemini_service.py path_format.py format_path.py __init__.py
Publish
To publish this node to the Comfy Registry manually:
pip install comfy-cli
comfy node publish
You will need a Registry publishing API key for publisher tjcccc.
This repository also includes publish_action.yml. To enable automatic publishing on version bumps:
- Create a repository secret named
REGISTRY_ACCESS_TOKEN. - Put your Comfy Registry publishing API key in that secret.
- Bump
versioninpyproject.tomland push tomain.
Version
Current project version: 0.7.0