Nodes/LlamaCPP β†’ Ideogram Prompt/πŸ¦™ LlamaCPP β†’ Ideogram Prompt
ComfyUI Node

πŸ¦™ LlamaCPP β†’ Ideogram Prompt

Your local LLM is now your prompt engineer for Ideogram 4

By iChristGitΒ·Created 3 months agoΒ·Updated 3 months agoΒ· 46
πŸ¦™ LlamaCPP β†’ Ideogram Prompt
    • ideogram_json
    • raw_response
    β—„user_ideaA surreal streetwear collage poster with a skateboarder and giant puffy letters spelling COMFYβ–Ί
    β—„aspect_ratio9:16β–Ί
    β—„modelβ–Ύβ–Ί
    β—„server_urlhttp://127.0.0.1:8082β–Ί
    β—„temperature0.60β–Ί
    β—„max_tokens8192β–Ί
    β—„unload_aftertrueβ–Ί
    β—„unload_wait_seconds3β–Ί
    β—„enable_thinkingtrueβ–Ί
    β—„thinking_budget4096β–Ί
    β—„always_rerunfalseβ–Ί
    β—„system_prompt_overrideβ–Ί

    Ideogram 4 refuses to be prompted like every other checkpoint you own. It was trained almost exclusively on structured JSON captions - bounding boxes, typed text elements, high_level_description fields - and plain prose underperforms badly. So the moment you load it you hit the same wall everyone hit in June 2026: how do you get from "a poster of my cat" to the half-page JSON blob it actually wants? This node is the lazy answer, in the best sense: type an idea, and a local LLM does the creative-directing and JSON-writing for you.

    It's the node the author used for the Ideogram 4 results he shared on r/StableDiffusion - no API, no key, nothing leaves your machine.

    What it actually does

    There are two ways to feed Ideogram 4 its schema. Kijai's KJNodes builder gives you a GUI canvas where you draw bounding boxes - maximum control, maximum fiddling. This pack takes the opposite route: it hands your short idea to a thinking-capable LLM in llama.cpp and lets it fill in the schema.

    Mechanically it's straightforward. The node POSTs to your llama.cpp server's /v1/chat/completions (default http://127.0.0.1:8082) with a built-in "you are a creative director" system prompt demanding a specific interpretation, strict JSON, and no hedge language. Your idea and the target aspect ratio ride along as the user message.

    The clever bits are in the cleanup. Because the pack recommends Qwen3 / DeepSeek-R1-style models, it sends thinking_budget_tokens per request so those models actually use their <think> block - you'll see reasoning-budget: activated, budget=4096 tokens in your llama.cpp logs. It then strips <think>...</think>, drops markdown fences, and re-serializes via json.loads so only clean, minified JSON survives. If parsing fails, it hands you the raw text with a warning. The whole thing is stdlib-only - no dependency tree to argue with.

    The inputs that matter

    Most fields you can leave alone. The three you'll touch:

    • user_idea - your short description. There's a placeholder default; replace it.
    • aspect_ratio - defaults to 9:16 and goes straight to the LLM. 1:1, 16:9, 2:3 - whatever the job wants.
    • model - a dropdown auto-populated from /v1/models. Reload the page to refresh it: the list is fetched at ComfyUI startup, and an offline server leaves you staring at "(server offline - reload page when server is running)".

    Keep unload_after at its default true - the node POSTs /models/unload and waits unload_wait_seconds (3) for VRAM to come back before diffusion runs. An LLM and Ideogram 4 fighting over one GPU is a guaranteed OOM on most consumer cards.

    always_rerun defaults to false, which means re-queueing an unchanged prompt skips the LLM entirely - you get the same JSON back. Flip it on when you want a fresh creative take every run. And thinking_budget (default 4096) is your quality dial - see below.

    Two outputs: ideogram_json (STRING) and raw_response (STRING). ideogram_json wires straight into Ideogram 4's CLIPTextEncode; raw_response exists for when the JSON comes back mangled.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/iChristGit/comfyui-llamacpp-ideogram
    

    Then restart ComfyUI - it appears under LlamaCPP / Ideogram (or search it in Manager). No Python dependencies to install.

    The real setup cost isn't the node, it's the stack around it. You need:

    1. llama.cpp server in router mode on port 8082 - the README's start-llamacpp.bat is llama-server.exe --port 8082 --router. Router mode matters: the node lists live models and unloads by id, which needs a server managing them, not one pinned to a model at launch.
    2. A thinking-capable GGUF. README-tested: unsloth/Qwen3.6-27B-MTP-GGUF and Qwen3.6-35B-A3B-GGUF. A 27B Q4 GGUF is a multi-gigabyte download and wants a decent chunk of system RAM to sit next to your GPU.
    3. Ideogram 4 itself - ideogram4_fp8_scaled.safetensors, the unconditional model, the qwen3vl_8b_fp8_scaled.safetensors CLIP, and flux2-vae.safetensors.

    Drag and drop example_workflows/ideogram4_t2i.json - it's the official ComfyUI Ideogram 4 txt2img workflow with this node swapped in as the prompt source.

    Where people get burned

    • The model dropdown says "(server offline...)" - your llama.cpp server wasn't up when ComfyUI loaded, or server_url is wrong. Fix it and hard-reload the page so the dropdown re-fetches.
    • OOM during diffusion - you turned unload_after off. Turn it back on and bump unload_wait_seconds to 5–10 if VRAM reclaim is slow.
    • forced end in your llama.cpp logs - the model hit its thinking budget before finishing. Raise it to 6144–8192 for text-heavy scenes; 1024–2048 is plenty for a simple product shot. natural end means it finished on its own - ideal.
    • Non-JSON garbage in the output - the node logs the cleaned text so you can see it; check raw_response, and try temperature near 0.3 for more disciplined JSON.
    • Same image every time you re-queue - that's caching, not a bug. Flip always_rerun on.

    The honest caveat: this is the set-and-forget path, and it gives up the one thing Kijai's builder offers - real layout control via hand-drawn bounding boxes. Need a specific composition? Use the GUI. And the reminder everyone forgets mid-hype: Ideogram 4 is non-commercial, so this rig isn't for selling renders.

    CategoryLlamaCPP / Ideogram

    Inputs (12)

    NameTypeDefaultDescription
    user_ideaSTRINGA surreal streetwear collage poster with a skateboarder and giant puffy letters spelling COMFYShort natural-language description of what you want to generate.
    aspect_ratioSTRING9:16Target aspect ratio passed to the LLM (e.g. 1:1, 16:9, 9:16, 4:5).
    modelCOMBOModel to use. Reload the page to refresh this list from the server.
    server_urlSTRINGhttp://127.0.0.1:8082Base URL of your llama.cpp server.
    temperatureFLOAT0.600–2Sampling temperature. Lower = more focused JSON output.
    max_tokensINT8192256–32768Max tokens including any thinking/reasoning tokens the model emits.
    unload_afterBOOLEANtruePOST /models/unload to free VRAM before diffusion runs.
    unload_wait_secondsINT30–30Seconds to wait after unload for the GPU driver to reclaim VRAM.
    enable_thinkingBOOLEANtruePasses thinking=true + budget_tokens to the API. Qwen3 / DeepSeek-R1 style models need this explicitly set or they skip the <think> block.
    thinking_budgetINT4096512–16384Max tokens the model may spend on internal reasoning (thinking budget). Only used when enable_thinking=True.
    always_rerunBOOLEANfalseOFF (default): ComfyUI's normal caching applies β€” the LLM is skipped when the prompt and settings haven't changed. ON: forces the node to re-execute every queue run, giving a fresh random JSON even when nothing has changed.
    system_prompt_overrideoptSTRINGLeave blank to use the built-in Ideogram system prompt.

    Outputs (2)

    NameTypeDescription
    ideogram_jsonSTRINGβ€”
    raw_responseSTRINGβ€”