ComfyUI + Ollama Guide

Run Gemma 4 with Ollama in ComfyUI: Image-to-Prompt Workflow Guide (2026-06-05)

This guide turns Aiconomist's short video into a practical, safety-aware setup document: install a ComfyUI/Ollama bridge, run a local Gemma 4 vision-capable text model through Ollama, have it analyze a reference image, compress that analysis into an image-generation prompt, and feed the result into a Z-Image Turbo or Flux-style ComfyUI workflow.

Source video: 6:14Uploaded: 2026-06-05Guide updated: 2026-06-07Audience: intermediate ComfyUI users
1

What this workflow does

The workflow is not primarily an image model; it is a prompt-assistant layer inside ComfyUI. A local Ollama model reads your reference image, describes it, and rewrites the description into a concise prompt for a separate image-generation workflow.

Input

Reference image

Load a photo or generated reference image into the Ollama chat node. The model acts as a local vision/text analyst.

Middle

Gemma 4 via Ollama

Gemma 4 produces a cleaned, image-model-friendly prompt rather than a raw long caption.

Output

Z-Image / Flux-style generation

The generated prompt is connected to your positive prompt input, so the image model receives a structured prompt automatically.

Best use: reference-image prompting, AI-influencer character ideation, style transfer prompts, outfit/background variation prompts, and faster prompt iteration in local ComfyUI workflows.
2

Safety and use boundaries

Important: The source video discusses an uncensored/adult-capable model. This public guide preserves the technical setup while avoiding explicit prompt recipes. Use adult-capable models only for lawful, private, fictional, consenting-adult creative experimentation. Do not generate minors, real people without consent, non-consensual scenarios, harassment, impersonation, extortion material, or illegal/exploitative content.
  • Use fictional adult subjects only when adult capability is relevant.
  • Do not use coworker, student, celebrity, private-person, or family likenesses without explicit permission.
  • Do not upload sensitive source images to public services.
  • Review outputs before sharing and discard unsafe or unintended results.
  • Clearly label AI-generated media when shared.
  • Read the model page, license, and prohibited-use terms before downloading or using any uncensored/adult-capable model.
3

Prerequisites

Required

  • ComfyUI installed and able to launch.
  • ComfyUI Manager installed, or another method for installing custom nodes.
  • Ollama installed and running in the background.
  • An Ollama model that supports the behavior you want. For image analysis, choose a vision-capable model; confirm on the model page.
  • A working image-generation workflow such as Z-Image Turbo, Flux, or another workflow that accepts a positive prompt string.

Assumptions

  • The video uses Windows/PowerShell language, but the same Ollama concept works on macOS and Linux with the relevant terminal.
  • The exact model/tag shown in a video may change. Use the run command from the current Ollama model page rather than guessing.
  • If your image workflow requires specific checkpoints, CLIP/text encoders, or VAEs, install those separately before wiring the prompt assistant.
4

Setup steps from the video

0:42 1. Update ComfyUI first

Open ComfyUI, launch Manager, and update ComfyUI/custom nodes before installing new nodes. This reduces missing-node errors after loading the workflow.

0:52 2. Install the ComfyUI Ollama custom node

  1. Open Manager → Custom Nodes Manager.
  2. Search for ComfyUI Ollama.
  3. Install the node package.
  4. Restart ComfyUI after installation.

If multiple Ollama node packs appear, choose the one that provides an Ollama chat node and an Ollama connectivity/server node, or use the repository linked in Sources.

1:03 3. Install and start Ollama

  1. Install Ollama from the official download page.
  2. Launch the Ollama app/service.
  3. Confirm it is running before you try to pull or run a model.
# Optional terminal check
ollama --version
ollama list

1:16 4. Pull the model from its Ollama page

The video says to copy the run command from the Ollama model page and paste it into PowerShell/Terminal while Ollama is running. Because model names and tags change, use the current page's exact command.

# Pattern only — replace with the exact command from the model page
ollama run owner/model-name:tag

During source checking, current example pages included Gemma 4 and uncensored/adult-capable variants such as baytout3/Gemma-4-Uncensored-HauhauCS-Aggressive:e4b. Treat these as examples to verify, not universal recommendations.

2:03 5. Return to ComfyUI and add Ollama nodes

  1. Add an Ollama Chat node.
  2. Drag from its connectivity/server input and create/load the Ollama Connectivity node.
  3. Confirm the node points to your local Ollama server, usually http://127.0.0.1:11434.
  4. Select the downloaded Gemma 4/Ollama model in the model field.

2:24 6. Set keep-alive to protect VRAM

The video recommends setting keep_alive to 0 minutes if VRAM is tight. This unloads the language model after it generates text, leaving more VRAM for your image model.

5

Build the image-to-prompt workflow

  1. Add a Preview Text node. Connect the Ollama chat output to Preview Text first so you can see exactly what the language model is producing.
  2. Feed the reference image into the Ollama chat node. The video uses Gemma 4 as a vision-capable analyst. If your selected model cannot accept images, switch to a vision-capable Ollama model or a node pack that supports multimodal input.
  3. Add a system prompt. The raw image description is often too long for image models. The system prompt should compress the caption into a clean positive prompt.
  4. Load your image-generation template. The video uses a basic Z-Image Turbo template; a Flux-style workflow can also work if it accepts a positive prompt string.
  5. Connect text output to positive prompt. Route the Ollama chat text output into the generation workflow's positive prompt input.
  6. Leave a user prompt box available. Use it to request specific changes such as hairstyle, shot type, outfit, or background while preserving the core reference.
Success check: When you run the workflow, the Preview Text node should show a concise prompt, and the image-generation node should create an image based on that prompt.
6

Safe system-prompt pattern

The exact Patreon system prompt from the creator is not public in the video. Use a safe, non-explicit version like this as a starting point:

You are an image-prompt assistant for ComfyUI. Analyze the provided reference image and write one concise positive prompt for an image-generation model. Preserve the important visual identity, composition, camera angle, lighting, outfit, pose, environment, and style. Keep the output as a comma-separated prompt phrase, not a paragraph. Do not include policy discussion, analysis labels, or unsafe content. If the user asks for a modification, preserve the reference image's core identity and apply only that requested change.

Then use the user prompt field for small creative direction:

  • Preserve the character, but change the hair to long dark hair.
  • Make this read as a mirror selfie while preserving the outfit and room.
  • Turn this into a regular selfie with the same lighting and casual style.
  • Keep the character consistent, but change the background to a bright studio.
Do not use this guide to create explicit prompt recipes. If you experiment with adult-capable models, keep it lawful, fictional, consenting-adult, private, and compliant with model/platform terms.
7

Verify the workflow

  1. Ollama check: ollama list shows your model, and the Ollama app/service is running.
  2. ComfyUI node check: Ollama Chat and Ollama Connectivity nodes appear after restart.
  3. Connection check: The connectivity node points to the local Ollama server.
  4. Text check: Preview Text displays a short, clean image prompt.
  5. Generation check: The Z-Image/Flux workflow produces an image without missing-node, missing-model, or VRAM errors.
  6. Reference check: The output preserves the intended composition/style, but do not expect perfect identity without character LoRAs or identity-control tools.
8

Troubleshooting

  • Ollama model is not listed in ComfyUI: make sure Ollama is running, the model was pulled successfully, and ComfyUI was restarted after installing the custom node.
  • Connection refused or timeout: verify the Ollama server URL, usually http://127.0.0.1:11434, and confirm no firewall/VPN rule blocks local connections.
  • Missing custom nodes: update ComfyUI, reinstall the Ollama node pack, restart ComfyUI, and reload the workflow.
  • VRAM spikes or image model fails after prompt generation: set keep_alive to 0, reduce image resolution, use a smaller quantized Ollama model, or run the LLM on CPU/system RAM if supported.
  • Generated prompt is too long: tighten the system prompt: “Output one concise comma-separated positive prompt under 90 words.”
  • Image does not preserve the same face/character: this workflow improves prompt transfer, not identity lock. Use character LoRAs, reference adapters, IP-Adapter-style nodes, or identity-control workflows if exact consistency matters.
  • Mirror selfie or shot type is missed: put the shot type in the user prompt field, e.g., make this a mirror selfie.
  • Unsafe or unwanted content appears: add explicit negative prompts and safety instructions, review outputs before sharing, and switch to a safer model if needed.
9

Sources and reference links

Source notes: transcript fetched locally from the YouTube URL on 2026-06-07; description links and practical steps were preserved. Model examples were checked against current Ollama search/model pages, but readers should verify the exact model/tag/license before use.