## Why connect ComfyUI to Zegami

Generative-AI workflows produce **batches, not single images** — thousands of variations across seeds, samplers, CFG values, checkpoints, and prompts. Folder-scrolling doesn’t scale. With Zegami you get a visual grid of every output, filter and sort by any generation parameter, cluster by visual similarity (UMAP) to spot duplicates and outliers, and share a public link as the deliverable.

The integration has two halves:

1. The **Zegami Batch Export** ComfyUI node (open-source, MIT) that captures and uploads each generation.
2. The Zegami side: a **collection-scoped API key**, and the **Calculated** **Columns → From JSON path** tool that turns the captured workflow graph into filterable columns.

## 1. Create a target collection and a scoped key

1. Create a collection in Zegami (empty is fine — the node will fill it).
2. Open the collection’s **Settings → API access** tab.
3. Click **Generate ComfyUI key**. The key is **scoped to this collection only** — it can’t touch the rest of your account, so it’s safe to keep in a shared workflow file. Copy it now; it’s shown only once.

A scoped key is the recommended choice for ComfyUI. (You can also mint account-wide keys under [Account → API keys](/content/docs/account-and-api-keys/index.html), but those grant access to every collection you can reach.)

## 2. Install and configure the node

Install **ComfyUI-Zegami** from ComfyUI Manager (search “Zegami”), or clone `github.com/zegami/comfyui-zegami` into `ComfyUI/custom_nodes`. Video export also needs `ffmpeg` on your PATH.

Provide your key in priority order (the node never reads it from the workflow JSON, so shared workflows stay credential-free):

1. `ZEGAMI_API_KEY` environment variable (recommended)
2. `~/.zegami/config.json`: `{ "api_key": "zeg_…" }`
3. the node’s `api_key_override` input

## 3. Wire up and queue

Drop the **Zegami Batch Export** node inline anywhere — it passes `images` through, so it can sit before a Save node.

- Connect your decoded **images** to the `images` input (the primary path: each item in the batch becomes a separate collection item).
- For generative **video** (Wan / Hunyuan / LTX / Mochi), connect frames to the `video` input; the node encodes an MP4 and a poster thumbnail.
- Set `collection_id` to your collection’s id.
- Optionally set `tags` (e.g. a campaign or client name) and `notes`.

Queue the prompt. Switch to Zegami and your generations appear in the grid as the pipeline processes them. The node uploads on a background queue and never slows or breaks a generation — if Zegami is unreachable, your images are still saved locally.

## 4. Turn the workflow graph into columns

Every output carries its **full ComfyUI prompt graph** as an opaque `_comfy_json` field. To make parameters filterable:

1. Open the collection, go to the views panel and **Add calculated column**.
2. Switch to the **From JSON path** mode.
3. Use the **Suggested columns** chips — Zegami auto-detects common nodes (KSampler, LoraLoader, CheckpointLoaderSimple, CLIPTextEncode) and offers one-click columns for **seed, steps, cfg, sampler, scheduler, model, lora, and the positive/negative prompts**.
4. Outputs vary per model, so for anything off that list press **Discover from data**. Zegami samples your actual outputs, walks the JSON, and lists every field it finds — with the inferred type, how often it’s present ( **fill %**), how many distinct values it takes, and an example. Click a row to load it into the form and tweak it, or press **\+ Add** to add it directly.
5. Or extract any field by hand: pick the `_comfy_json` source column, enter a JSON path (e.g. `$.prompt.6.inputs.seed`), choose a type, and preview.

**Mixed workflows?** ComfyUI numbers nodes by an internal id that shifts when different graphs feed one collection, so the same field (e.g. `seed`) can live at a different path in each output. Discovery handles this: it groups by node **class** and builds a single column that reads the value wherever it lands (a `×N` badge marks columns merged across N node-ids), so one `seed` column works across every model in the collection. A fill % below 100% tells you a field only appears in some outputs.

All of these columns persist with the collection, so they re-apply every time it loads. Now you can filter by sampler, sort by CFG, group by checkpoint, or build a scatter plot of seed vs. any metric.

## 5. Triage, compare, and publish

- **Filter** by any extracted parameter to narrow thousands of outputs to the handful worth keeping ( [Filtering & search](/content/docs/filtering-and-search/index.html)).
- **Similarity / UMAP** surfaces near-duplicates and structural clusters — invaluable for auditing a LoRA or checkpoint training set.
- **Video** items show a play badge and duration in the grid; hover to preview (where supported), and open the inspector for full playback.
- **Publish** the curated view as a public, shareable collection ( [Sharing & publishing](/content/docs/sharing-and-publishing/index.html)) — the gallery itself becomes the client deliverable.

## Plan limits

There’s no hard per-collection item cap — your plan’s **storage** is the real ceiling (shown on **Organisation → Plan**, with a rough “≈ N images / N video clips” estimate). A studio pushing 10k+ video items should keep an eye on it; Team plans add metered storage beyond the included quota.
