PVL Gemini with fallback Api
Gemini first, GPT as the safety net — a text node that survives outages
- image
- text
If your workflow depends on an LLM call in the middle of a generation queue, you learn fast that "Gemini is down" is not a hypothetical. This node is the insurance policy: it runs the pack's Gemini engine, and when a call fails - rate limit, timeout, safety block - it hands that item to OpenAI and keeps going. One node, two providers, and a queue that doesn't die at 2am because one vendor hiccuped.
It's the newer sibling of the pack's PVL Gemini API, and the practical differences are what you'd expect from an API that moved on: the model dropdown leads with the Gemini 3 previews (gemini-3-pro-preview, gemini-3-flash-preview) and adds a thinking_level selector - off, minimal, low, medium, high - that controls how much reasoning the model does before answering. More thinking is slower and pricier and often better on complex instructions.
How it works
Same engine as the rest of the Gemini family: parallel batch calls to generativelanguage.googleapis.com, selective retries with linear backoff, results joined by delimiter. The addition is the fallback path. With openai_fallback on, any item that still fails after its Gemini retries gets re-submitted to api.openai.com with the model you picked in openai_model (default GPT-5 mini). force_openai skips Gemini entirely - useful if you're A/B testing or your Gemini quota is spent for the month.
The fallback is failure-driven, not load-balanced: Gemini stays the primary until it errors. If you want the fallback to not engage - say you'd rather fail loudly than mix providers silently - leave openai_fallback off and this behaves like a fancier PVL Gemini API.
The inputs that matter
modelandthinking_level- the new-generation controls. Defaultgemini-2.5-flashwith thinkingoffis the fast/cheap baseline; bumpthinking_levelwhen answers are shallow.openai_fallback,force_openai,openai_model,openai_api_key- the resilience block. Setopenai_api_keyor exportOPENAI_API_KEY.batch,delimiter,append_variation_tag- the parallel-variation machinery from the base node.prompt,instructions, optionalimage,api_key- the payload and key (blankapi_key=GEMINI_API_KEY).tries,timeout,temperature,top_p,top_k,seed,debug.
Output: one text string.
Installing it
Same pack, same drill:
cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes
Restart, export GEMINI_API_KEY and OPENAI_API_KEY (or fill the fields). No downloads.
Common issues
Two failure-mode subtleties. First, the fallback only rescues failures - a Gemini call that returns a confidently wrong answer doesn't trigger OpenAI, it just returns bad text. Don't mistake this node for quality assurance. Second, if both openai_fallback and force_openai are off, a failed batch raises like any plain node - the fallback is opt-in, so a workflow that worked in testing can still die in production if you never flipped the toggle. Also worth knowing: thinking_level values map differently across the model list (the Multi variant even offers numeric 0–4 forms), so a setting that works on one model may be ignored on another. And the usual: every call bills someone, and with a fallback engaged, potentially two someones.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gemini-2.5-flash | 5 options: gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite |
| thinking_level | COMBO | off | 5 options: off, minimal, low, medium, high |
| 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 | — |
| instructions | STRING | — | |
| prompt | STRING | — | |
| seed | INT | 0 | — |
| imageopt | IMAGE | — | |
| api_keyopt | STRING | — | |
| openai_fallbackopt | BOOLEAN | false | — |
| force_openaiopt | BOOLEAN | false | — |
| openai_modelopt | COMBO | GPT-5 mini | 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 | — |