ComfyUI Node

LLM (fal)

Call Gemini, Claude, or GPT from inside ComfyUI

By gokayfem·Created 2 years ago·Updated a day ago· 203
LLM (fal)
    • output
    • reasoning
    prompt
    modelgoogle/gemini-2.5-flash
    system_prompt
    temperature1.0
    reasoningfalse
    max_tokens0
    custom_model_name

    Sometimes the missing piece in a workflow isn't another image model - it's a language model to write the prompt. LLM is a text node: it calls a hosted large language model through fal and outputs a string you can wire into any prompt input downstream. Turn a lazy "cat" into a richly detailed image prompt, summarize something, rewrite captions, generate variations - the text glue that makes the rest of your graph smarter.

    It's part of gokayfem's ComfyUI-fal-API pack (the same author made the popular VLM Nodes, so language-model-in-ComfyUI is well-trodden ground for them). Nothing runs locally; you're calling a hosted model and paying per token via fal.

    How it works

    You pick a model, give it a prompt (and optionally a system prompt), and it returns generated text. There's no local model weight, no GPU load - just an API round-trip. The output is a plain STRING, so it drops straight into the text input of a CLIP encoder, another fal node, or a text-template utility.

    The inputs and outputs that matter

    • prompt - your request or the text to transform.
    • model - the menu that matters: google/gemini-2.5-flash (the fast, cheap default), anthropic/claude-sonnet-4.5, openai/gpt-4.1, openai/gpt-oss-120b, meta-llama/llama-4-maverick, or Custom. Pick Gemini Flash for quick prompt expansion; reach for a heavier model when the task actually needs it.
    • system_prompt - set the behavior once, e.g. "You are a prompt engineer. Expand the user's idea into a vivid, detailed image prompt. Output only the prompt." This is where you get consistent, usable output instead of chatty filler.
    • temperature (0–2, default 1) - creativity dial. Lower for predictable rewrites, higher for variety.

    Two more: reasoning (a toggle that routes to reasoning-capable behavior and populates the second output), and, for model = Custom, custom_model_name to name any fal-hosted LLM, plus max_tokens to cap length (0 = model default). Outputs are output (STRING, the answer) and reasoning (STRING, the thinking trace when reasoning is on).

    How to install it

    Via ComfyUI Manager: search ComfyUI-fal-API, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gokayfem/ComfyUI-fal-API.git
    pip install -r ComfyUI-fal-API/requirements.txt
    

    No models download. Add a fal API key to config.ini under [API] (from config.ini.example) or export FAL_KEY=your_key, restart, and find it under FAL/LLM.

    Common issues & troubleshooting

    • Auth error. FAL_KEY not set. Fix and restart.
    • The output is chatty or wrapped in filler. Use the system_prompt to demand a clean result ("output only the prompt, no preamble"), and lower temperature for consistency.
    • Custom model does nothing. When model is Custom, you must fill custom_model_name with a valid fal-hosted LLM id, or there's nothing to call.
    • The reasoning output is empty. It only fills when reasoning is toggled on and the chosen model supports it.
    • Cost. It's a paid per-token call. Long outputs on a big model add up; cap max_tokens and prefer Gemini Flash for routine prompt work. The pack's result cache serves identical calls free (force_rerun bypasses).
    • Windows Portable. Missing fal-client? python_embeded\python.exe -m pip install fal-client.

    The best use is quiet and upstream: a small node that turns your one-line idea into a proper prompt before it ever reaches the image model. Set a good system prompt once and it pays off on every run.

    CategoryFAL/LLM

    Inputs (7)

    NameTypeDefaultDescription
    promptSTRING
    modelCOMBOgoogle/gemini-2.5-flash6 options: google/gemini-2.5-flash, anthropic/claude-sonnet-4.5, openai/gpt-4.1, openai/gpt-oss-120b, meta-llama/llama-4-maverick, Custom
    system_promptSTRING
    temperatureFLOAT1.00–2
    reasoningBOOLEANfalse
    max_tokensoptINT00–100000
    custom_model_nameoptSTRING

    Outputs (2)

    NameTypeDescription
    outputSTRING
    reasoningSTRING