PotionUI Docs v0.3.0

preset.yml Reference

Everything a preset.yml manifest can declare: required fields, vars:, speed profiles, admin-set configuration, media, hardware guidance, and the LLM chat context block. See the Preset Authoring Guide for the file tree this fits into, Forms for form.yml/tabs/fields, and Pipelines for how pipeline.yml consumes everything declared here.

On this page

preset.yml reference#

The manifest is PresetManifest in src/features/presets/schema.py, validated with extra="forbid" — unknown top-level keys are rejected. Fields:

KeyRequiredTypeNotes
schemayesintMust be 1.
idyesstringMust match ^[A-Za-z0-9_-]{3,64}$ and be globally unique. Existing ids are DB-referenced — never change an id in place.
nameyesstringHuman-readable display name.
versionyesstringSemver, e.g. 1.0.0 (regex ^\d+\.\d+\.\d+(?:[-+].+)?$).
categoryyesenumOne of image, video, audio, 3d, utility.
engineyesstringThe protocol this preset's pipes speak: native (in-process diffusers pipes) or comfyui (a ComfyUI server), or an engine contributed by a plugin. Scalar, not a list — a preset has exactly one engine. See Backends and Engines.
driverno (required when engine: cloud)stringThe implementation of the engine this preset needs, written <engine>.<name> and starting with the preset's own engine, for example cloud.acme. Backends of any other driver are never offered to this preset, its model picker lists only models held by this driver's backends, and a model of another driver posted for it is refused. Leave it out for engines with a single driver. preset_lint reports a malformed or missing driver as an error and a driver that is not registered on the instance being linted as a warning (enable the plugin and restart). See Cloud Models and Generation Routing.
tagsnolistFree-form strings (default []).
medianomappingCover image + example gallery. See Preset media.
varsnomappingPreset-wide constants, read in pipeline.yml as {{ preset.vars.<name> }}.
speed_profilesnomappingNamed generation profiles (e.g. draft/standard/max), read via get_speed_profile(). See Speed profiles.
formulasnomappingThe groups of form settings a user may save as a formula, in display order. See Formulas.
llmnomappingPreset/family-level prompting guide + chat-workspace context knobs. See LLM context.
requiresnomappingOptional VRAM/RAM guidance shown at preset-choice time. See Hardware requirements.
configurationnomappingAdmin-set knobs the preset exposes. See Configuration (admin-set).
requirementsnolistTyped requirements checked live against the instance. See Requirements.
negative_promptnomappingapplies_when: whether the preset takes a negative prompt. See When the negative prompt applies.
prompt_resourcesnomappingPer mode, the media picker fields a prompt may reference with @. See Prompt resources.
prompt_syntaxnomappingPer mode (or "*" for every mode), the inline prompt notation the model actually understands (speaker markers, weighting, BREAK, ...), highlighted in the segment editor and offered with /. See Prompt syntax.
modesyeslistNon-empty list of mode-name strings (each needs a modes/<name>/ dir).

Removed / rejected (do not use — they fail validation): a top-level form:, an inline description: (put prose in description.md), resolutions:, and the old list-valued supported_backends: (replaced by the scalar engine: — no compatibility shim). The modes: mapping-with-nulls form is gone — modes: is a plain list.

Real example (content/presets/marketplace/QwenImage/preset.yml):

yaml
schema: 1
id: "01K0W24A3RADXXABH16YQ7KF00"
name: "Qwen-Image"
version: "1.0.0"
category: "image"
engine: "native"
tags: ["qwen", "qwenimage", "local", "transformer", "text-rendering"]

vars:
  model_base: "QWEN_IMAGE"
  default_steps: 50
  default_cfg: 4.0
  num_lora_slots: 3          # referenced by an @loop in pipeline.yml

modes:
  - txt2img

vars.video_director (native and cloud video presets)

One vars: key gets its own document: a video_director block declares which Video Director composition modes (t2v/i2v/flf/director/chain) a native video preset supports, plus per-mode capability flags (director audio/IC-LoRA, chain per-segment LoRAs, keyframe limits) and defaults (fps, duration). See Video Director → Preset capability declaration for the full schema and worked examples. simple_modes in the same block turns preset modes into plain single-clip forms backed by the same pipeline (see Single-clip modes).

A cloud video preset adds model_field: "model": the chosen model's own capabilities (allowed clip lengths, start and end pictures, shot count) are then merged on top of the block for each request, so one preset follows every model it offers. See Video Director → Cloud presets.

vars.promptless_modes (modes that need no prompt)

Some modes are purely mechanical — upscale, slow-motion, restore — and ask nothing of the user in the prompt pane. List their mode names here and the UI hides the prompt pane entirely for those modes and drops the "prompt required" check on the Generate button:

yaml
vars:
  promptless_modes: [upscale, slowmo]

An entry can also be a mapping that makes a mode promptless only for some form values, with when in the same shape as a reaction condition (a single condition, a list, or a logic group):

yaml
vars:
  promptless_modes:
    - mode: "control"
      when: { field: "guide_only", equals: true }

It's a pure UI hint (read from preset.vars.promptless_modes on the frontend); the backend needs no schema change and rejects nothing when the prompt is empty. A promptless mode's pipeline.yml must not read generation.prompts — with no prompt submitted, the array is [{positive: '', negative: ''}], so generation.prompts.first is {'positive': '', 'negative': ''} and any per-image expansion yields empty strings rather than failing. If a mode legitimately needs a prompt, leave it out of this list; if it takes one but does not require it, use optional_prompt_modes.

vars.optional_prompt_modes (modes where the prompt is optional)

Some modes take a prompt but do not need one — a talking-head mode whose text only steers the result. List them here and the prompt pane stays fully visible (segments, phrasebooks, variables), but Generate no longer waits for prompt text. The entries have the same shape as promptless_modes, including the when condition:

yaml
vars:
  optional_prompt_modes:
    - "talk"
    - mode: "restyle"
      when: { field: "restyle_task", in: ["colourise", "restore"] }

A mode listed in both promptless_modes and optional_prompt_modes is promptless. It is a UI hint like promptless_modes; the backend rejects nothing when the prompt is empty. The prompt can be read by the pipeline, but with nothing written generation.prompts.first is {'positive': '', 'negative': ''}, so the pipeline must handle an empty prompt.

vars.retired_modes (modes a preset no longer has)

When a release removes a mode, saved data and API callers may still name it. List the old mode and the mode that replaced it, and every refusal for the old name says so instead of only saying the mode does not exist:

yaml
vars:
  retired_modes: { long: video }

A generate call, a form lookup or an MCP start_generation naming long is answered with No form configuration found for mode 'long' in preset '<id>'. Mode 'long' was replaced by 'video' (HTTP 404, error form_not_found). A plugin preset_extensions entry that lists a retired mode is applied to its other modes and the retired one is skipped with a log line, instead of the whole extension being rejected. The entry is only a message and a tolerance: nothing is converted, because the replacement takes a different form.

What the prompt is for (prompt_label, prompt_placeholder)

A mode that mixes form fields with a prompt should say what the prompt is for. Exact strings (text to draw on an image, words to speak) belong in form fields, because the prompt pipeline would rewrite them; the prompt is always the free description around them. Declare the copy in the mode's own modes/<mode>/form.yml:

yaml
prompt: "optional"
prompt_label: "Placement and style"
prompt_placeholder: "in white capitals at the top"
  • prompt_label replaces the word "Prompt" above the prompt box. An optional prompt shows "
  • prompt_placeholder is the example shown in the empty prompt box. Write it as an example of what to type, not an instruction.
  • prompt: is required (the default), optional or none, the same values a plugin-contributed mode uses. For a core mode, prompt: optional / prompt: none has the same effect as listing the mode in optional_prompt_modes / promptless_modes; use those vars lists when the requirement depends on a field (when). none hides the prompt box, so a label on it is never shown.
  • The loader writes the copy to vars.prompt.modes.<mode>.label and .placeholder, next to segment_templates, and PotionAI is told what the prompt box is for in that mode.
  • preset_lint.py rejects a prompt: value other than required, optional or none, a label or placeholder that is not a non-empty string, and warns when either is set on a mode with no prompt.

Prompt segment templates

A vars.prompt block can declare Segment Templates the segment picker offers alongside a user's own saved templates — a curated starting structure for the prompt (e.g. MiniMax H3's recommended sections). They're read-only in the UI: applying one copies its segments into the editor, never writes to the database, and a preset-declared template can't carry chips (a preset has no way to know a user's phrasebook).

yaml
vars:
  prompt:
    segment_join: "paragraph"          # unrelated key, same vars.prompt namespace
    segment_templates:                 # applies to every mode unless overridden below
      - name: "H3 — full structure"
        description: "MiniMax H3's recommended prompt sections"
        tags: ["minimax-h3"]
        segments:
          - name: "Scene description"
            prefix: "integrated_multimodal_description: "
            content: ""
          - name: "Soundscape"
            prefix: "overall_soundscape: "
            content: ""
    modes:                             # optional — per-mode override
      refs:
        segment_templates: [ ... ]     # REPLACES the flat list for this mode only

Each segments: entry is a plain RichSegment (src/features/segments/dto.py): name, content, prefix, suffix, enabled, color, description — chips is not allowed.

vars.prompt.modes.<mode>.segment_templates, when present, replaces the flat vars.prompt.segment_templates list for that mode only — a flat replace, not a merge. A mode absent from modes: falls back to the flat list; a mode present with an empty list means "no preset templates for this mode," not "fall back to the flat list." segment_join (the enabled-segment separator) shares the vars.prompt namespace but is unrelated to templates.

scripts/preset_lint.py soft-checks the declaration (unknown shapes, missing name/segments, a disallowed chips/type, or a modes.<key> naming a mode the preset doesn't declare) but vars: itself stays untyped — a malformed template silently renders as nothing in the picker rather than failing preset validation.

Prompt resources

prompt_resources: lets the prompt reference items of a mode's media picker fields. The user types @ in a segment, picks one uploaded item, and the model receives the token its own prompt convention uses for that item. Keys are mode names; each entry maps one field, or one kind of a field that holds several kinds:

yaml
prompt_resources:
  refs:
    - field: "references"        # an image/video/audio/media field of this mode's form
      kind: "image"              # image | video | audio: the group in the @ picker
      label: "Pictures"          # optional group label
      token: "<Picture @>"       # @ becomes the item's 1-based position in the field
    - field: "references"        # the same field again, for its video items
      kind: "video"
      token: "<Video @>"

A field mapped once numbers every item in it. A media field that accepts several kinds can be mapped once per kind (MiniMax-H3's references holds images, videos and audio): each entry then covers only that kind's items, and @ is the item's position among the field's items of that kind. The marker carries no kind; it comes from the item's type, else its file extension.

An entry may also carry limit: (the most items of its kind a kit expansion adds to the field) and limit_total: (the most items of any kind in the field). Items already loaded in the field count against them, and a bare kit citation fills the field up to these limits and reports what did not fit. An entry without a limit takes the form field's own maximum for the mode (max_items, max_items_by_kind, or one item for a field that is not multi), so a kit can never put more items in a field than could be loaded by hand. Where neither exists a field takes at most 8 items from kits. Declare limit: explicitly when the model's maximum is below the form's.

An entry with a source: maps a field whose rows are bundles a prompt resource source reads, instead of a media picker. A source is registered by a plugin (manifest prompt_resource_sources:, see the plugin API) and names the field type it reads, usually a lora_picker; an unknown source fails validation. Map the field once per member kind, with the same tokens as the native references. A row's item key is its model value, and a row at strength 0 cannot be cited. Citing a bundle cites every member, once per copy, and the marker becomes every member's token (<Picture 3> <Audio 2>), numbered after every native item of that kind, which is where the generator packs it. Member kinds come from the source (GET /api/prompt-resources/sources/{source}/members?item=<item key>); an item the source cannot read fails the submission naming it. One field cannot mix sources.

A segment stores a reference as the marker @[<field>:<item key>] in its content, plus an entry in its resources map (beside chips), keyed by the editor's marker id: {"field": "references", "item_key": "storage/uploads/cat.png"}. The item key is the item's stored path: relative_path, else path, else url for an object item, or the string itself.

At submit, before prompt expansion, every marker in the positive and negative prompts becomes the field's token with @ replaced by the item's position in the field's current value, so reordering the pickers renumbers the prompt. Each field, and each kind of a field mapped per kind, counts on its own (<Picture 1> and <Video 1> can both exist). Text that already says <Picture 2> is left alone.

A marker whose field this mode does not map, or whose item is no longer in the field, stops the generation with the same 422 form_validation_failed response as any other form error, keyed by the field name. The form endpoint (GET /api/presets/{id}/form?mode=...) returns the mode's list as prompt_resources next to form_schema; an entry with a source also carries that source's source_label and source_badge.

scripts/preset_lint.py rejects a token without @, an unknown kind, a field mapped twice for the same kind, a kind the field's accepted_types leaves out, a mode the preset does not declare, a field no form of that mode has, a non-media field, and a kind that contradicts an image/video/audio field's type. Only map a token the model was trained on (see its llm: guide or model notes); leave a field out rather than invent one.

Prompt syntax

prompt_syntax: declares the inline notation a preset's own model was trained on — speaker markers, dialogue tags, section labels, attention weighting, BREAK — so the segment editor can highlight it and offer it through a / picker instead of the user having to memorize or copy it from the llm: guide. Keys are mode names, plus the optional "*" default; each entry is one token:

yaml
prompt_syntax:
  video:
    - token: "(S1)"                       # display name in the / picker
      kind: "marker"                      # label | marker | wrap | weight
      pattern: '\(S\d+(?:,S\d+)*\)'        # regex highlighting matches against; optional, defaults to the escaped token
      insert: "(S1)"                      # template inserted by the / picker; {} = selection/caret, {name=default} = an editable param
      help: "Stable speaker ID, established at first appearance"
      tone: "accent"                      # signal | success | warning | info | accent | danger | muted; omit to use the kind's default

The "*" key is a preset-wide default: every mode with a prompt field (a mode whose form.yml sets prompt: "none" gets nothing) that has no entry of its own uses it, so a mode added later inherits the family's notation without anyone remembering to list it. A mode's own entry replaces the default entirely, and <mode>: [] opts that mode out. A preset with no "*" key resolves exactly as before: a mode without an entry gets no syntax. scripts/preset_lint.py warns when a preset declares syntax for some modes, has no "*" default, and a mode with a prompt field has no entry of its own.

yaml
prompt_syntax:
  "*": [...]            # every mode without its own entry
  loop: [...]           # replaces the default for this mode
  remix: []             # no notation here

tone picks one of the design system's semantic colors. For a preset whose own notation calls for something the seven tones don't cover, color is an alternative: a hex color (#rgb, #rgba, #rrggbb or #rrggbbaa) or a lowercase CSS named color (e.g. "cornflowerblue"). tone and color are mutually exclusive - declaring both is rejected. Neither set falls back to the kind's default tone, same as today.

kind shapes how the / picker inserts the token: label and marker insert insert (or token) as-is at the caret; wrap and weight wrap the current selection in insert's {} when there is one, otherwise place the caret there, and select any {name=default} param so the user can type over it. kind: "weight" also derives its highlight tone from the parsed value instead of tone — above 1 warm/emphasis, below 1 cool/de-emphasis, exactly 1 muted — parsing , as a decimal separator the same way SDXL prompts do. The recommended pattern for an explicit (tag:1.2)-style weight is '\(([^()]+?):(\d+(?:[.,]\d+)?)\)'.

pattern must compile as a Python regex and must not rely on lookbehind (the frontend matches with it too, and lookbehind support isn't guaranteed there); insert must have balanced {}. scripts/preset_lint.py also rejects a mode the preset does not declare. Declaring the same token twice in one mode is rejected — give the second entry a different display token even if its pattern matches the same text.

Matching runs against the whole segment's text as one string, newlines included — a preset whose notation spans multiple lines (MiniMax-H3's <d>...</d> dialogue tag, which can wrap several lines of spoken text) writes [\s\S]*? rather than .*?: neither Python's re nor the frontend's JS regex makes . match \n by default, and this repo never relies on the s/DOTALL flag (the frontend engine can't be handed one through a plain pattern string), so [\s\S] is the one portable way to say "any character, including a line break." The segment editor's own highlight follows the same rule: a match that spans a line break decorates every line it touches, not just the one the caret happens to be on.

Speed profiles#

speed_profiles: is a top-level preset.yml mapping of profile name -> generation-knob overrides, letting a preset switch several settings atomically (e.g. a one-click "Draft" toggle that drops steps, disables true CFG, and swaps in a distilled LoRA all at once) instead of wiring each knob to its own form field and reaction. It's top-level, not per-mode, for the same reason vars: is: one preset.yml-wide bag every mode's pipeline.yml can read.

yaml
speed_profiles:
  draft:
    steps: 6
    guidance: 1.0
    shift: 5.0
    loras:
      - { file: "lightx2v.safetensors", weight: 1.0 }
  standard:
    steps: 28
    guidance: 5.0
  max:
    steps: 40
    guidance: 6.5
    sampler: "dpmpp_2m"
    schedule: "karras"

Each profile is SpeedProfile in src/features/presets/schema.py — a typed known-key whitelist (steps int, guidance float, shift float, sampler string, schedule string, loras a list of mappings) plus a free-form extra: mapping for forward-compat knobs that don't warrant their own key yet. A wrong-shaped known key (e.g. steps: "fast") is a real schema error. An unknown key (anything not in the whitelist and not nested under extra:) does not fail preset load — the linter warns about it instead (scripts/preset_lint.py), matching the "the whole preset shouldn't become unloadable over one soft mistake" philosophy media: and mode-file checks already follow.

Selecting a profile from a form

The selected profile arrives like any other form value — there's no separate selection mechanism. Give the user a select field listing the profile names:

yaml
# modes/txt2vid/tabs/generation.yml
- name: "speed_profile"
  type: "select"
  label: "Speed"
  default: "standard"
  configuration:
    options:
      - { value: "draft", label: "Draft (fast, lower quality)" }
      - { value: "standard", label: "Standard" }
      - { value: "max", label: "Max quality" }

Then consume it in pipeline.yml with the get_speed_profile(name) global (registered in src/platform/templating/processor.py): look up the selected name, then read whichever knobs the profile sets. There is no preset.speed_profiles direct dot access in the render context — it's a build error (see "Removed" under Template contexts) — get_speed_profile() is the recommended idiom for an EXPLICIT lookup because a missing profile name raises a clear error naming the preset and the profile, instead of a bare attribute error:

yaml
- name: "generator/txt2vid_wan22"
  enabled: true
  configuration:
    steps: "{{ get_speed_profile(form.speed_profile | default('standard'))['steps'] }}"
    cfg: "{{ get_speed_profile(form.speed_profile | default('standard'))['guidance'] }}"

Because each value above is exactly one {{ ... }} expression, it evaluates to its native type — steps arrives at the pipe as an int, not a string (see Exact expressions vs string templates).

get_speed_profile(name, default=...) also accepts an explicit default (e.g. {}) to suppress the error for an optional/experimental profile reference instead of failing generation.

generation.profile: the resolved-profile shortcut

Every knob a preset reads from a profile repeats the same get_speed_profile(form.speed_profile | default('standard'))[...] expression — generation.profile (a pipeline.yml context root, see Template contexts) is that exact lookup, already done once per build: the profile form.speed_profile names, or the first declared profile if the form has no speed_profile field/value (or its value doesn't name a declared one — speed_profiles: preserves YAML declaration order end to end, and SpeedProfile has no default:/is_default: marker to prefer instead), or {} if the preset declares no profiles at all — so generation.profile.steps fails loudly (StrictUndefined) exactly like any other missing key rather than silently. The two examples above rewrite to:

yaml
- name: "generator/txt2vid_wan22"
  enabled: true
  configuration:
    steps: "{{ generation.profile.steps }}"
    cfg: "{{ generation.profile.guidance }}"

Prefer generation.profile for the common case (read the profile the current request selected); reach for get_speed_profile(name) only to look up a profile OTHER than the resolved one, or to get the loud missing-name error generation.profile's silent first-profile fallback doesn't give you.

Rules

  • Known keys are typed and validated at schema (preset-load) time; unknown keys are a lint warning, not a load failure — put forward-compat data under extra: to silence it.
  • scripts/preset_lint.py also warns when a preset declares speed_profiles but nothing in its modes/ (no get_speed_profile() call, no generation.profile use, and no literal profile name) appears to reference them — a declared-but-unused block is almost always a mistake (a forgotten form field, or a leftover from a refactor).
  • loras entries follow the same {file, weight} shape used elsewhere in this doc (the @loop recipe) — consume them with an items:-based @loop in pipeline.yml, same as a lora_picker field's value.

Precedence: profile as baseline, form fields override

The idiom in every shipped preset that uses speed_profiles: is:

yaml
steps: "{{ get_speed_profile(form.speed_profile | default('standard'))['steps'] }}"

or, equivalently, using the resolved shortcut:

yaml
steps: "{{ generation.profile.steps }}"

Read this as the profile supplies the baseline value, and if the form itself has an explicit field for the same knob (e.g. an advanced-only steps slider under audience: advanced), that field's value is what actually reaches pipeline.yml — the profile only fills in what the form didn't ask the user for. Concretely: form.speed_profile | default('standard') (or, for generation.profile, whatever form.speed_profile names) resolves which profile is selected, and get_speed_profile(...)['steps']/generation.profile.steps is that profile's baseline steps. A preset that also exposes a real steps field should read that field with its own fallback sourced from the selected profile, not a hardcoded literal, e.g. {{ form.steps | default(generation.profile.steps) }} — so changing the profile still changes the effective value for a user who never touched the advanced steps field, while a user who did override it always wins.

Configuration (admin-set)#

configuration: is a top-level preset.yml mapping declaring admin-tunable knobs a preset exposes, e.g. restricting a model field's checkpoint options to a curated set of admin Tags. Unlike vars:/speed_profiles: (author-set, shipped with the preset), configuration: only declares the schema — key, type, label, description — the values are admin-set state, stored per installed preset, and edited through the admin API rather than the YAML.

yaml
configuration:
  checkpoint_tags:
    type: model_tags
    label: "Allowed checkpoint tags"
    description: "Only checkpoints tagged with one of these show up in the model picker"

Two types are supported: model_tags (value: a list of admin Tag IDs) and tag_categories (value: a list of {key, tags, label?, multi?, allow_custom?} category objects, consumed by the tags field's categories: "@config:<key>" indirection — see "Form fields" in forms.md). The type set is a small extensible registry (CONFIGURATION_TYPES in src/features/presets/schema.py) — an unknown type: is a schema error, same treatment as an unknown speed_profiles known-key mistake would get if it were typed instead of allowed.

Unlike model_tags, a tag_categories entry may also declare a default: — the shape-checked fallback used until an admin sets a real value (resolve_field_tag_categories in src/features/presets/configuration.py). An empty tag-ID list is a normal "no filtering" state for model_tags, but an empty category list would leave a tags field with nothing to render, so tag_categories ships a real vocabulary out of the box:

yaml
configuration:
  style_categories:
    type: tag_categories
    label: "Style tag categories"
    default:
      - key: "language"
        label: "Language"
        multi: false
        tags: ["English", "Japanese"]
      - key: "more"
        label: "More"
        multi: true
        tags: []

Admin API

  • GET /api/presets/{preset_id}/configuration → {"preset_id", "entries": [{"key", "type", "label", "description", "value"}]} — one entry per declared key, merging the preset.yml schema with stored values (value is null when the admin hasn't set it yet). Empty entries for a preset that declares no configuration: block — not an error.
  • PUT /api/presets/{preset_id}/configuration body {"values": {"<key>": <value>}} — admin-only, requires the preset be installed. Rejects unknown keys and type-invalid values (for model_tags: every ID must be an existing tag; for tag_categories: unique keys, tags lists of strings) as a single invalid_configuration error citing every problem found. A successful PUT merges into (not replaces) previously-set keys, and returns the same shape as the GET.

Values live in the presets table's configuration JSON column, keyed by the installed preset's YAML preset_id — see src/features/presets/configuration.py for the validation/merge helpers and operations.get_preset_configuration/set_preset_configuration.

@config:<key> indirection in form fields

A field configuration value can defer to a preset's stored configuration instead of a literal, via the string "@config:<key>". Today this is used by the model field's filter_tags: (see the model field reference above): restrict its options to models carrying at least one of the tag IDs stored under checkpoint_tags:

yaml
- name: "checkpoint"
  type: "model"
  configuration:
    model_type: "checkpoint"
    filter_tags: "@config:checkpoint_tags"

filter_tags accepts either this indirection or a literal tag-ID list. It's resolved to a concrete tag-ID list at form-schema time; a key the preset declares but an admin never set means no filtering (backward compatible with presets that never declare configuration: at all — an unset/empty stored value is a normal, expected state). Filtering itself is OR semantics — a model matches if it carries any of the listed tags, not all of them (contrast with the library picker's own multi-tag browsing filter, which requires all). The frontend passes the resolved list to GET /api/presets/{id}/models as any_tag_ids (comma-separated) to actually filter the option list.

A key the preset's configuration: block never declares at all — a typo, or @config: left over after the key was renamed — is a different, authoring-time mistake: PresetTemplateLoader. _validate_filter_tags_directives (src/features/presets/loader.py) walks every field's configuration.filter_tags and reaction then.set_filter_tags while building the preset template and fails the preset's LOAD, naming the preset, the field, the unknown key, and the declared keys — so a bad reference never reaches a running preset in the first place, rather than silently degrading to "no filtering" the way an unset (but declared) key does at serve time. So does any "@"-prefixed value that isn't "@config:..." — it's the only @ directive filter_tags/set_filter_tags ever accepted. scripts/preset_lint.py catches the exact same mistake independently, without booting the app, for the developer lint endpoint/CI; resolve_filter_tags (src/features/presets/ configuration.py), which actually resolves the value at form-schema-serve time, stays a pure, unconditional prefix match — by the time it runs, the value has already been validated at load.

Tag deletion is blocked while referenced

Deleting an admin Tag (DELETE /api/tags/{tag_id}) that's referenced by any installed preset's stored configuration values returns 409 with {"error": "tag_in_use_by_preset", "used_by": [{"preset_id", "preset_name", "key"}, ...]} instead of succeeding. There is no force flag — unset the tag from the preset's configuration first (PUT .../configuration with the tag ID removed from the relevant key), then delete it.

Preset media#

A preset can ship a cover (shown beside its name in the picker) and a gallery of examples (shown in its detail modal). Gallery entries carry the settings that produced them, so an example can show the prompt and seed behind the image.

yaml
media:
  cover: "public/cover.png"
  gallery:
    - src: "public/examples/turbo-1.png"
      caption: "Turbo defaults, 8 steps"   # optional
      prompt: "a lighthouse at dusk"       # optional
      seed: 12345                          # optional
      mode: "txt2img"                      # optional; must be a declared mode

Both media and every field except src are optional; a preset with no media: renders a neutral placeholder.

Rules

  • Everything servable lives under public/. A src must be a relative, forward-slash path whose first segment is public, with no .. segments. This is enforced by the schema, so a bad path fails preset validation.
  • Allowed extensions: .jpg, .jpeg, .png, .webp, .gif, .mp4, .webm. Video is permitted because category: video presets have moving examples. .svg is rejected — an inline SVG can carry script, and presets may be installed from a marketplace.
  • public/ is the only directory reachable over HTTP. preset.yml (preset root) and the option YAML under files/ are read server-side and are never served. Requests for them 404.
  • scripts/preset_lint.py additionally checks that each referenced file exists, warns when one exceeds 2 MiB or 4096 px on its longest side, and warns when a mode: is not declared in modes:. These are lint checks rather than schema checks on purpose: a renamed mode or a missing image should not make the whole preset fail to load.

Video covers

media.cover may be a short clip (.webm or .mp4) instead of an image, for presets whose output moves. Everywhere the cover appears (the preset picker and the chip on Generate, the Admin presets grid and detail, the media modal) it shows the first frame as a still and plays the clip, muted and looping, while the card is hovered or focused. On touch devices it plays while the card is at least half in view. Visitors who prefer reduced motion only ever see the still, and a clip that fails to load falls back to the still.

The still is the clip's first frame, rendered by the server (?size= on a video returns a JPEG poster), so no separate poster file is needed. Make sure the first frame looks good on its own.

SettingGuidance
FormatWebM (VP9) or MP4 (H.264). WebM is the safer choice for the widest playback.
Length4 seconds or less, authored as a seamless loop.
Size1.5 MiB or less; scripts/preset_lint.py warns above that for a video cover.
Frame16:9, around 640 px wide. Covers are cropped to fit like image covers.
AudioNone. Covers always play muted; strip the audio track.
yaml
media:
  cover: "public/cover.webm"

Serving

Assets are served by GET /api/media/presets/{preset_id}/{path}, optionally resized with ?size=small|medium|large (480 / 768 / 1024 px wide). Renders are cached on disk under storage/preset_media/ and keyed by the source file's mtime, so editing an image invalidates both the cache entry and the ETag. An unknown size is a 400. On a video, ?size= returns a JPEG poster of the first frame (this needs ffmpeg on the server); without size the clip itself is served with Accept-Ranges and byte-range support, so browsers can stream and loop it.

GET /api/presets returns only media.cover; the full gallery comes from GET /api/presets/{id}, so the list payload stays small.

Styles#

A preset can ship a curated set of styles — reusable prompt fragments that wrap the user's own prompt, each with a rendered preview. They live in an optional styles.yml file at the preset root, next to preset.yml:

yaml
preview:                                  # optional; see "Rendering previews" below
  prompt_prefix: "masterpiece, best quality, "
  negative: "worst quality, low quality, score_1, score_2, score_3, artist name"
  example_prompt: "a glowing potion bottle in tall grass beside a forest path, mountains in the distance"

styles:
  - id: "retro-90s-cel"                  # ^[a-z0-9-]+$, unique within the file
    name: "Retro 90s Anime Cel"
    category: "Anime"
    description: "Hand-painted cel animation look, muted colors, soft grain."  # optional
    prepend: "old, anime screenshot, "
    append: ", 1990s (style), retro artstyle, anime coloring, cel shading, film grain."
    negative: "3d, realistic, glossy"    # optional
    example_prompt: "a cat sitting on a windowsill at sunset"  # optional; overrides preview.example_prompt
    preview: "public/styles/retro-90s-cel.webp"  # optional; see "Rendering previews" below

Applying a style prepends/appends its prepend/append to the user's prompt and substitutes its negative for the negative prompt; example_prompt is only ever used to render the style's own preview, never shown to the user.

The top-level preview: block (prompt_prefix, negative, example_prompt, all "" when the block or a field is omitted) is a preset-author default applied only when rendering previews (scripts/preset_styles_render.py) — never by the picker, which applies a style's own prepend/append/negative/example_prompt unchanged. It exists so a preset with its own prompting conventions (e.g. Anima's quality tags and recommended negative) gets on-model previews without every style repeating that boilerplate, and so every style can render the same scene by default (a preview.example_prompt describing an interesting background, not a bare product shot) so only the style itself varies across the gallery: the rendered prompt is prompt_prefix + prepend + resolved_example_prompt + append, where resolved_example_prompt is the style's own example_prompt when it has one, else preview.example_prompt; the rendered negative joins the non-empty parts of [preview.negative, style.negative] with ", ".

Rules

  • Lenient loading. Unlike preset.yml/pipeline.yml/form.yml, a missing styles.yml loads as styles: [] (and preview: {prompt_prefix: "", negative: "", example_prompt: ""}) and a malformed one degrades the same way rather than failing the whole preset — styles are supplementary, not load-bearing for generation. Schema errors (bad id, duplicate id, missing required field), a style whose example_prompt resolves to empty from both itself and preview.example_prompt, and a preview: naming a file that doesn't exist are scripts/preset_lint.py / GET /api/developer/presets/lint errors, same rationale as preset media's file-existence checks.
  • preview follows the same asset rules as media — relative, under public/, one of the allowed extensions (see Preset media above); served the same way. (This is each style's own preview: field — the top-level preview: block is unrelated and never a file path.)
  • GET /api/presets returns styles: []; the full list comes from GET /api/presets/{id}, same gating as media.gallery. The list's example_prompt is always the resolved value (the style's own, or preview.example_prompt when it had none) — file_repository.preset_to_info fills it in, so the frontend never reasons about the fallback. prompt_prefix/negative are never sent to the frontend at all — they live only on PresetTemplate.styles_preview, read by the rendering script.

Rendering previews

Previews are rendered by a script, not an app endpoint — scripts/preset_styles_render.py runs one real generation per style — using the preset's default mode/form defaults with the prompt/negative/seed overridden (and the output count forced to 1) — downscales the first output image so its long edge is --long-edge px (default 320), saves it as public/styles/<id>.webp, and sets preview: in styles.yml for that style when it was unset:

bash
python scripts/preset_styles_render.py <preset-id-or-path> [--style id ...] [--long-edge 320] [--seed 1] [--force] [--steps N] [--resolution WxH]

A style whose preview file already exists is skipped unless --force. The script runs through an ephemeral database and file storage, so it never touches the maintainer's live database or gallery, and it never reloads or restarts anything — the running app picks up the rendered files on its own next preset reload or restart.

--steps/--resolution override the preset's own defaults, but only when its mode's form actually declares a field of that name (looked up through tabs/sections/rows, not just the top level — most presets' steps/resolution/quantity fields live several levels deep under a tab). The effective value used for each (the override, or "preset default" when the flag was omitted or the field doesn't exist) is printed once before any generation runs.

The script has no form of its own to pick model weights from, so it resolves them from the preset's tests.yml (see docs/presets/testing.md "Testing presets"): the first case's models: map, read-only against the live models table before anything else runs. A preset with no tests.yml, no cases, an empty models: map on its first case, or a model ref that isn't already present locally (the script never downloads) fails before rendering anything.

Formulas#

A formula is a saved subset of one mode's form settings (speed, size, LoRAs, ...) that a user reapplies in another session. formulas.groups in preset.yml is the catalog of groups a formula can hold; the form files assign fields to them with formula: (see Forms → Formula groups).

yaml
formulas:
  groups:
    speed:   { label: "Speed and sampling" }
    size:    { label: "Size", description: "Resolution and aspect" }
    loras:   { label: "LoRAs" }
    cache:   { label: "Step cache" }
    models:  { label: "Models", preselect: false }
KeyRequiredTypeNotes
labelyesstringShown in the save dialog.
descriptionnostringOne line shown under the label.
preselectnoboolDefault true. false means the save dialog never ticks the group by default; use it for model pickers, which differ between machines.

Declaration order is display order. A preset with no groups, or a mode whose form resolves to none, shows no Formulas control. scripts/preset_new.py scaffolds an empty groups: {}.

Reuse the shipped ids and labels for the same concept, so a group means the same thing in every preset:

idLabelHolds
speedSpeed and samplingspeed profile, steps, sampler, schedule, CFG/guidance, shift, denoise, and anything a speed profile pins
sizeSizeresolution, megapixels, upscale target, frame rate, clip length
lorasLoRAsevery LoRA picker outside a feature gate
embeddingsEmbeddingstextual-inversion pickers
enhanceUpscale and refinesecond-pass upscale and refine settings
detailerFace and hand detailerface, hand and body detailer gates
guidanceGuidanceNAG, CFG-Zero*, APG, SLG, ADM, SAG
effectsEffectsfilm grain, sharpness
qualityQuality tweaksdetail warp, FreeInit, RIFLEx
continuityLong video continuitySVI Pro continuity
restorationRestorationrestoration intent and its noise overrides
cacheStep cacheFBCache
sparseSparse attentionsparse attention settings
memoryMemory and tilingVAE tiling, temporal batching, low-VRAM chunking
outputOutput formatfile format, transparent background (cloud image presets)
providerProvider optionsa cloud preset's cloud_options field
modelsModelsevery model picker, with preselect: false

Seeds, quantities, prompts, media inputs and manual sigma overrides stay out of every group.

Cloud-bound fields (with capability:) belong in groups like any other setting: when a formula is applied, values the chosen model does not support are skipped. The shared cloud blocks under content/presets/_shared/cloud/ carry size, output, provider and models, so a preset that includes them declares those ids; scripts/preset_new.py --engine cloud scaffolds that catalog.

Rules

scripts/preset_lint.py (and GET /api/developer/presets/lint) checks every mode and form variant:

  1. Error: a formula: naming a group the catalog does not declare, and a group without a label. Warning: a group no field in any mode uses.
  2. Error: an input or display field (image, video, audio, media, file, prompt_timeline, camera_shot, seed, alert, markdown, header) inside a group.
  3. Error: the same field name in two different groups in one form.
  4. Error: a field in a group whose reaction is driven by a field in another group or in no group. Reactions that only set visibility or set_filter_tags are exempt.
  5. Info: a group whose fields all carry audience: advanced, since it looks empty in the Simple view. Common and fine for sampling knobs that live on the Advanced tab.
  6. Info: the preset has a lora_picker or speed_profiles but declares no groups.

python scripts/preset_lint.py --formulas <preset-id-name-or-dir> prints the groups each mode and variant resolves to.

Hardware requirements#

requires: is an optional top-level preset.yml mapping that surfaces hardware guidance in the preset picker before a user downloads the model — so an 8 GB card discovers a preset doesn't fit from a badge, not from an OOM after a multi-GB download. It is PresetRequirements in src/features/presets/schema.py, extra="forbid", every key optional:

yaml
requires:
  min_vram_gb: 12          # the preset is not claimed to work below this
  recommended_vram_gb: 16  # the comfortable tier
  min_ram_gb: 16           # system RAM, separate from VRAM (see hardware-requirements.md)

All three are plain numbers (GB); a non-positive value is a schema error. Every key is optional, and so is the block itself — a preset with no requires: loads exactly as before, and the picker renders no badge.

Populate this honestly, not by estimate. The source of truth is the measured, per-family table in docs/user/hardware-requirements.md (and the per-family docs under docs/models/ it links). Where that page marks a family Unvalidated or gives no measured floor for a tier, leave requires: off entirely (or omit the specific key) rather than guess a number — a wrong minimum is worse than no minimum, since it either scares off a card that would have worked or, worse, promises one that won't. min_vram_gb is a functional claim ("this runs here"); recommended_vram_gb is a comfort claim and can stand alone when only the comfortable tier is measured.

requires: is pure metadata: it never reaches pipeline.yml's Jinja context (see PresetProcessor's preset dict below) and has no effect on generation — only on what the picker shows.

The frontend (PresetPicker.svelte) renders a compact "N GB VRAM" badge when min_vram_gb (or, failing that, recommended_vram_gb) is set. When the backend's /api/system/stats endpoint reports a detected GPU (available to any authenticated user, not admin-gated) and its VRAM is below min_vram_gb, the badge switches to a non-blocking warning — never a disabled button.

LLM context#

llm: is an optional top-level preset.yml mapping that shapes what the chat LLM is told about this preset every turn. It has no effect on generation itself — it only feeds ChatContextBuilder.inject_workspace_block (src/features/chat/context_builder.py), the system block injected before the user's message whenever a Generate-form workspace is active.

yaml
llm:
  guide: |                    # optional, multiline prompting guide for this preset/family
    This model prefers short, comma-separated tag phrases over full sentences.
    Always include a camera/lens phrase (e.g. "35mm, f/1.8") for realistic shots.
  context:                    # optional; defaults shown
    form: summary             # "off" | "summary" | "full"
    fields: [checkpoint, loras]   # optional; restricts which resolved models' guidance is pushed
    guidance_chars: 800       # optional; overrides the default per-model guidance cap
  modes:                      # optional; per-mode guide overrides, keyed by mode name
    refs:
      guide: |
        This mode expects a six-section reference brief, not a plain description:
        Subject / Pose / Lighting / Camera / Style / Negative — each on its own line.

A preset with no llm: block gets none of this — the workspace block's prior behavior is unchanged. Declaring llm: (even an empty llm: {}) turns on two things:

  • guide — a repo-authored, family-level prompting guide, injected verbatim (capped at 3000 chars) as a "Prompting guide:" section. This is a good place for phrasing conventions a model responds to that don't belong on any single field or checkpoint.
  • context.form (default summary once llm: is present) — appends a compact listing of the active mode's form fields (name, label, type, and ai_hint truncated to ~200 chars) to the workspace block. full additionally includes each field's range/default/options-count; off suppresses the listing entirely (but guide, if set, still appears).

context.fields, when set, narrows which form fields' resolved model guidance (a checkpoint's or LoRA's prompting_guidance) gets included — models are still listed by name/strength/trigger words regardless, only the guidance excerpt is gated. Omit it to keep the default auto-detect behavior (every resolved model's guidance is eligible). context.guidance_chars, when set, overrides the workspace block's default 240-character per-model guidance cap for this preset.

modes — per-mode guide overrides, keyed by mode name. When the workspace's current mode has an entry here, its guide replaces the top-level guide for that turn (not concatenated) — useful when a mode's expected prompt format is fundamentally different from the rest of the preset (e.g. a references mode wanting a structured multi-section brief instead of a plain description). A mode with no entry falls back to the top-level guide as usual. Same 3000-char cap either way. Mode keys are free-form and not cross-validated against modes: — a plugin-contributed mode is a valid key even though the schema can't see it declared anywhere.

The header line the block always shows (Preset: <name> · Mode: ... · Variant: ...) uses the preset's display name, never its raw id — this applies to every preset, llm: block or not.