Nodes/ComfyUI-YogurtNodes/Vertex AI Generate Text (Legacy)
ComfyUI Node

Vertex AI Generate Text (Legacy)

A Gemini text node that does either AI Studio or Vertex — your pick

By yogurt7771·Created 2 years ago·Updated 6 days ago· 3
Vertex AI Generate Text (Legacy)
  • history
  • text
  • history
  • thought
◄credentials►
◄project_id►
◄location►
◄api_key►
◄vertexfalse►
◄base_url►
◄model_namegemini-2.5-flash►
◄system_prompt—►
◄prompt—►
◄temperature1.00►
◄top_p0.00►
◄top_k0►
◄max_output_tokens65535►
◄retry_count1►
◄disable_safety_settingsfalse►
◄disable_system_promptfalse►
◄safety_levelBLOCK_NONE►
◄thinking_budget0►
◄chat_template<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->►
◄proxy_url►
◄seed-1►
◄thinking_levelOFF►
◄timeout0►
◄extra{}►

You've got a sampler that needs a good prompt, and you've got an idea that needs a writer. YogurtVertexAIGenerateText is the pack's general-purpose Gemini text node: feed it a system prompt and a prompt, and it returns generated text you can wire straight into a CLIP text encode. What makes it different from a dozen similar nodes is the auth flexibility - it can talk to Gemini through a plain AI Studio API key or through Google Cloud's Vertex AI, and you flip between them with a single toggle.

How it works

The model defaults to gemini-2.5-flash, a fast and cheap pick that's right for prompt work. The node goes through the google-genai SDK (the google-genai dependency in the pack's requirements) and outputs:

  • text - the generated response, a plain STRING
  • history - the conversation so far, for chaining turns
  • thought - the reasoning trace when the model is in thinking mode

Optional history input lets you feed a conversation back in for multi-turn work (the pack's YogurtHistoryBuilder exists for exactly that), and extra accepts a JSON string of extra request parameters.

The toggle that matters: vertex

This is the node's whole personality. Set vertex to false and it authenticates with api_key (a Gemini API key from Google AI Studio, optionally routed through base_url). Set it to true and it switches to the Vertex path: credentials (a GCP service-account JSON), project_id, and location instead. So this one node covers both routes that the pack's other Gemini nodes split across. Start with vertex off and an AI Studio key - it's dramatically less setup, and for prompt generation you don't need the GCP plumbing.

Inputs worth your attention

  • system_prompt (multiline) - how the model behaves. "You write high-quality Stable Diffusion prompts" is the kind of thing this is for.
  • prompt (multiline) - the actual ask.
  • temperature (default 1) - higher, more random; for prompt generation, values under 1 tend to give steadier results.
  • max_output_tokens (default 65535) - the cap on the reply.
  • thinking_budget (default 0) - 0 disables thinking; -1 means no limit. For creative prompt work, a small thinking budget can noticeably improve output without much latency cost.
  • seed (default -1) - set a fixed seed for reproducible text.

Where you'll use it

The obvious one: prompt augmentation. Generate a batch of prompt variations, feed them through YogurtStringSplit into a loop, and let the sampler churn through text the model wrote for you. Or the slightly more advanced pattern - an LLM "quality pass" that rewrites your raw idea into a structured prompt before it ever touches the CLIP encoder. Since the output is a plain STRING, it plugs into everything.

Installing it

Part of the Yogurt Nodes pack (YogurtNodes/LLM), installed once:

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

Or ComfyUI Manager, search "ComfyUI-YogurtNodes." Restart after. For the API-key path, set GEMINI_API_KEY or drop an api_key.json into custom_nodes/ComfyUI-YogurtNodes/yogurt_nodes/llm/ - the README documents the file format.

Common issues

Auth confusion is the theme. If you've set vertex true but left credentials empty, you get a cryptic Google error; if you've set vertex false but filled the Vertex fields, they're ignored. Check the toggle first, always. A blank text output usually means the request failed and retried - retry_count defaults to 1, so bump it if you're on flaky network. And since this sends your prompt to Google's servers, treat it like any cloud API: don't put anything you'd rather keep local into the prompt, and keep your API key out of shared workflows.

CategoryYogurtNodes/LLM/Legacy

Inputs (25)

NameTypeDefaultDescription
credentialsSTRINGCredentials JSON for accessing Vertex AI
project_idSTRINGGoogle Cloud project ID
locationSTRINGVertex AI location/region
api_keySTRINGAPI key for accessing Gemini API
vertexBOOLEANfalseUse Vertex AI for Gemini API
base_urlSTRINGBase URL for Gemini API
model_nameSTRINGgemini-2.5-flashGemini model name, default is gemini-2.5-flash
system_promptSTRINGSystem-level prompt that affects the overall conversation style
promptSTRINGMain prompt content input by the user
temperatureFLOAT1.00Sampling temperature, higher values produce more random outputs
top_pFLOAT0.000–1Sampling probability threshold, controls output diversity
top_kINT0Number of highest probability tokens to consider during sampling
max_output_tokensINT655350–2147483647Maximum number of tokens in the generated text
retry_countINT1Number of retries when request fails
disable_safety_settingsBOOLEANfalseWhether to disable safety settings, if true, the safety settings will not be set
disable_system_promptBOOLEANfalseWhether to disable the system prompt, if true, the system prompt will sent as a user prompt
safety_levelCOMBOBLOCK_NONESafety level for the generated text
thinking_budgetINT0-1–2147483647Thinking budget for the model, if set to -1, the model will not limit thinking budget, if set to 0, the model will disable thinking
chat_templateSTRING<-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user->Content template for the generated text
proxy_urlSTRING代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h
seedINT-1-1–2147483647随机种子,设置为-1时随机种子
thinking_levelCOMBOOFFThinking level for the model, if thinking budget is not 0, this parameter will be ignored
timeoutINT00–2147483647Timeout for the request in seconds, 0 means no timeout
historyoptHISTORY—
extraoptSTRING{}Extra parameters for the request, in JSON format

Outputs (3)

NameTypeDescription
textSTRING—
historyHISTORY—
thoughtSTRING—