Vertex AI Generate Text
A Gemini text node that does either AI Studio or Vertex — your pick
- history
- text
- history
- thought
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 STRINGhistory- the conversation so far, for chaining turnsthought- 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.
Inputs (25)
| Name | Type | Default | Description |
|---|---|---|---|
| credentials | STRING | Credentials JSON for accessing Vertex AI | |
| project_id | STRING | Google Cloud project ID | |
| location | STRING | Vertex AI location/region | |
| api_key | STRING | API key for accessing Gemini API | |
| vertex | BOOLEAN | false | Use Vertex AI for Gemini API |
| base_url | STRING | Base URL for Gemini API | |
| model_name | STRING | gemini-2.5-flash | Gemini model name, default is gemini-2.5-flash |
| system_prompt | STRING | System-level prompt that affects the overall conversation style | |
| prompt | STRING | Main prompt content input by the user | |
| temperature | FLOAT | 1.00 | Sampling temperature, higher values produce more random outputs |
| top_p | FLOAT | 0.000–1 | Sampling probability threshold, controls output diversity |
| top_k | INT | 0 | Number of highest probability tokens to consider during sampling |
| max_output_tokens | INT | 655350–2147483647 | Maximum number of tokens in the generated text |
| retry_count | INT | 1 | Number of retries when request fails |
| disable_safety_settings | BOOLEAN | false | Whether to disable safety settings, if true, the safety settings will not be set |
| disable_system_prompt | BOOLEAN | false | Whether to disable the system prompt, if true, the system prompt will sent as a user prompt |
| safety_level | COMBO | BLOCK_NONE | Safety level for the generated text |
| thinking_budget | INT | 0-1–2147483647 | Thinking 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_template | STRING | <-system-> {{system_instruction}} <-/system-> <-user-> {{prompt}} <-/user-> | Content template for the generated text |
| proxy_url | STRING | 代理URL,格式: protocol://user:pass@addr:port,支持http,https,socks5,socks5h | |
| seed | INT | -1-1–2147483647 | 随机种子,设置为-1时随机种子 |
| thinking_level | COMBO | OFF | Thinking level for the model, if thinking budget is not 0, this parameter will be ignored |
| timeout | INT | 00–2147483647 | Timeout for the request in seconds, 0 means no timeout |
| historyopt | HISTORY | — | |
| extraopt | STRING | {} | Extra parameters for the request, in JSON format |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| history | HISTORY | — |
| thought | STRING | — |