Nodes/ComfyUI Browser/Dify Text Generator
ComfyUI Node

Dify Text Generator

Drop a hosted LLM into your graph and wire its answer into your prompt

By talesofai·Created 3 years ago·Updated 17 days ago· 675
Dify Text Generator
    • STRING
    dify_api_endpoint
    api_key
    query
    inputs_json_str

    LLM-assisted prompting went from a browser tab to a node, and this is the "call the hosted service" flavor: Dify Text Generator (DifyTextGenerator-Browser) talks to a Dify app's chat API and hands you back the answer as a plain STRING. Wire that straight into a CLIP Text Encode and your prompt is now being written by whatever LLM workflow you've built in Dify - no model running on your machine.

    What it's for

    Dify is an open-source LLM app platform - you build prompts, agents, and LLM workflows in a drag-and-drop UI, deploy them, and hit them over HTTP. It's genuinely popular with people who want a proper LLM pipeline (tool calls, branching, RAG) without building it inside ComfyUI. People post on r/comfyui asking how to get "a Dify-like thing" into their graphs; the common answer is a node like this one. It's a thin client: your Dify app does the thinking, this node just relays.

    The practical use is prompt engineering as a service. You keep the actual prompting logic in Dify - where you can iterate on it without touching the workflow - and ComfyUI just consumes the result. For tag-based models, Dify's LLM can be told to emit comma-separated booru tags; the output feeds directly into your prompt box.

    How it works

    On run, the node POSTs to your endpoint with:

    • Authorization: Bearer <api_key>
    • response_mode: blocking (it waits for the full answer rather than streaming)
    • inputs containing your query (or your custom JSON)

    It returns the answer field from the response as the node's STRING output. That's the whole mechanism - one HTTP call, no local model, no heavy dependencies. The source even clears HTTP(S) proxy settings before the call, a nod to people running ComfyUI on AutoDL-style cloud boxes where a proxy breaks local endpoints.

    The inputs that matter

    • dify_api_endpoint (required) - the full chat-messages URL of your Dify app.
    • api_key (required) - the app's API key from the Dify dashboard.
    • query (optional) - your input, sent as the app's query variable.
    • inputs_json_str (optional) - JSON that overwrites the query field if you need to pass multiple variables to the Dify app.

    One quirk straight from the code: inputs_json_str gets brace-wrapped by the node itself ("{" + inputs_json_str + "}"), so paste the inside of the JSON object without the outer { }. Paste full braces and the JSON will be malformed. It's weird, but it's the documented behavior.

    Install

    Same pack, same story:

    cd ComfyUI/custom_nodes && git clone https://github.com/talesofai/comfyui-browser
    

    or ComfyUI Manager → search comfyui-browser. Restart after. The node needs nothing beyond the pack's light requirements - but note it does not install Dify. Dify itself is a separate deployment (their Docker Compose stack, or their hosted cloud), and you need a working app with a chat endpoint before this node is useful.

    Troubleshooting

    Most failures are auth or plumbing. A 401/403 means the API key is wrong or the app isn't deployed for API access. A non-2xx response raises Request Dify Error: <body> - check that the endpoint is the exact chat URL and reachable from your ComfyUI machine (it's a server-side call, not from your browser). And remember the node expects Dify's {"answer": ...} response shape; if you point it at a random endpoint, it'll parse garbage.

    CategoryBrowser

    Inputs (4)

    NameTypeDefaultDescription
    dify_api_endpointSTRING
    api_keySTRING
    queryoptSTRING
    inputs_json_stroptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING