Nodes/ComfyUI Assistant Node/PVL Gemini API (Avatar Special)
ComfyUI Node

PVL Gemini API (Avatar Special)

The Gemini node built for avatar batch work — with an OpenAI escape hatch

By pvlprk·Created about a year ago·Updated 8 months ago· 1
PVL Gemini API (Avatar Special)
  • image
  • text
modelgemini-2.5-flash
tries2
timeout45
temperature1.00
top_p0.95
top_k65
batch1
delimiter[++]
append_variation_tagfalse
debugfalse
section_delimiter-----
prompt_split_delimiter[++]
instructions
prompt
seed0
api_key
openai_fallbackfalse
force_openaifalse
openai_modelGPT-5.1
openai_api_key

If you've ever built a workflow that generates dozens of avatars or character variants in one queue run, you know the pain this node is aimed at: every variant needs slightly different prompt text, and hand-editing a prompt string 50 times is misery. This is the "Avatar Special" version of the pack's Gemini node, and it exists to split one big prompt template into many parallel calls and stitch the results back together.

The idea: you write a shared header (system context) separated by a section_delimiter (default -----), then a final prompt section where individual variants are split by prompt_split_delimiter (default [++]). The node fans those out across parallel Gemini calls - so [++] in your prompt becomes "one call per variant," all running at once, all returning into one combined text output.

How it works

Mechanically it's the pack's Gemini engine: calls hit generativelanguage.googleapis.com v1beta, retryable failures get retried with linear backoff (1s, 2s, 3s…), only failed items are re-run, and results are joined by delimiter. What's added on top is the split-header structure plus an optional OpenAI fallback: if openai_fallback is on and a Gemini call fails, the node retries that item against api.openai.com using the openai_model you picked. force_openai flips the whole thing to OpenAI-only.

The OpenAI side is a genuine fallback, not a mirror: it only engages on Gemini failure. If your Gemini quota is exhausted mid-batch, the workflow keeps producing instead of dying - which is exactly what you want at 2am with a 200-image queue running.

The inputs that matter

  • section_delimiter (-----) - splits the shared header from the per-variant section.
  • prompt_split_delimiter ([++]) - splits individual variants within the final prompt. This is the input that does the real work.
  • delimiter - joins the results back into one string.
  • batch - how many parallel calls; up to 64.
  • append_variation_tag - auto-appends "Variation N" to prompts, a lighter-weight alternative to writing your own [++] splits.
  • The OpenAI block: openai_fallback, force_openai, openai_model (GPT-5.1 / 5 pro / 5 mini / 5 nano), openai_api_key. Only touch these if you're actually using the fallback.
  • instructions, prompt, optional image, api_key - same as the base Gemini node.

Output: a single text string with everything joined.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes

Restart, set GEMINI_API_KEY (and OPENAI_API_KEY if you want the fallback) in the environment, or type them into the node. No downloads.

Common issues

The delimiter setup is the thing that will bite you, because nothing validates it. If your variants don't include [++], the node treats the whole prompt as one item and batch is wasted. If your shared header accidentally contains a -----, the split lands in the wrong place. Test with batch at 2 and a two-variant prompt before scaling up. Second, the fallback only triggers on failures - a successfully returned but nonsense output won't be rescued, so keep debug on while you're tuning. And remember this calls external APIs for every variant; a 64-batch run is 64 billable calls, Gemini or OpenAI, no matter which one wins the day.

CategoryPVL/LLM

Inputs (21)

NameTypeDefaultDescription
modelCOMBOgemini-2.5-flash4 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash
triesINT21–10
timeoutINT451–600
temperatureFLOAT1.000–2
top_pFLOAT0.950–1
top_kINT651–1000
batchINT11–64
delimiterSTRING[++]
append_variation_tagBOOLEANfalse
debugBOOLEANfalse
section_delimiterSTRING-----
prompt_split_delimiterSTRING[++]
instructionsSTRING
promptSTRING
seedINT00–18446744073709550000
imageoptIMAGE
api_keyoptSTRING
openai_fallbackoptBOOLEANfalse
force_openaioptBOOLEANfalse
openai_modeloptCOMBOGPT-5.14 options: GPT-5.1, GPT-5 pro, GPT-5 mini, GPT-5 nano
openai_api_keyoptSTRING

Outputs (1)

NameTypeDescription
textSTRING