Nodes/comfyUI_Vertex_API/Vertex AI Text (Gemini LLM)
ComfyUI Node

Vertex AI Text (Gemini LLM)

A Gemini LLM inside your workflow, for the jobs that aren't diffusion

By linfen0·Created 10 months ago·Updated 10 months ago· 2
Vertex AI Text (Gemini LLM)
  • vertex_config
  • generation_config
  • text
  • generation_config
promptExplain quantum physics in simple terms.
model_namegemini-1.5-pro-002
temperature0.7
max_tokens8192
safety_filter_levelBLOCK_NONE
system_instructionYou are a helpful assistant.
custom_model_name

The pack's other half: instead of an image, this node returns text from a Gemini LLM on Vertex AI. Same credentials, same cloud-vs-local tradeoff, but for a different job. If you've ever wanted a prompt enhancer, a captioner, or just a chat completion that hands its answer to the next node as a string, this is the bolt-on.

The pattern is mainstream at this point - an LLM in the graph rewriting a rough idea into a structured prompt, or describing an image for captioning - our llm-in-comfyui doc covers the whole genre. The usual reason people prefer a local LLM for this is that it's uncensored and free per call; here you're trading that away for a frontier model with zero VRAM cost. Fine trade if you're already paying for Vertex anyway.

How it works

It POSTs your prompt to the Vertex AI :generateContent endpoint and returns the concatenated text of the first candidate. Three things stand out in the code, and one of them is a genuine trap:

  • It's OAuth-only. Unlike the image node, there is no API-key path here - the text generator always resolves a service account or falls back to Google's default credentials (the GOOGLE_APPLICATION_CREDENTIALS environment variable). If you only set an API key in VertexAIAuth, this node will fail with a default-credentials error. Service account or env vars, full stop.
  • The model dropdown is the image model list. This is the trap. The model_name choices come from the same cached model list as the image node - gemini-3-pro-image-preview, gemini-3.0-pro-preview, gemini-2.5-flash-image. But the node's default is gemini-1.5-pro-002, a text model that isn't in that list at all. So the dropdown won't contain the default, and whatever it does offer are image models. The fix is the custom_model_name input - type a real text model there (like gemini-1.5-pro-002 or a current gemini-2.5-flash) and it overrides the dropdown. It's an honest wart in the pack, and it'll cost you a baffling error if you don't know it's there.
  • Errors come back as text, not as exceptions. When a call fails, the node returns the error string in the text output instead of raising. Your workflow keeps running, and the failure silently becomes your output. If you ever wonder why your downstream nodes are digesting an Error: 403 message, this is why.

Inputs and outputs that matter

  • vertex_config - from VertexAIAuth (and it needs the service-account flavor, see above).
  • prompt and system_instruction - the conversation; the latter defaults to "You are a helpful assistant."
  • temperature (0–2), max_tokens, safety_filter_level (BLOCK_NONE is the default).
  • generation_config - optional; if you connect a VertexGenerationConfig, its temperature, safety settings, system instruction and response modalities are honored (though its maxOutputTokens and topP keys are not read here - an asymmetry with the image node worth knowing).
  • Outputs: text (STRING - wire it into a Show Text node or a prompt builder) and generation_config (a small dict of what was actually used).

Installing it

Shared with the whole pack: ComfyUI Manager → search comfyUI_Vertex_API, or

cd ComfyUI/custom_nodes
git clone https://github.com/linfen0/comfyUI_Vertex_API.git
cd comfyUI_Vertex_API
pip install -r requirements.txt

Restart ComfyUI. Dependencies are just google-auth, requests, pillow, numpy - nothing heavy, nothing local to download.

The honest take

For a quick "make this sentence cinematic" step inside a workflow you already have, this does the job. But the model-dropdown bug makes it fiddlier than it should be, and if your whole goal is an LLM in the graph, a local uncensored model is usually the better default - free per call, offline, no filtering. Reach for this when you specifically want a Gemini model's reasoning wired into your pipeline, and set custom_model_name first thing.

CategoryVertexAI

Inputs (9)

NameTypeDefaultDescription
vertex_configVERTEX_CONFIG
promptSTRINGExplain quantum physics in simple terms.
model_nameCOMBOgemini-1.5-pro-0023 options: gemini-3-pro-image-preview, gemini-3.0-pro-preview, gemini-2.5-flash-image
temperatureFLOAT0.70–2
max_tokensINT81921–1000000
safety_filter_levelCOMBOBLOCK_NONE4 options: BLOCK_NONE, BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, OFF
generation_configoptGENERATION_CONFIG
system_instructionoptSTRINGYou are a helpful assistant.
custom_model_nameoptSTRING

Outputs (2)

NameTypeDescription
textSTRING
generation_configGENERATION_CONFIG