Nodes/ComfyUI-AI-CustomURL/Generate Text (AI CustomURL)
ComfyUI Node

Generate Text (AI CustomURL)

Put a real LLM inside your ComfyUI graph (no local model required)

By bowtiedbluefin·Created 10 months ago·Updated 10 months ago· 3
Generate Text (AI CustomURL)
  • image
  • text
  • full_response
base_urlhttps://api.openai.com/v1
api_key
modelgpt-4o
prompt
temperature1.0
max_tokens1024
system_promptYou are a helpful assistant.
advanced_params_json

Most of what you do in ComfyUI runs on your own GPU. This node is the exception on purpose: it calls a hosted LLM - OpenAI's gpt-4o by default, but really anything that speaks the OpenAI chat-completions format - and hands the answer back as a normal string you can wire into the rest of your graph. That's the whole point of the ComfyUI-AI-CustomURL pack: bridge the gap between "everything local" and the handful of things you genuinely can't run on a consumer GPU, like a frontier-class language model or Sora-grade video.

Why would you want an LLM inside a diffusion graph? Because prompt engineering becomes a node. Have the model write the image prompt, translate it, expand a tag list into a full scene description, or caption the image sitting on another wire - then feed the result into a CLIP text encoder. That's a workflow that used to require tabbing out to a browser and copy-pasting.

How it works

The node is a thin, honest wrapper. It builds a messages array from your prompt (plus an optional system_prompt), POSTs it to {base_url}/chat/completions, and pulls choices[0].message.content out of the response. No magic, no local inference, no model files - everything happens over HTTPS with your api_key in the Authorization header.

The genuinely interesting bit is the optional image input. If you connect an IMAGE from anywhere in your graph, the node base64-encodes it as a PNG data URL and sends it as a multimodal image_url content part - so this works as a vision node too. Caption your last generation, ask it to describe the composition, then chain that text straight back into the next prompt.

Outputs are two strings: text (the clean answer) and full_response (the entire pretty-printed API response, which is your debugging friend when a provider does something unexpected).

The inputs that matter

For a first run you only touch four of them:

  • base_url - default https://api.openai.com/v1. Swap it for https://openrouter.ai/api/v1, https://api.together.xyz/v1, or http://localhost:11434/v1 for a local Ollama.
  • api_key - your key. Best read from an env var (OPENAI_API_KEY) rather than typed into the node, because node values get embedded in saved workflow JSON.
  • model - gpt-4o by default, but with OpenRouter you can point it at Claude or Llama; with Ollama, llama3 or whatever ollama list shows you.
  • prompt - the actual ask.

temperature and max_tokens are the only sampling controls on the node itself; anything fancier (top_p, penalties, JSON mode) comes through advanced_params_json, typically fed by the Text Advanced Parameters node.

Installing it

ComfyUI Manager → search "AI CustomURL" → Install, then restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/bowtiedbluefin/ComfyUI-AI-CustomURL
cd ComfyUI-AI-CustomURL
pip install -r requirements.txt

No model downloads, ever - this pack is API-only. Its requirements.txt is just requests, aiohttp, pillow, numpy, torch, torchaudio, and opencv-python; most of those are already in your ComfyUI environment.

Common issues

  • 401 / auth error - wrong key, or the key lacks permission for the model. Also make sure base_url includes the /v1 if your provider's docs use that path.
  • "Model not found" - you typoed the model name, or it isn't available to your account. Providers like OpenRouter list every model on their site.
  • Nothing useful in text - check full_response; content filters and quota errors both show up there as structured JSON.

One honest caveat: this is a small, young pack (a single-author project, essentially zero community chatter about it as of writing). It's not the most feature-rich LLM node in the ecosystem - but it's one of the simplest, and it doesn't drag in a heavy local model just to write a sentence.

Categoryai_customurl

Inputs (9)

NameTypeDefaultDescription
base_urlSTRINGhttps://api.openai.com/v1
api_keySTRING
modelSTRINGgpt-4o
promptSTRING
temperatureFLOAT1.00–2
max_tokensINT10241–128000
system_promptoptSTRINGYou are a helpful assistant.
imageoptIMAGE
advanced_params_jsonoptSTRING

Outputs (2)

NameTypeDescription
textSTRING
full_responseSTRING