Nodes/ComfyUI_PromptStudio/Ideogram4-KoboldCPP
ComfyUI Node

Ideogram4-KoboldCPP

Rewrite Ideogram 4's JSON prompt, one region at a time

By tiko13·Created 2 months ago·Updated 5 days ago· 3
Ideogram4-KoboldCPP
    • json_output
    json_input
    additional_instructions
    model_profile
    style_preset
    style_modifier
    framing_preset
    framing_modifier
    thinking_modeDisabled
    embellishment_levelClean
    process_high_level_descriptiontrue
    process_backgroundtrue
    process_elementstrue
    seed_mode
    on_error
    pretty_jsontrue
    kobold_urlhttp://localhost:5001
    max_response_tokens0
    temperature0.25
    top_p0.80
    top_k40
    min_p0.00
    rep_pen1.05
    rep_pen_range360
    sampler_seed-1
    stop_sequence
    request_timeout120

    Ideogram 4 doesn't take a plain prompt - it takes a structured JSON object with a high-level description, a background description, and a list of bounding-boxed elements. Editing that by hand is miserable, and rewriting the whole thing in one LLM call bleeds details between regions. Ideogram4-KoboldCPP fixes both: it splits the JSON into fragments, rewrites each one in a separate local KoboldCpp request, and reassembles the structure with its boxes and types untouched.

    This is a niche node for a specific model. If you don't run Ideogram 4 weights (the 9.3B DiT whose whole claim to fame was best-in-class text rendering and JSON-only prompting - see the KB's ideogram-4 panel), you can stop reading here. If you do, this is the node that turns "make the background moodier" into a targeted, structure-preserving edit instead of a hand-edited JSON blob.

    How it works

    The node walks your JSON and rewrites these fields (each gated by a process_* switch, all on by default):

    • high_level_description
    • compositional_deconstruction.background
    • compositional_deconstruction.elements[*].desc - except elements whose type is "text", which are preserved literally because you don't want an LLM "fixing" your in-image text.

    Everything else - bounding boxes, element types, literal text elements, unknown keys, unselected fields - is passed through byte-for-byte. Crucially, the model only ever sees one prompt fragment at a time. It never sees the JSON structure, the field name, other regions, or the bounding boxes, which is how detail stays put instead of leaking across the image.

    The switches that matter:

    • process_high_level_description, process_background, process_elements - turn off any region you don't want touched.
    • seed_mode - Offset per field gives each rewritten fragment its own seeded dice roll; Same seed makes every field use the same seed.
    • on_error - Stop aborts the workflow if a fragment rewrite fails; Keep Original keeps the source fragment and continues.
    • pretty_json - formatted vs. compact output. Keep it on for readability.

    On top of that you get the full amplification control set: model_profile, style_preset, framing_preset, embellishment_level, thinking_mode, additional_instructions, and the usual KoboldCpp request knobs (URL, token allowance, temperature, penalties). Each fragment is rewritten using those same settings, so one style decision propagates consistently across the whole JSON.

    The single output is json_output (STRING) - feed it back into whatever reads Ideogram 4's structured prompt.

    Installing it

    Same pack, same install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/tiko13/ComfyUI_PromptStudio
    

    Restart ComfyUI, or install "ComfyUI_PromptStudio" via ComfyUI Manager. No pip dependencies - you need a local KoboldCpp server (default http://localhost:5001; Ollama and llama.cpp work too), and for KoboldCpp specifically, enable Use Jinja and restart so the chat-template rewrite works.

    Where people get burned

    • Malformed input JSON. The node expects the Ideogram 4 structured-prompt schema. If you paste something else in, garbage out - it won't invent the schema for you.
    • Expecting region coordination. Each fragment is rewritten blind. The node preserves structure on purpose; if you need the background to mention what's in the foreground, put that in additional_instructions.
    • Text elements changing. They won't - by design. If you want your in-image text reworded, this node is the wrong tool.
    • VRAM contention. Same as every KoboldCpp node here: on a single GPU the LLM and diffusion model share VRAM, and the shared-GPU handoff needs KoboldCpp Admin Mode + an Admin Directory. Multiple fragment rewrites mean multiple LLM calls per run, so give the handoff time to work.
    CategoryKoboldCpp

    Inputs (26)

    NameTypeDefaultDescription
    json_inputSTRING
    additional_instructionsSTRINGOptional extra guidance for each extracted prompt fragment.
    model_profileCOMBO3 options: General Natural Language, Tag-Based Anime Model, Tag-Based Photorealistic Model
    style_presetCOMBO118 options: None, Neutral, Casual Snapshot, Amateur Photography, Candid Photography, Tag Dense, +112
    style_modifierSTRINGOptional aesthetic/style guidance added to the selected style preset. Select None for modifier-only behavior.
    framing_presetCOMBO32 options: None, Selfie, Mirror Selfie, Candid Unaware, Close-Up Portrait, Medium Shot, +26
    framing_modifierSTRINGOptional framing/composition guidance added to the selected framing preset. Select None for modifier-only behavior.
    thinking_modeCOMBODisabledPrivate-reasoning limits: Minimal 200 tokens, Low 500, Medium 1000, and High uses the available context window.
    embellishment_levelCOMBOCleanControls how much each extracted prompt fragment is expanded or polished.
    process_high_level_descriptionBOOLEANtrue
    process_backgroundBOOLEANtrue
    process_elementsBOOLEANtrue
    seed_modeCOMBO2 options: Offset per field, Same seed
    on_errorCOMBO2 options: Stop, Keep Original
    pretty_jsonBOOLEANtrue
    kobold_urlSTRINGhttp://localhost:5001Base URL for the local KoboldCpp server.
    max_response_tokensINT00–8192Final-answer token allowance. Use 0 to use the profile default. Native reasoning receives an additional budget within the server context window.
    temperatureFLOAT0.250–5
    top_pFLOAT0.800–1
    top_kINT400–200
    min_pFLOAT0.000–1
    rep_penFLOAT1.050.5–3
    rep_pen_rangeINT3600–4096
    sampler_seedINT-1-1–999999-1 lets KoboldCpp choose a random seed.
    stop_sequenceSTRINGOptional stop sequences, one per line.
    request_timeoutINT1205–600HTTP timeout in seconds.

    Outputs (1)

    NameTypeDescription
    json_outputSTRING