Nodes/comfyui-mixlab-nodes/ChatGPT & Local LLM ♾️Mixlab
ComfyUI Node Runs on cloud

ChatGPT & Local LLM ♾️Mixlab

An LLM node for prompt-building right in ComfyUI

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
ChatGPT & Local LLM ♾️Mixlab
    • text
    • messages
    • session_history
    prompt
    system_contentYou are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible.
    modelgpt-3.5-turbo
    seed0
    context_size1
    api_urlopenai
    api_key
    custom_model_name
    custom_api_url

    Drop a large language model into the middle of your workflow. The obvious use is prompt engineering - you type a rough idea, the LLM expands it into a rich, detailed image prompt, and that flows straight into your CLIP encoder. But it's a general chat node, so it'll also caption, translate, summarize, or answer questions about text you pass it. Despite the name it isn't locked to OpenAI: it speaks the OpenAI API format, which means it also talks to a local LLM or any compatible provider.

    How it works

    It's a client for a chat-completions API. You give it a system_content (the instruction that sets the AI's behavior - "You are a prompt engineer, expand this into a detailed image description") and a prompt (your actual input), it sends them off, and returns the reply as text. That's the whole loop. The intelligence lives at whatever endpoint you point it at - OpenAI's servers, a Chinese provider, or LM Studio running on your own machine.

    The inputs that matter

    • prompt - your message to the model.
    • system_content - the standing instruction. This is where you shape the output. Want prompts, not prose? Say so here.
    • model - which model to call. Defaults to gpt-3.5-turbo; the list includes gpt-4o, the older GPT-4 variants, and some non-OpenAI names like qwen-turbo.
    • api_url - a preset picker for the endpoint: openai, api2d, Kimi, DeepSeek-V2, SiliconCloud. The last three are handy, cheaper (sometimes free) providers, a nod to the pack's Chinese user base.
    • api_key (optional) - your key for the chosen provider. Required for any cloud endpoint; leave it out only for a keyless local server.
    • context_size - how many previous exchanges the node remembers, for multi-turn chats. Default 1. For one-shot prompt expansion you can leave it low.
    • custom_api_url / custom_model_name (optional) - the escape hatch. Point custom_api_url at something like http://127.0.0.1:1234/v1 (LM Studio) or http://127.0.0.1:11434/v1 (Ollama) and name the model, and you're running a fully local LLM with no key and no bills.

    Outputs are text (the reply - the one you'll usually wire onward), plus messages and session_history for chaining or debugging conversations.

    Installing it

    Get the pack via ComfyUI Manager (search mixlab, install comfyui-mixlab-nodes, restart), or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/shadowcz007/comfyui-mixlab-nodes
    

    then install requirements and restart. The node itself needs no model download - but if you want the local route, you separately install and run something like LM Studio or Ollama and point custom_api_url at it.

    Common snags

    • 401 / auth errors. Wrong or empty api_key, or a key that doesn't match the api_url provider. The key and the endpoint have to belong to the same account.
    • Cloud calls cost money. OpenAI bills per token. If you're iterating a lot, a local model via custom_api_url is free after setup - worth it for heavy prompt-expansion loops.
    • Local endpoint refused. Your local server isn't running, or the port's wrong. Confirm the URL works in a browser/curl first, and remember the /v1 suffix.
    • Model name not recognized. If you're on a custom endpoint, set custom_model_name to exactly what that server expects - the dropdown's OpenAI names won't map to your local model.

    Nothing about this node is Mixlab-specific once it's talking - it's a plain OpenAI-format client, so any endpoint that honors that format will work, whether that's the real OpenAI, a reseller, or your own box.

    Category♾️Mixlab/GPT

    Inputs (9)

    NameTypeDefaultDescription
    promptSTRING
    system_contentSTRINGYou are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible.
    modelCOMBOgpt-3.5-turbo25 options: gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-4o, gpt-4o-2024-05-13, gpt-4, gpt-4-0314, +19
    seedINT00–18446744073709550000
    context_sizeINT10–30
    api_urlCOMBOopenai5 options: openai, api2d, Kimi, DeepSeek-V2, SiliconCloud
    api_keyoptSTRING
    custom_model_nameoptSTRING
    custom_api_urloptSTRING

    Outputs (3)

    NameTypeDescription
    textSTRING
    messagesSTRING
    session_historySTRING