π¦ LlamaCPP β Ideogram Prompt
Your local LLM is now your prompt engineer for Ideogram 4
- ideogram_json
- raw_response
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 to9:16and 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:
- llama.cpp server in router mode on port 8082 - the README's
start-llamacpp.batisllama-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. - A thinking-capable GGUF. README-tested:
unsloth/Qwen3.6-27B-MTP-GGUFandQwen3.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. - Ideogram 4 itself -
ideogram4_fp8_scaled.safetensors, the unconditional model, theqwen3vl_8b_fp8_scaled.safetensorsCLIP, andflux2-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_urlis wrong. Fix it and hard-reload the page so the dropdown re-fetches. - OOM during diffusion - you turned
unload_afteroff. Turn it back on and bumpunload_wait_secondsto 5β10 if VRAM reclaim is slow. forced endin 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 endmeans 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 trytemperaturenear 0.3 for more disciplined JSON. - Same image every time you re-queue - that's caching, not a bug. Flip
always_rerunon.
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.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| user_idea | STRING | A surreal streetwear collage poster with a skateboarder and giant puffy letters spelling COMFY | Short natural-language description of what you want to generate. |
| aspect_ratio | STRING | 9:16 | Target aspect ratio passed to the LLM (e.g. 1:1, 16:9, 9:16, 4:5). |
| model | COMBO | Model to use. Reload the page to refresh this list from the server. | |
| server_url | STRING | http://127.0.0.1:8082 | Base URL of your llama.cpp server. |
| temperature | FLOAT | 0.600β2 | Sampling temperature. Lower = more focused JSON output. |
| max_tokens | INT | 8192256β32768 | Max tokens including any thinking/reasoning tokens the model emits. |
| unload_after | BOOLEAN | true | POST /models/unload to free VRAM before diffusion runs. |
| unload_wait_seconds | INT | 30β30 | Seconds to wait after unload for the GPU driver to reclaim VRAM. |
| enable_thinking | BOOLEAN | true | Passes thinking=true + budget_tokens to the API. Qwen3 / DeepSeek-R1 style models need this explicitly set or they skip the <think> block. |
| thinking_budget | INT | 4096512β16384 | Max tokens the model may spend on internal reasoning (thinking budget). Only used when enable_thinking=True. |
| always_rerun | BOOLEAN | false | OFF (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_overrideopt | STRING | Leave blank to use the built-in Ideogram system prompt. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| ideogram_json | STRING | β |
| raw_response | STRING | β |