ComfyUI custom nodes for Ideogram 4.0.
Ideogram 4 only works with structured JSON captions. The usual workflow is:
Magic Prompt -> Generate -> Preview Image or Save Image
Pipeline Loader -> Generate
Magic Prompt turns a normal text prompt into the structured caption format. Generate runs the local Ideogram 4 model.
This repo is the ComfyUI wrapper only. Model weights are downloaded from Hugging
Face, and the core inference package is installed from
https://github.com/ideogram-oss/ideogram-4.
Download and drag this image into ComfyUI to load the example workflow:
Note: Ideogram 4 requires
torch>=2.11. Installing the requirements may upgrade the PyTorch already in your ComfyUI environment. If you depend on a specific CUDA build, install a matchingtorch>=2.11first so the upgrade does not replace it with an incompatible build.
Install ComfyUI-Ideogram4 through ComfyUI-Manager or the Comfy Registry. The
Python requirements are installed automatically.
Restart ComfyUI after installation.
Clone the node into custom_nodes:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/ideogram-oss/ComfyUI-Ideogram4.git ComfyUI-Ideogram4Install requirements in the same Python environment that runs ComfyUI:
cd /path/to/ComfyUI
source venv/bin/activate
pip install -r custom_nodes/ComfyUI-Ideogram4/requirements.txtStart or restart ComfyUI:
cd /path/to/ComfyUI
source venv/bin/activate # or however you normally launch ComfyUI
python main.pyOpen http://127.0.0.1:8188.
Remote machine Start with
--listen 0.0.0.0and forward port8188to your local machine. ComfyUI has no built-in authentication, so only do this on a trusted network or behind a tunnel/VPN — never expose it to the open internet.
After ComfyUI starts, set all credentials from one place:
Settings -> Ideogram 4.0 -> API Keys -> Manage API keys...
Fill the fields you need:
| Field | Purpose |
|---|---|
IDEOGRAM_API_KEY |
Required for the default Magic Prompt provider, ideogram. |
OPENROUTER_API_KEY |
Required for the Magic Prompt provider, openrouter. |
HF_TOKEN |
Required for the Hugging Face weight repo. |
Only the key for the magic prompt provider you choose is needed. You can use any node to generate the magic prompt. This node is provided for ease of use.
Keys are saved to custom_nodes/ComfyUI-Ideogram4/ideogram_config.json. The file
is git-ignored and is not embedded in workflows or output images. Settings
changes apply on the next run; you do not need to restart ComfyUI.
You can also create the config file by hand:
{
"IDEOGRAM_API_KEY": "your-ideogram-api-key",
"OPENROUTER_API_KEY": "your-openrouter-api-key",
"HF_TOKEN": "your-hugging-face-token"
}For headless or cloud setups, environment variables also work:
export IDEOGRAM_API_KEY=your-ideogram-api-key
export OPENROUTER_API_KEY=your-openrouter-api-key
export HF_TOKEN=your-hugging-face-tokenThe config file takes priority over environment variables.
The public weight repos are:
https://huggingface.co/ideogram-ai/ideogram-4-nf4https://huggingface.co/ideogram-ai/ideogram-4-fp8
If the weights are gated, open the selected Hugging Face repo in a browser while signed in and accept its terms once.
Create a token at https://huggingface.co/settings/tokens.
A read-only token scoped to the Ideogram repos is recommended.
This wrapper loads weights through the core ideogram4 package using the
Hugging Face cache layout.
By default, Hugging Face stores downloaded weights under:
~/.cache/huggingface
To use a different Hugging Face cache location, set HF_HOME before starting
ComfyUI:
export HF_HOME=/path/to/huggingface/cache- Add
Ideogram 4.0 Magic Prompt. - Type a normal prompt.
- Leave
magic_prompt_provideronideogram. - Leave
verify_jsonon. - Add
Ideogram 4.0 Pipeline Loader. - Pick
4.0 NF4for the first run. - Add
Ideogram 4.0 Generate. - Connect
Magic Prompt.expanded_prompttoGenerate.prompt. - Connect
Pipeline Loader.pipelinetoGenerate.pipeline. - Set the same
widthandheighton Magic Prompt and Generate. - Connect
Generate.imagetoPreview Image.imagesorSave Image.images. - Leave
sampler_preseton4.0 Default 20for the first run.
Use 4.0 Turbo 12 for faster results, or 4.0 Quality 48 for the highest
quality.
The first run may take longer while Hugging Face downloads the weights and the pipeline loads them into GPU memory.
Expands a plain prompt into the structured JSON caption format used by Ideogram 4.
Inputs:
prompt: your normal text prompt.width,height: target image size. Defaults to2048x2048; supported values are multiples of 16 from 256 to 2048, with aspect ratios up to 6:1. Use the same values on Generate.magic_prompt_provider:ideogramoropenrouter.ideogramis the default.openrouter_model: only used withopenrouter; leave blank forideogram.verify_json: checks the expanded prompt with the core caption verifier. Keep this on unless you are debugging raw OpenRouter output.
Output:
expanded_prompt
Notes:
ideogramusesIDEOGRAM_API_KEYand calls Ideogram's free Magic Prompt API.openrouterusesOPENROUTER_API_KEYand theopenrouter_modelvalue.- If Magic Prompt raises, image generation has not started yet. Fix the key, provider, model, or JSON issue first.
- You can queue Magic Prompt by itself to inspect the expanded JSON.
Loads and caches the Ideogram 4 pipeline.
Inputs:
model_weights:4.0 NF4or4.0 FP8.
Output:
pipeline
Notes:
- Loading a different weight type clears the cached pipeline first.
- Device, dtype, tokenizer, and internal Hugging Face paths come from the core
ideogram4package.
Runs the image model and returns a Comfy IMAGE. Connect it to Preview Image
or Save Image to view or save the result.
Inputs:
pipeline: connect fromIdeogram 4.0 Pipeline Loader.prompt: Magic Prompt output or hand-written Ideogram JSON.width,height: defaults to2048x2048; supported values are multiples of 16 from 256 to 2048, with aspect ratios up to 6:1.sampler_preset:4.0 Quality 48,4.0 Default 20,4.0 Turbo 12, orcustom.seed: generation seed.
Advanced inputs, used only when sampler_preset is custom:
num_stepsguidance_scalemustd
Plain text can be passed directly to Generate, but is not recommended. The model was trained on structured captions, so use Magic Prompt or JSON for normal use.
The named sampler presets come from the official
ideogram4.sampler_configs.PRESETS registry. Each one bundles a step count, a
per-step CFG guidance schedule, and the logit-normal noise schedule parameters
mu and std.
Named presets ignore the advanced custom fields. 4.0 Default 20 is the ComfyUI
default.
In the core code, guidance schedules are stored in loop-index order, where index 0 is the final sampling step. The table below writes the same schedules in run order: main sampling steps first, then the lower-guidance polish steps.
| Comfy preset | Official preset | Steps | CFG schedule | mu |
std |
Use |
|---|---|---|---|---|---|---|
4.0 Quality 48 |
V4_QUALITY_48 |
48 | 45 steps @ gw=7, then 3 polish steps @ gw=3 | 0.0 | 1.5 | Best quality |
4.0 Default 20 |
V4_DEFAULT_20 |
20 | 18 steps @ gw=7, then 2 polish steps @ gw=3 | 0.0 | 1.75 | Balanced |
4.0 Turbo 12 |
V4_TURBO_12 |
12 | 11 steps @ gw=7, then 1 polish step @ gw=3 | 0.5 | 1.75 | Fast generation |
custom |
custom | num_steps |
constant guidance_scale |
mu |
std |
Experiments |
For the named presets, gw means guidance weight. The final lower-guidance
polish steps are part of the official preset schedule; they are not an extra
ComfyUI step.
The custom defaults match the 4.0 Default 20 preset closely, but use a constant
guidance scale instead of the preset's per-step schedule:
num_steps=20
guidance_scale=7.0
mu=0.0
std=1.75
Generate shows the resolved settings on the node after it runs.
- Make sure the folder is
ComfyUI/custom_nodes/ComfyUI-Ideogram4. - Install requirements in the ComfyUI Python environment.
- Restart ComfyUI after installing or changing custom nodes.
- Check the terminal for
IMPORT FAILED.
Install the requirements in the ComfyUI environment:
cd /path/to/ComfyUI
source venv/bin/activate
pip install -r custom_nodes/ComfyUI-Ideogram4/requirements.txtFor local development only, you can also point at the core repo directly:
export IDEOGRAM4_REPO=/path/to/ideogram-4Set it before starting ComfyUI.
- Accept the Hugging Face terms for the selected weight repo in a browser.
- Set
HF_TOKENin Settings,ideogram_config.json, or the environment. - Make sure that account has access to the selected weights.
- Set
HF_HOMEto a cache location with enough disk space if the default disk is too small. - Watch the Pipeline Loader status text and terminal logs during first load.
- Try
4.0 NF4. - Stop other GPU jobs.
- Restart ComfyUI to clear cached models.
- For
ideogram, setIDEOGRAM_API_KEY. - For
openrouter, setOPENROUTER_API_KEYand enter anopenrouter_model. - If
openrouterproduces bad JSON, try a stronger model. - Turn off
verify_jsononly when you intentionally want raw OpenRouter output for debugging.
The ComfyUI node code in this repository is licensed under Apache-2.0.
The Ideogram 4.0 model weights are not covered by this license. The Ideogram 4.0 model weights are distributed under the Ideogram 4.0 Non-Commercial license on Hugging Face and require accepting the terms on the model page. Downloading or running the weights through this node is subject to the license specified on Hugging Face.