PVL Gemini API (Avatar Special)
The Gemini node built for avatar batch work — with an OpenAI escape hatch
- image
- text
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, optionalimage,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.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gemini-2.5-flash | 4 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash |
| tries | INT | 21–10 | — |
| timeout | INT | 451–600 | — |
| temperature | FLOAT | 1.000–2 | — |
| top_p | FLOAT | 0.950–1 | — |
| top_k | INT | 651–1000 | — |
| batch | INT | 11–64 | — |
| delimiter | STRING | [++] | — |
| append_variation_tag | BOOLEAN | false | — |
| debug | BOOLEAN | false | — |
| section_delimiter | STRING | ----- | — |
| prompt_split_delimiter | STRING | [++] | — |
| instructions | STRING | — | |
| prompt | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
| imageopt | IMAGE | — | |
| api_keyopt | STRING | — | |
| openai_fallbackopt | BOOLEAN | false | — |
| force_openaiopt | BOOLEAN | false | — |
| openai_modelopt | COMBO | GPT-5.1 | 4 options: GPT-5.1, GPT-5 pro, GPT-5 mini, GPT-5 nano |
| openai_api_keyopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |