Nodes/ComfyUI_FunCode/Any LLM FunCode
ComfyUI Node

Any LLM FunCode

The no-SDK LLM caller that lives off a .env file

By kaiery·Created 8 months ago·Updated about a month ago· 0
Any LLM FunCode
  • image
  • text
profile
api_base
api_key
model
seed0
system_prompt_select
system_prompt
user_prompt
temperature0.70
top_p1.00
max_tokens2048
timeout60

"Any" in the name is doing real work. Any LLM FunCode is a chat-caller that talks to any OpenAI-compatible endpoint - DeepSeek, Doubao, a local vLLM/Ollama bridge, whatever - and it needs no SDK, no local model, and no key baked into the pack. It reads its config from a .env file, and the whole HTTP request is built with Python's standard library. If you've ever fought an LLM node that hard-wired one provider, that's the selling point.

This is the same pattern the wider ecosystem settled on: a language model sits in your graph as a text tool upstream of the sampler - rewriting a rough idea into a structured prompt, captioning an image, writing dialogue - not the frozen text encoder inside the checkpoint. FunCode's take on it is an API node, so there's zero VRAM budget and nothing to download. The trade-off is the one every API path has: it can't do uncensored local work, and it sends your prompts (and any image you wire in) to whoever runs the endpoint.

How it works

On the backend it's refreshingly small: the node reads ComfyUI/custom_nodes/ComfyUI_FunCode/.env, auto-reloads it when the file's mtime changes, then POSTs a standard chat-completions payload to your base URL with a Bearer key. It appends /chat/completions for you if your api_base ends in /v1, /v2 or /v3. An optional image input gets base64-encoded to a data URL and sent as an image_url message - which only works if the model you chose is a vision model.

The inputs that matter

  • profile - a dropdown built from your .env: 默认配置 (default config), 自定义 (custom), plus any LLM_PROFILE_<id>_* entries you add. Handy for flipping between two providers without retyping keys.
  • api_base / api_key / model - type these in manually and they override the profile. Leave them empty to fall back to the .env values.
  • system_prompt_select - custom, or any .md/.txt file you drop in ComfyUI_FunCode/llm/system_prompts/ (the dropdown picks them up automatically).
  • user_prompt - the actual ask. This one's multiline and unavoidable.
  • temperature / top_p / max_tokens / timeout / seed - the usual sampling knobs, plus a 60-second default timeout you'll want to raise for slow reasoning models. Seed is passed through for the handful of APIs that honor it.

Output is a single text string. Wire it into a show-text node or straight into a prompt builder.

Installing

ComfyUI Manager → Install Custom Nodes → search "ComfyUI_FunCode", or:

cd ComfyUI/custom_nodes
git clone https://github.com/kaiery/ComfyUI_FunCode

Restart ComfyUI. Then copy .env.example to .env and fill in at least LLM_API_BASE, LLM_API_KEY and LLM_MODEL. The example ships pointing at Volcengine's Ark API (Doubao) plus a DeepSeek profile - the author's stack, not a requirement. There are no model files and the pack's only pip dependency is color-matcher, which this node doesn't touch.

Common issues

  • "ERROR: api_base and model are required" - the .env isn't where the node looks, or the api_base/model fields are empty with no .env fallback. Double-check the path: it's the pack root, not your ComfyUI root.
  • Image input does nothing - the model doesn't accept images. That's server-side, not the node.
  • Editing .env doesn't show up - the reload-on-mtime logic handles new runs, but the profile dropdown refreshes when the node's input schema re-validates, so re-open or recreate the node.
  • It returns errors as normal text ("ERROR: TimeoutError: ..."), so a failed call won't crash the graph - it'll just quietly pass a helpful-looking string downstream. Worth remembering when you're debugging.

One honest caveat: this is a small, fresh pack (Chinese README, basically zero community footprint), so treat the "any" with the usual security sniff - read what a node does before feeding it keys. Here the source is short and it's just urllib against your endpoint, which is about as boring as an LLM node gets.

CategoryFunCode/LLM

Inputs (13)

NameTypeDefaultDescription
profileCOMBO2 options: 默认配置, 自定义
api_baseSTRING
api_keySTRING
modelSTRING
seedINT00–18446744073709550000
system_prompt_selectCOMBO1 options: custom
system_promptSTRING
user_promptSTRING
temperatureFLOAT0.700–2
top_pFLOAT1.000–1
max_tokensINT20481–8192
timeoutINT601–600
imageoptIMAGE

Outputs (1)

NameTypeDescription
textSTRING