Gemini 3 + Google搜索
Ground the answer in the live web, citations included
- response
- grounding_metadata
- usage_metadata
A frontier LLM's knowledge has a sell-by date, and after it passes, the model will confidently tell you things that stopped being true. Gemini3WithGoogleSearch fixes that the direct way: it enables Google's built-in search grounding tool on the call, so the model can actually look things up in real time and - crucially - tell you where it got the answer. The grounding_metadata output is a structured list of sources, which is the difference between "trust me" and "here's the link."
Reach for it when the prompt depends on current facts: latest news, live prices, model release dates, an event that happened after the training cutoff. In an image pipeline it's most useful as an upstream fact-checker - a node that verifies a claim before a prompt or a script is built on top of it. It's also the honest alternative to a raw LLM hallucinating a citation out of thin air; grounding makes the source auditable.
How it works
Under the hood it's a single generateContent call with a google_search tool attached to the request (tools: [Tool(google_search={})]). Google's backend decides when to search, grounds the response in the results, and returns a groundingMetadata blob on the candidate. The node extracts that and hands it back as JSON - groundingChunks (the source chunks) and groundingSupports (which parts of the answer map to which sources). The prompt's thinking level applies as usual, so with thinking_level high, the model reasons over search results rather than pattern-matching them.
Inputs and outputs that matter
prompt- ask for something time-sensitive. The default ("search the latest AI news") is a fine template.thinking_level- high/low; the standard two choices.max_output_tokens- optional cap, default 8192.
Outputs: response (the grounded answer), grounding_metadata (JSON of sources - wire it to a text display if you want the citations visible), and usage_metadata (token counts).
Install
Standard pack install. ComfyUI Manager (search "ComfyUI-Gemini-3") or:
cd ComfyUI/custom_nodes
git clone https://github.com/xuchenxu168/ComfyUI-Gemini-3
cd ComfyUI-Gemini-3
pip install -r requirements.txt
No models. Google AI Studio key via api_key field, config.json, or GEMINI_API_KEY.
Common issues
- No grounding metadata returned - the model doesn't always search; if the answer doesn't need fresh facts, it may skip the tool and
grounding_metadatacomes back empty. That's not a bug, but it means the answer wasn't grounded. - Search cost - grounded search isn't free on top of generation. If you only need citations on some runs, this node pays for search every run; the pack's structured output node lets you enable search only when you flip a toggle.
- Filtering still applies - search grounding doesn't change Google's content policy; this node can't be used to route around what the model refuses (external-api-nodes.md lays out why that's structural).
- Not a replacement for a dedicated web tool - the search is Google's built-in grounding, tuned for answering questions, not for scraping. If your workflow needs raw page content or structured scraping, this isn't that node.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 搜索最新的AI新闻 | — |
| api_provider | COMBO | 1 options: google | |
| api_key | STRING | — | |
| model | COMBO | gemini-3-pro-preview | 1 options: gemini-3-pro-preview |
| thinking_level | COMBO | high | 2 options: high, low |
| max_output_tokensopt | INT | 819216–8192 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| grounding_metadata | STRING | — |
| usage_metadata | STRING | — |