ComfyUI Node

ChatGPT _O

The old OpenAI loader — read the key from a file

By omar92·Created 3 years ago·Updated 5 months ago· 181
ChatGPT _O
    • OPENAI
    api_key_fileapi_key.txt

    ChatGPT _O is the legacy way this pack loads the OpenAI client for its advanced chain. Its whole job is to produce an OPENAI object that other nodes can consume - the old-style counterpart to the current load_openAI _O. It's listed under O/OpenAI/Advanced, and if you've loaded an old workflow you might see it demanding an api_key_file and wondering what file it wants.

    How it works

    Unlike the modern loader, which takes the key as a widget value, this node reads the key from a file. The api_key_file input is a file picker (default api_key.txt) that looks in your custom_nodes/ directory - so you'd put your key in a plain text file there, one line, no quotes. On run it sets openai.api_key and a hardcoded base_url (https://openai-cf.realnow.workers.dev/v1, a community Cloudflare-worker proxy) using the old module-level openai API, and returns the module object as the OPENAI output.

    Two things that should set off alarms:

    • It's the old openai.api_key = ... style of setup. OpenAI's Python SDK removed that module-level interface in 1.0, so against a modern install this loader can fail outright.
    • The key lives in a plain-text file in custom_nodes/. That's a credential-management pattern to be wary of - the pack's own current approach (key in config.json) is at least centralized.

    The current replacement

    The pack shipped a new loader for this exact role: load_openAI _O, which takes the api_key directly and lets you set base_url (defaulting to the same Cloudflare-worker proxy, but editable to any OpenAI-compatible endpoint). The chain to use today is:

    1. load_openAI _O - the client.
    2. Chat_Message _O ×2 - build system + user messages.
    3. combine_chat_messages _O - merge them.
    4. Chat completion _O - get the reply.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
    

    or ComfyUI Manager → search ComfyUI-QualityOfLifeSuit_Omar92, then restart.

    The honest take

    This node is a fossil. It's kept around so old saved workflows still resolve, but it fights the modern OpenAI SDK, uses a sketchy key-file pattern, and hardcodes a proxy endpoint you can't change. If an old workflow insists on it, swap it for load_openAI _O and move on. The only reason to keep reading is if you're debugging a workflow from 2023 - in which case, yes, that's what the api_key.txt reference means, and no, you shouldn't rebuild on it.

    CategoryO/OpenAI/Advanced

    Inputs (1)

    NameTypeDefaultDescription
    api_key_fileSTRINGapi_key.txt

    Outputs (1)

    NameTypeDescription
    OPENAIOPENAI