SCG Ideogram4 Prompt Agent
Ideogram 4's JSON prompts, minus the JSON
- json_prompt
- width
- height
Ideogram 4 doesn't speak plain English. It was trained exclusively on structured JSON captions, so a normal sentence underperforms badly - you're expected to hand it hex color palettes, bounding boxes as [y_min, x_min, y_max, x_max], and typed text elements. That's a genuine superpower (precise layout control nothing else open does), and it's also a chore to type by hand. This node is the chore-killer: a full-screen drag-to-draw builder that opens over your ComfyUI canvas and turns the JSON authoring into something you do with a mouse.
It's the flagship of the scg_json_prompt_agent pack (shown as SCG Ideogram4 Prompt Agent in the node list, under SCG/Ideogram): a streamlined, agent-ified fork of the community "Okims JSON Editor" concept, sitting in the same niche as Kijai's KJNodes Ideogram prompt builder - which is how most people first met this model.
What you actually do with it
Open the node and the builder takes over the screen. On the left you compose the creative fields - medium, aesthetics, lighting, photo, subject, style, background - the pieces Ideogram 4 keys its conditioning on. Then you draw bounding boxes straight on the canvas: alt-drag to duplicate, double-click to rename, reorder layers, snap to grid. Pick a resolution with the megapixel + divisible-by selector. Everything stays editable, including the agent system prompts ("rulesets") and the JSON schemas under Agent Configuration.
You don't have to build all that from nothing. If you have a provider configured, the optional agents do the heavy lifting: Generate fields fills the creative fields from a prompt and/or reference image, Reprocess with instruction makes targeted edits without rewriting everything, BBox layout agent places labeled boxes for the scene you describe (capped at a configurable max), and Feeling Lucky chains prompt → fields → layout in one shot.
How it works
The node class itself is deliberately thin. It takes one json_prompt STRING - the JSON scaffold, with a sane default matching Ideogram's schema - parses an embedded render block for the chosen dimensions, strips that metadata so the output stays clean for the model, and emits three things:
json_prompt(STRING) - the structured prompt, render metadata strippedwidth(INT) andheight(INT) - computed from your megapixel/divisible-by pick
The actual editing happens in the builder iframe, and this is the part that surprises people: the iframe can't talk to ComfyUI directly, so the Workflow output tab does its queueing through the parent extension (web/okims_json_builder.js) over ComfyUI's websocket. Hit Run Workflow and it saves the current JSON into this node's widget, queues your open graph, and streams the render back with a progress bar - interrupt works too. Load as reference image pushes the last render back into the reference input (resized to ~0.5 MP) so the next pass builds on it. The on-deck prompt box holds the next round's text; Run it! clears the inputs (keeping any locked fields), loads that text, rebuilds the scene through the agent chain, then fires generation.
That width/height output pair is the one you'll actually wire somewhere - feed it into your Empty Latent so the sampler renders at the size you laid the boxes out for.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/SanDiegoDude/scg_json_prompt_agent.git
Then restart ComfyUI - the pack registers two small server routes at startup, and that only happens on a clean start. ComfyUI Manager works too if you search for scg_json_prompt_agent. There are no model files to download. For the common case (OpenAI-compatible endpoints like LM Studio, OpenAI, Grok, Gemini's OpenAI-compat URL) there's nothing extra to install - the agent calls are proxied through ComfyUI's bundled aiohttp. The only optional dependency is google-auth, needed solely if you configure a Vertex AI provider.
If you want the agents (rather than hand-drawing every box), you configure providers in a .env file in the pack directory:
cp .env.example .env
# AI_PROVIDER_<ID> = Label | model | base_url | api_key
AI_PROVIDER_GROK = grok-4.3 | grok-4.3 | https://api.x.ai/v1 | xai-...
The .env lives server-side and keys never reach the browser - the UI only ever sees provider id/label/model. Don't commit it. After editing, hit Refresh next to the provider picker to reload providers live.
Where people get burned
- The node must actually be in the graph you queue, or the builder has nothing to write into and the loop goes nowhere.
- Agent features need a provider; the manual box-drawing mode needs no API at all, no key, nothing. If the dropdown reads "no providers - edit .env", you skipped the
.envstep. - The builder caches the last render and on-deck prompt, so reopening it shows where you left off - that's a feature, not a ghost.
- Wire the final image through SCG Image Result (same pack) if your workflow's "last preview" isn't the render you want the output tab to show.
If you're after layout control over Ideogram 4 without hand-typing JSON, this is the node. And if you'd rather never open a full-screen editor at all, the same pack ships SCG Magic JSON BBoxer, which runs this whole chain headlessly.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| json_prompt | STRING | { "high_level_description": "", "style_description": { "medium": "photograph", "aesthetics": "", "lighting": "", "photo": "" }, "compositional_deconstruction": { "background": "", "elements": [] } } | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| json_prompt | STRING | — |
| width | INT | — |
| height | INT | — |