Nodes/ComfyUI-Teeth/Teeth Gemini2
ComfyUI Node

Teeth Gemini2

Ask Gemini About Your Generated Images From Inside a Workflow

By steelan9199·Created 2 years ago·Updated about a year ago· 10
Teeth Gemini2
  • prompt2
  • prompt3
  • prompt4
  • prompt5
  • prompt6
  • prompt7
  • text
model
temperature0.50
top_p0.90
top_k20
max_output_tokens8192
presence_penalty0.30
frequency_penalty0.30
prompt
prompt

You just generated four images and you want a second opinion on which one has an actual face in it. Or you want an AI caption for a batch, in Chinese, formatted as a list you can paste back into a prompt. Teeth Gemini2 is a direct line to Google's Gemini API from inside ComfyUI: text in, text out, and - the part that makes it interesting - you can wire images straight into it as extra inputs.

It's the one node in the ComfyUI-Teeth pack that needs something from you before it works: an API key. No model files, no local GPU cost, but also no free lunch - every run is a paid API call.

How it works

The node uses Google's google-genai Python SDK (the modern client, not the legacy google-generativeai). It builds a list of "contents" from your inputs - the main prompt plus anything wired into prompt2 through prompt7. Text strings go in as-is; image tensors get converted to JPEG bytes and sent as image parts. Then it calls generate_content with your sampling settings and returns the reply text.

The README's own demo sums it up: send several images with the question "which ones have animals, which ones have people?" and Gemini answers per image. That's the workflow - generate, wire the outputs into prompt slots, get a judgment back as a string you can branch on.

Inputs and outputs that matter

  • model - a dropdown of seven Gemini models, from gemini-2.0-flash-001 down to the tiny gemini-1.5-flash-8b.
  • prompt - your instruction (multiline).
  • prompt2–prompt7 - six extra inputs that accept either text or images. This is how you attach pictures to the question.
  • temperature / top_p / top_k / max_output_tokens / presence_penalty / frequency_penalty - the sampling knobs. Defaults are sane (temperature 0.5, max 8192 tokens); the two penalties are silently skipped for the thinking/preview models that don't accept them.
  • text (output) - the model's reply as a STRING.

For a beginner: set the model, write the prompt, wire in the images, run. The six sampling sliders almost never need touching.

The part nobody warns you about

The model list is frozen in early 2025. Several entries - gemini-2.0-flash-thinking-exp-01-21, gemini-2.0-pro-exp-02-05, gemini-2.0-flash-exp - were experimental previews that Google has since retired. Pick one of those today and the API will error with a model-not-found. The one that still works is gemini-2.0-flash-001; if you want anything newer you'll be editing the model list in gemini2.py yourself. Also note the dropdown labels are in Chinese (the author's first language) - the parenthetical RPM figures are rate limits, not performance scores.

The API key. Create api_key.ini in the pack's folder (ComfyUI/custom_nodes/ComfyUI-Teeth/) - there's an api_key.ini.example to copy - containing:

google_api_key = AIza...

Get the key from aistudio.google.com/app/apikey. The node reads this file on every run, and if the key's missing or wrong you'll get a friendly error telling you exactly that. This is also why the pack's requirements.txt includes google-genai - it's the one dependency the README admits you might actually need to install.

Common issues

  • "API key not found" - api_key.ini missing or the key line isn't google_api_key = ....
  • Model not found / 404 - you picked a retired exp model. Switch to gemini-2.0-flash-001.
  • No input provided - the node refuses to run with an empty prompt and no connected inputs, which is sensible.

Install

ComfyUI Manager: search ComfyUI-Teeth. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/steelan9199/ComfyUI-Teeth
pip install -r requirements.txt   # mainly for google-genai

Restart, drop in your API key, and the rest of the pack's nodes - contours, grid splitting, text file helpers - work with zero setup, since they're all pure numpy/OpenCV.

CategoryTeeth

Inputs (15)

NameTypeDefaultDescription
modelCOMBO7 options: gemini-2.0-flash-001(Gemini 2.0 Flash 的正式版), gemini-2.0-flash-thinking-exp-01-21(Gemini 2.0 Flash 思维模型背后的模型的最新预览版), gemini-2.0-pro-exp-02-05(Gemini 2.0 Pro 的实验性公开预览版), gemini-1.5-flash(15RPM,平衡), gemini-2.0-flash-exp(10RPM,最新), gemini-1.5-pro(2RPM,最佳), +1
temperatureFLOAT0.500–1
top_pFLOAT0.900–1
top_kINT200–100
max_output_tokensINT81921–8192
presence_penaltyFLOAT0.30-2–2
frequency_penaltyFLOAT0.30-2–2
promptSTRING
promptoptSTRING
prompt2opt*
prompt3opt*
prompt4opt*
prompt5opt*
prompt6opt*
prompt7opt*

Outputs (1)

NameTypeDescription
textSTRING