Gemini 3 文本生成
Every other node in this pack is a fancier version of this one
- images
- video
- audio
- text
- thought_signature
- usage_metadata
This is the one to learn first, because almost everything else in the ComfyUI-Gemini-3 pack is this node with one knob turned up. Gemini3TextGeneration is a straight shot at Google's Gemini 3 text API from inside ComfyUI: you type a prompt, it calls gemini-3-pro-preview over the network, and hands the answer back as a string you can wire into anything. No GPU, no model download, no weights - the model lives on Google's servers and you pay per call.
Why reach for it? The LLM-in-the-graph pattern - a language model doing prompt work upstream of the sampler - is a settled part of ComfyUI. The difference here is that the model is a frontier API, not an 8B you loaded into VRAM (llm-in-comfyui.md). That buys you real reasoning quality, and costs you three things the local path doesn't: every prompt and image leaves your machine, the answer is metered, and Google's content filter refuses at the source. Those tradeoffs are the price of the category, not a bug in this node.
How it works
The node builds an HTTP request to Google's generateContent endpoint, with the key passed as x-goog-api-key. The API key resolution order matters: the api_key field on the node wins, then config.json in the pack folder, then the GEMINI_API_KEY environment variable. Leave the field empty and set the env var, and it just works.
The interesting internals are the optional inputs. This is the only basic node that takes media: images, video, audio, and a pdf_path string. Each gets base64-encoded and added to the request as inline parts - images become PNGs, audio becomes WAV (via scipy.io.wavfile, more on that below), video and PDF go as raw files. Set media_resolution to anything except "Auto" and the request is routed to Google's v1alpha endpoint, which is what unlocks per-media token budgets: up to 1120 tokens for a high-res image, 70–280 per video frame, and medium is the sweet spot for PDFs.
Inputs and outputs that matter
You will actually set three things: prompt, thinking_level, and temperature. thinking_level is high or low - high is the default and gives the real reasoning; low is for quick jobs where you want the answer in a couple of seconds. The pack's own advice: leave temperature at 1.0. Gemini 3 was tuned for it, and cranking it down is a documented way to get looping, degraded output.
max_output_tokens caps the answer (up to 8192), and system_instruction is a multiline string that behaves exactly like a system prompt.
Three outputs come back: text (the answer), thought_signature, and usage_metadata. thought_signature is the genuinely useful one - it's the model's compressed reasoning state, and feeding it into a later Gemini 3 call maintains context across API calls. usage_metadata is a JSON blob of token counts; wire it to a display node if you're budgeting calls.
Install
The pack needs no models - it's all API. Install via 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
Then restart ComfyUI and grab a free key from Google AI Studio. Set GEMINI_API_KEY (or paste the key into the node). Note the README's own clone command still says yourusername/ComfyUI-Gemini-3-2 - that's stale copy; use the URL above.
Common issues
- "API key is required" - the node returns this as its text output when no key resolves from field, config, or env var.
- Audio input errors -
encode_audio_tensorimportsscipy.io.wavfile, butscipyis not in the pack'srequirements.txt. If you feed this node audio and hit an import error,pip install scipyis the fix. - Thinking level errors - an early release hit Google's error 400 "Invalid thinkingLevel field" because the parameter was placed wrong; current code puts it inside
generationConfig.thinkingConfig, so update the pack if you still see it. - The response is a string, not conditioning. Feed
textinto an LLM/prompt node or a text display; it isn't a CLIPTextEncode replacement by itself.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Explain quantum computing in simple terms. | — |
| 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 |
| imagesopt | IMAGE | — | |
| videoopt | VIDEO | — | |
| audioopt | AUDIO | — | |
| pdf_pathopt | STRING | — | |
| media_resolutionopt | COMBO | Auto | 4 options: Auto, media_resolution_low, media_resolution_medium, media_resolution_high |
| max_output_tokensopt | INT | 819216–8192 | — |
| temperatureopt | FLOAT | 1.00–2 | — |
| system_instructionopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| thought_signature | STRING | — |
| usage_metadata | STRING | — |