# z-tipo-extension turns a prompt into Danbooru tags with a local LLM, and the repo name is a hack

> z-tipo-extension is a Stable Diffusion WebUI, Forge, and ComfyUI extension that runs TIPO or DanTagGen to expand a prompt into detailed tags or natural language. It is flexible about output format and sampling, and its ordering trick, an extra z in the directory name, is worth understanding before you install it.

**KohakuBlueleaf/z-tipo-extension** — A sd-webui extension for utilizing DanTagGen to "upsample prompts".

- Repository: https://github.com/KohakuBlueleaf/z-tipo-extension
- Stars: 641 · Forks: 53
- Language: Python
- License: Apache-2.0
- Published: 2026-10-21 · Updated: 2026-10-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/kohakublueleaf-z-tipo-extension

## Text presampling, which is a generation step before your generation step

The extension exists to do one thing: take a prompt you typed and make it richer before the image model sees it. The mechanism is described as text-presampling based on the KGen library, and the two models it can call are TIPO and DanTagGen.

TIPO, short for Text to Image with text presampling for Prompt Optimization, is an LLM model system designed for generating a detailed prompt from input tags or a caption. The project makes a distinction that matters in practice: unlike DTG, TIPO can handle both tags and natural language. In theory you can also design your own tag in linguistic form, and the example given is that long blue hair is an acceptable tag in TIPO and will not break the model.

DanTagGen, the Danbooru Tag Generator, is an LLM model designed for generating Danbooru tags with provided information. It aims to give the user a more convenient way to make prompts for a text to image model that is trained on Danbooru datasets.

So the output shape depends on the model you point it at, and the extension is the host for both rather than a model itself. The model card for DanTagGen carries more detail on the model architecture and training data, and there is a brief tech report for TIPO linked from the project page.

## The extra z in the repository name exists to control extension ordering

This is the detail that will save you an afternoon, and it is stated plainly in the project description. An extra z is added to the repo name to ensure this extension will run process() after other extensions.

In the Stable Diffusion WebUI extension model, each extension can hook into the prompt pipeline and rewrite what is sent to the sampler. If your prompt rewriting extension runs before the prompt upsampler, the upsampler sees the rewritten prompt. If it runs after, the upsampler sees the original text and its output may then be overwritten by the later extension. Neither order is wrong in general, but the difference decides whether the upsampling survives.

Alphabetical ordering of the extension directory makes the z prefix a crude but effective mechanism, and it is the kind of hack you only see spelled out when the author has lost an afternoon to it. It also has a consequence for anyone renaming the checkout: the directory name is load-bearing. The project configuration even keeps a lint rule for it, noting that the module name is the git repository directory, that renaming it would break every existing checkout and the Comfy registry entry.

That last point is worth repeating as a rule for your own setup. If you move or rename the extension folder, the ordering guarantee is gone, and the behaviour of your prompts can change without any obvious cause.

## Installing in three hosts, and the ComfyUI node path

There is no pip install line to copy, and each host has its own route.

For SD-WebUI and Forge, install it from the extension tab. After restarting the webui, a new natural language prompt text box appears under the positive prompt box, with a tipo accordion beside it. That layout is how you feed input to the upsampler and read its output.

For ComfyUI, clone the repository into the custom_node folder. After restarting comfyui, the TIPO node appears under the utils/promptgen category.

The ComfyUI path carries one dependency you must handle yourself. The project ships an example workflow in the examples folder, and to try it you need to download ComfyUI-Custom-Scripts into your custom_node folder as well. That is an external repository, fetched separately, and the example will not run without it.

The Python packaging reflects the same two hosts. The project metadata declares the package name as z-tipo-extension, version 2.0.3, and the dependencies as tipo-kgen and transformers:

```toml
dependencies = ["tipo-kgen>=0.3.1", "transformers"]
```

The registry metadata lists a publisher id of kblueleaf and a display name of z-tipo-extension, and the comment in the configuration says the entry is used by the Comfy Registry.

## Output format is a template with named slots for each tag class

The prompt format option decides the final shape of the generated prompt, and it is more configurable than a single default string. The default value is the recommended format of the Kohaku XL Zeta checkpoint.

The format is written as a template containing special slots, each of which the generator fills with a particular class of tag:

- `<|special|>` for 1girl, 1boy, 1other, and similar
- `<|characters|>` for character tags
- `<|copyrights|>` for copyright tags, which means the series name
- `<|artist|>` for artist tags
- `<|general|>` for general tags
- `<|meta|>` for meta tags, where highres, lowres, and absurdres all belong
- `<|quality|>` for score_xxx, masterpiece, best quality, and similar
- `<|rating|>` for safe, sensitive, nsfw, explicit, and similar
- `<|generated|>` for the generated natural language prompt
- `<|extended|>` for the extended natural language prompt

The extended slot has its own rule. If the natural language prompt is not provided, extended is filled with the generated natural language caption. If both extended and generated are present in the format but the natural language prompt is not provided, TIPO will generate two natural language prompts.

That is a subtle enough behaviour that it is worth reading twice. The template you write is not a decoration, it decides how many generations run and where each result lands.

## Length targets, ban lists, and the sampling settings that break determinism

The length options are given as explicit ranges rather than abstract sliders, which is helpful when you are trying to hit a checkpoint's expectations.

For tag length, very short is 6 to 17 tags, short is around 18 to 35 tags, long is around 36 to 53 tags, and very long is around 54 to 72 tags. Short or long is recommended. For natural language length, very short is 1 to 2 sentences, short is 2 to 4 sentences, long is 4 to 6 sentences, and very long is 6 to 8 sentences, with short or long recommended here too.

Ban tags is the blacklist of tags you do not want to see in the final prompt, and regular expressions are supported. This is the lever for stripping a concept out of the output rather than hoping it does not appear, and with regex support you can remove whole families of tags rather than exact strings.

The seed is the seed of the prompt generator. Because the extension uses temperature, top k, and top p sampling, the result is not deterministic unless you use the same seed, and -1 means a random seed. Temperature behaves as described: higher gives a more dynamic result, lower gives better coherence between tags. If you are iterating on a prompt and want to see what the generator itself changed rather than what the sampler rolled, fix the seed.

## Upsampling timing decides whether your other prompt extensions still matter

There are two positions for the upsampling step, and they sit relative to everything else in your pipeline.

After means the upsampling runs after other prompt processings, for example after dynamic prompts and wildcard expansion. Before means it runs before other prompt processings.

The choice is not cosmetic. If you run After, the generator sees the fully composed prompt including wildcards and dynamic prompt expansion, so its tags are chosen with that context. If you run Before, the generator works from your raw text and the other extensions process its output afterwards. Teams that use dynamic prompts heavily will get different results from each position, and the setting to change first when the upsampler seems to be ignoring parts of the prompt is the timing, not the length.

The extension also supports hot keys and an optional command line interface according to its own description, though it gives no flag names for either, so there is nothing to copy from the project text on those two points.

## Dependency handling that assumes a GPU machine, and a lint rule about not crashing the host

The dependency handling is unusual enough to be worth reading carefully, because it explains what you will see on first run.

The requirements file states that llama-cpp-python is intentionally absent, because it needs a GPU specific prebuilt wheel, and listing it there makes ComfyUI-Manager attempt a source build. Instead, the tipo_installer resolves and installs the right wheel on first node run. So the install of the inference backend is deferred to the first time you actually use the node, and the extension does it for you.

The declared requirements are otherwise minimal:

```bash
tipo-kgen>=0.3.1
transformers
```

The lint configuration also encodes a design principle that is worth knowing about as a user. The ruff configuration ignores BLE001, S110, and S112, with a comment stating that probing for an optional dependency or a package manager must degrade, never raise into the host app, and that a broken import should not take ComfyUI down. The same file notes that the Gradio with nesting mirrors the widget tree it builds, and that the lru_cache predates a rewrite.

In practice that means a missing optional piece should leave the extension inert rather than crash your whole ComfyUI session. It is a good instinct for an extension that runs inside somebody else's long lived process.

On maintenance, the last push was on 2026-10-03 and the repository has no GitHub releases, so there is no tagged version history to point at even though the package metadata carries version 2.0.3. The licence is Apache-2.0, which is permissive and appropriate for an extension that plugs into other people's applications.

## Conclusion

z-tipo-extension fits a Stable Diffusion or ComfyUI user who writes short prompts and wants the model to fill in detail tags, especially when the target checkpoint expects a specific tag ordering. It does not fit someone who needs deterministic output, since sampling with temperature and top k and top p means results vary unless the seed is fixed, and it is not a ComfyUI node you can drop into an existing graph without reading the example workflow. Before installing, check where your extension directory sits in the load order, because the z prefix exists specifically to make this extension run process() after other extensions, and it will not behave as expected if a later extension rewrites the prompt afterwards.

## FAQ

### How do I install z-tipo-extension in SD-WebUI and ComfyUI?

In SD-WebUI and Forge you install it from the extension tab, and after a restart a natural language prompt box appears under the positive prompt box. In ComfyUI you clone the repository into the custom_node folder, and after a restart the TIPO node appears under the utils/promptgen category.

### What is the difference between TIPO and DanTagGen?

TIPO is a text presampling model that can handle both tags and natural language, while DanTagGen generates Danbooru tags for models trained on Danbooru datasets. The extension can call either one.

### Why is there an extra z in the z-tipo-extension repository name?

The extra z makes the extension run process() after other extensions, so that prompt upsampling is not overwritten by a later extension. It is a naming convention that depends on the directory name, so renaming the checkout changes the load order.

### How do I stop unwanted tags from appearing in the generated prompt?

Use the Ban tags option, which is a blacklist of tags with regular expression support, so you can remove specific tags or whole families of them from the final prompt.

### Can the prompt upsampling be deterministic?

Only with a fixed seed, because the generator samples with temperature, top k, and top p. The Seed option sets the generator seed, and -1 selects a random one.

## Sources

- [Issues](https://github.com/KohakuBlueleaf/z-tipo-extension/issues)
- [KohakuBlueleaf/z-tipo-extension on GitHub](https://github.com/KohakuBlueleaf/z-tipo-extension)
- [License: Apache-2.0](https://github.com/KohakuBlueleaf/z-tipo-extension/blob/main/LICENSE)
- [README](https://github.com/KohakuBlueleaf/z-tipo-extension/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/kohakublueleaf-z-tipo-extension
