SCG Magic JSON BBoxer
Type a sentence, get a boxed Ideogram 4 prompt — no drawing required
- image
- json_prompt
- width
- height
- bbox_preview
The SCG Ideogram4 Prompt Agent builder is great until you want to generate without babysitting a full-screen editor. Ideogram 4 only really performs when you feed it its structured JSON - hex palettes, bounding boxes, typed text elements - and hand-drawing those boxes every iteration is a slog. SCG Magic JSON BBoxer is the pack's answer: the same agent chain the builder uses, running entirely server-side, no HTML overlay. You type a sentence, it returns a finished, box-laid-out Ideogram JSON prompt like any other node output.
It's a headless workhorse - the node you reach for when you want to queue batches, iterate unattended, or script this into a bigger graph.
How it works
The node runs a two-stage agent chain. Stage one is the global creative fields agent: it takes your prompt (plus an optional reference image) and produces the schema-enforced JSON - high_level_description, photographic, and style_description (aesthetics, lighting, photo, medium, color palette), and the compositional_deconstruction.background. Stage two is the bbox layout agent, which composes the scene into bounding boxes on a normalized 0–1000 canvas, fed directly from that creative JSON - no lossy prose re-summary between stages, which the source notes used to add a slow, lossy call. Every box is [y_min, x_min, y_max, x_max], same format Ideogram 4 itself expects.
All agent calls go through the pack's server-side proxy (POST /scg_prompt_agent/chat) to whatever OpenAI-compatible endpoint you configured in .env - OpenAI, Grok, Gemini's OpenAI-compat URL, a local LM Studio, whatever. Keys stay on the server and never reach the browser, which is a genuinely good posture for an LLM node. Dimensions are computed from the aspect ratio and megapixel inputs, snapped to a divisible-by-8 value, and the chain honors ComfyUI's interrupt so you can bail mid-run.
The inputs that matter
The full schema is longer than this, but a beginner sets a handful:
prompt- your sentence; drives the whole chain (creative fields + layout)provider- picked from the list your.envdeclaresimage(optional) - reference for style and box placement; boxes still conform to the canvas, not the image frameaspect_ratio/megapixels- control the canvas and the computedwidth/height.autosnaps to the closest ratio for the reference image, falling back to1:1with no imagemax_boxes- cap on how many layout boxes the agent may place (default 12)
Two toggles change the node's whole personality. bypass skips every agent call and passes prompt straight through to json_prompt - handy for feeding a hand-written JSON prompt through the same wiring. no_bbox_generation runs only the global creative agent and emits the fields with an empty elements list: a clean "prompt enhancement" mode where Ideogram places assets itself. The generate_color_hex_codes toggle (default on) drops hex palette instructions - useful for bbox-capable models that paint hex codes as literal text. Temperature and max tokens pass straight to the provider.
Then there's seed, and this is the trap: it does nothing to the output. The chain has no seedable RNG; the field exists purely so ComfyUI can cache the node. Set control_after_generate to fixed and Comfy reuses the cached result instead of re-running the agents - set it to randomize or increment to force a fresh pass. If you leave it at default and wonder why your queue re-runs the whole agent chain every time, this is why.
The outputs
json_prompt(STRING) - the finished Ideogram JSONwidth/height(INT) - computed render dimensions, wire into your Empty Latentbbox_preview(IMAGE) - a labeled overlay of the placed boxes on the reference image, or on a white canvas sized to the node settings when there's no image
That bbox_preview is worth a look before you trust a layout - boxes the LLM hallucinated show up as visual nonsense way faster than they show up in JSON.
Installing it
Same pack, same install:
cd ComfyUI/custom_nodes
git clone https://github.com/SanDiegoDude/scg_json_prompt_agent.git
Restart ComfyUI, then configure a provider:
cd scg_json_prompt_agent && cp .env.example .env
# AI_PROVIDER_<ID> = Label | model | base_url | api_key
Nothing to install for normal OpenAI-compatible endpoints - the calls ride on ComfyUI's bundled aiohttp. Only google-auth (for Vertex AI) is an optional dependency. No model files at all.
Where people get burned
- "⚠ no providers - edit .env" in the dropdown. The
.envis missing or has noAI_PROVIDER_*lines. Create it, and note that the first time you add a provider you need a full restart so the pack's server routes see it - later edits only need the Refresh button. - "Provide a prompt and/or a reference image." You left both empty. Give it one or the other.
- Truncated or empty output from Gemini. The flash/thinking models burn tokens on internal reasoning - keep
max_tokensat 8k+ or replies come back cut off. - Results changing on every queue run. That's the seed being random. Set it to fixed if you want reproducibility, or accept the cost and let it re-run.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| provider | COMBO | 1 options: ⚠ no providers — edit .env | |
| bypass | BOOLEAN | false | — |
| no_bbox_generation | BOOLEAN | false | — |
| generate_color_hex_codes | BOOLEAN | true | — |
| aspect_ratio | COMBO | auto | 30 options: auto, 4:1, 32:9, 3:1, 21:9, 19:9, +24 |
| megapixels | FLOAT | 1.000.01–100 | — |
| temperature | FLOAT | 0.700–2 | — |
| max_tokens | INT | 819264–32768 | — |
| max_boxes | INT | 121–50 | — |
| seed | INT | 00–18446744073709550000 | — |
| imageopt | IMAGE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| json_prompt | STRING | — |
| width | INT | — |
| height | INT | — |
| bbox_preview | IMAGE | — |