Nodes/ComfyUI-Gemini-3/Gemini 3 流式生成
ComfyUI Node

Gemini 3 流式生成

Streaming, with a ComfyUI-sized asterisk

By xuchenxu168·Created 10 months ago·Updated 10 months ago· 4
Gemini 3 流式生成
    • full_text
    • thought_signature
    • stream_chunks
    prompt写一篇关于人工智能的文章
    api_providergoogle
    api_key
    modelgemini-3-pro-preview
    thinking_levelhigh
    max_output_tokens8192
    temperature1.0
    system_instruction

    Let's be clear about what "streaming" buys you in ComfyUI, because it's not what it buys you in a chat app. Gemini3StreamingGeneration calls Google's streaming endpoint - streamGenerateContent?alt=sse - so the response arrives as chunks instead of one big payload. In a browser chatbot, that means token-by-token typing. In ComfyUI, a node either has finished or it hasn't; there's no live-updating canvas text as the tokens arrive. What the node actually hands you is the whole stream, collected: the full text, the thought signature, and a JSON blob of every chunk.

    So is it worth using over plain Gemini3TextGeneration? Marginally, and for a specific reason: you get stream_chunks, which the plain node can't give you. If your workflow wants the raw chunk-level data - for progress tracking, for a ticker, for measuring latency between first and last token - this is the node. If you just want an answer, the text generation node is simpler and identical in cost.

    How it works

    Same auth, same API-key resolution, same thinking_level / max_output_tokens / temperature / system_instruction inputs as the rest of the pack. The difference is under the hood: it hits the streaming variant of the endpoint and iterates the SSE response, accumulating text into full_text while watching for a thoughtSignature in any chunk. It also counts the chunks and serializes the whole array into stream_chunks as JSON.

    Inputs and outputs that matter

    • prompt - the thing you want written. Default asks for an article about AI.
    • thinking_level - high/low; defaults to high.
    • Optional max_output_tokens, temperature, system_instruction.

    Outputs:

    • full_text - the assembled response.
    • thought_signature - the reasoning context for chaining into a later call.
    • stream_chunks - JSON with total_chunks and the raw chunks array. This is the node's whole reason to exist; wire it somewhere you can inspect or log it.

    Install

    Same pack, same steps. 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

    • "Why isn't it showing text as it types?" - because ComfyUI doesn't render intermediate node output. The streaming happens on Google's side; your graph still waits for the node to return. Expecting a live chatbot feel is the one thing this node can't deliver.
    • The stream_chunks blob gets big - every chunk is serialized with full candidate structures. For a long output that's a lot of JSON sitting in a string; only wire it where you actually need it.
    • No media input - unlike the text generation node, streaming here is text-only. If you need streaming plus an image, you'll have to compose elsewhere.
    • Temperature stays at 1.0 - same pack-wide advice: Gemini 3 is tuned for it, and straying is how you get loops. If you were going to lower temperature for "stability," the streaming node is the wrong place to experiment.
    CategoryGemini3/流式

    Inputs (8)

    NameTypeDefaultDescription
    promptSTRING写一篇关于人工智能的文章
    api_providerCOMBOgoogle1 options: google
    api_keySTRING
    modelCOMBOgemini-3-pro-preview1 options: gemini-3-pro-preview
    thinking_levelCOMBOhigh2 options: high, low
    max_output_tokensoptINT819216–8192
    temperatureoptFLOAT1.00–2
    system_instructionoptSTRING

    Outputs (3)

    NameTypeDescription
    full_textSTRING
    thought_signatureSTRING
    stream_chunksSTRING