Preset Context Cheat Sheet
The values, filters and context roots a preset can use in its templates, and what each one holds.
On this page
Globals, filters and template context roots#
The Jinja globals/filters below are registered in src/platform/templating/processor.py; the Template Context entries are the pipeline.yml context roots built by src/features/presets/processor.py. Descriptions and signatures come straight from src.features.developer.template_functions_documenter.TemplateFunctionsDocumenter - the same source Help → Documentation → Template Functions serves.
Speed Profiles
get_speed_profile — get_speed_profile(profile_name: str, default: Any = <required>) -> dict
Look up a named entry from preset.yml's speed_profiles: block (draft/standard/max, ...) and return its dict of generation-knob overrides. Omitting default makes a missing profile a build error that names both the preset and the profile. Use this for an EXPLICIT profile name; generation.profile (Template Context, below) is the already-resolved profile for whichever name the current request selected.
{{ get_speed_profile('draft')['steps'] }}→ 6 (from speed_profiles.draft.steps){{ generation.profile.steps }}→ 6 (the profile resolved for this request)
Filters
active_loras — value | active_loras -> list
Drop the lora_picker list's zero-strength entries. A missing strength (lora_picker's own strength_default applies), a negative strength (inverted LoRA) and a non-numeric strength all stay - only an exact-zero strength is dropped.
{{ form.loras | default([]) | active_loras }}→ The list with zero-strength entries removed
strip_model_dir — value | strip_model_dir -> str
Strip a model picker value down to its path relative to the depot type directory (models/<checkpoints|loras|vae|...>/), keeping any subdirectories underneath. A bare filename or an already backend-native ref (no such prefix) passes through unchanged; None/'' map to ''. Replaces the old replace('models/loras/', '') idiom in ComfyUI preset templates - see docs/models.md.
{{ form.vae | strip_model_dir }}→ 'x.safetensors' for 'models/vae/x.safetensors'{{ item.model | strip_model_dir }}→ 'style/x.safetensors' for 'models/loras/style/x.safetensors'
media_of_kind — value | media_of_kind(kind: str) -> list
Keep the media items of one kind ('image', 'video' or 'audio') from a media field's value. An item's kind is its declared type, else the extension of its name/path/url. None/'' give an empty list and a single item is wrapped in a list. Use | default([], true) first when the field may be absent.
{{ form.media_inputs | default([], true) | media_of_kind('video') }}→ Only the video items of the media_inputs field
text_or — value | text_or(fallback: Any) -> Any
Trim the value and return it, or the fallback when it is None or only whitespace. Use it for a default caption instead of value or 'default', which treats a prompt of spaces or newlines as a real prompt.
{{ generation.prompts.first.positive | text_or('A cinematic shot') }}→ The trimmed prompt, or 'A cinematic shot' when it is blank
default — value | default(fallback: Any, boolean: bool = False) -> Any
Jinja's builtin default filter - the ONLY way to tolerate a missing value. The environment uses StrictUndefined, so any reference to a field/key that wasn't provided RAISES a build error unless it is guarded by | default(...). Use it on every optional form field.
{{ form.steps | default(30) }}→ form.steps if provided, else 30{{ form.cfg | default(preset.vars.default_cfg) }}→ form.cfg or the preset's default_cfg var
Template Context
form — form.<field_name> -> native value
The bound form's values (see bind_form / docs/presets.md). Each field resolves to its native, typed value - form.steps is an int, form.enabled a bool, form.loras a list, form.resolution a str. A reference to a field the form didn't provide raises unless guarded by | default(...).
{{ form.steps | default(30) }}→ Number of steps (int){{ form.loras | default([]) }}→ List of selected LoRAs{% if form.enable_controlnet | default(false) %}...{% endif %}→ Bool gate
request — request.{mode, form_name}
The active request: which mode and which form variant is being generated.
{{ request.mode }}→ 'txt2img'{{ request.form_name }}→ 'custom'
generation — generation.{prompts:{first,pairs,positives,negatives}, profile, negative_applied}
Generation-level data resolved before the pipeline builds: expanded prompt pairs (one per image), and profile - the speed_profiles: entry resolved for this request (the one form.speed_profile names; the first declared profile if the form has no matching value; {} if the preset declares none, so generation.profile.steps fails loudly like any other missing key). prompts.first is the first pair; prompts.pairs the full list; prompts.positives/negatives the flattened sides. There is no generation.seed/generation.quantity - read form.seed/form.quantity (the seed_generator pipe's own config is the only real consumer). negative_applied is the preset's negative_prompt.applies_when evaluated against the bound form (true/false), None when the preset declares none.
{{ generation.prompts.first.positive }}→ First image's positive prompt{{ generation.prompts.pairs }}→ List of {positive, negative} pairs{{ form.steps | default(generation.profile.steps) }}→ form.steps if set, else the resolved profile's steps{{ generation.negative_applied }}→ True while the declared negative_prompt.applies_when holds
preset — preset.{id, name, vars}
The preset manifest: its id/name and the vars: bag (preset-wide constants). There is no preset.speed_profiles/preset.configuration - use get_speed_profile()/generation.profile for speed profiles, and @config:<key> field indirection for admin-set configuration (see Configuration (admin-set)).
{{ preset.vars.default_cfg }}→ The preset's default CFG constant
runtime — runtime.settings.<allowlisted_key> | runtime.user.is_admin
A pre-resolved snapshot of allowlisted settings (resolved once per build with the authenticated user), NOT a live settings-manager call. The main allowlisted key is file_storage_directory. runtime.user.is_admin is true only when the authenticated user is an administrator; it is resolved by the server, never from form data, so a pipe can trust it to gate admin-only work.
{{ runtime.settings.file_storage_directory }}→ The configured storage directory
paths — paths.preset
Filesystem anchors known at build time. paths.preset is the preset's root directory (used by external children: tab references).
"{{ paths.preset }}/modes/txt2img/tabs/advanced.yml"→ Resolved tab-fragment path
@config:<key> indirection#
Not a Jinja construct: a bare string-prefix match (str.startswith('@config:')) resolved in src/features/presets/configuration.py's resolve_filter_tags/resolve_field_filter_tags at form-schema time, against the preset's admin-set configuration: values (see "Configuration (admin-set)" in the Preset Authoring Guide). A key the preset declares but an admin never set resolves to "no filtering" (a normal, expected state) - by the time this runs, an undeclared key or any other @-prefixed value has already failed the preset's LOAD: PresetTemplateLoader._validate_filter_tags_directives (loader.py) walks every field's configuration.filter_tags/reaction set_filter_tags while building the template and rejects those two mistakes there, naming the preset, the field, and the declared keys, so a bad reference never reaches this resolver at all.
Injected form keys#
Runtime-injected documents that arrive as ordinary keys of the form context root without being declared as form fields (src/features/presets/linter.py's _INJECTED_FORM_KEYS - the preset linter never flags a {{ form.<name> }} reference to one of these as an undeclared field):
llm, music_director, prompt_timeline, timeline, video_director
model_type values#
The 22 model types a model/lora_picker field's configuration.model_type may select, and the depot directory each maps to (src/platform/filesystem/model_types.py):
model_type | Directory |
|---|---|
adetailer | adetailer/ |
checkpoint | checkpoints/ |
controlnet | controlnet/ |
detection_bbox | detection_bbox/ |
detection_segm | detection_segm/ |
diffusion_model | diffusion_models/ |
embedding | embeddings/ |
facerestore | facerestore/ |
geometry_estimation | geometry_estimation/ |
insightface | insightface/ |
instantid | instantid/ |
llm | llm/ |
lora | loras/ |
lut | luts/ |
mediapipe | mediapipe/ |
model_patch | model_patches/ |
preview_decoder | vae_approx/ |
text_encoder | text_encoders/ |
unet | unet/ |
upscaler | upscalers/ |
vae | vae/ |
vfi | vfi/ |
Built-in field types#
The 42 core field type names registered by src/features/fields/builtin.py (the live, authoritative list is served at GET /api/fields/types; a plugin can add more via its manifest's field_types: section):
accordion, alert, anchor, audio, boolean, camera_shot, carousel, checkbox, checkbox_group, cloud_options, color, file, gate, group, header, image, integer, llm, lora_picker, markdown, media, model, models, number, number_box, prompt_timeline, resolution, row, sampler, schedule, section, seed, segmented, select, slider, stepper, string, tab, tabs, tags, textbox, video
content/presets/_shared/** option files#
Shared option-file vocabulary referenced from any preset via {{ paths._shared }} (see "External option files" in the Preset Authoring Guide). First three entries of each file:
| File | First entries |
|---|---|
content/presets/_shared/comfyui/form/samplers/all.yml | {'label': 'Euler', 'value': 'euler'}; {'label': 'Euler Ancestral', 'value': 'euler_ancestral'}; {'label': 'Euler CFG++', 'value': 'euler_cfg_pp'} |
content/presets/_shared/comfyui/form/samplers/base.yml | {'label': 'Euler', 'value': 'euler'}; {'label': 'Euler Ancestral', 'value': 'euler_ancestral'}; {'label': 'Euler CFG++', 'value': 'euler_cfg_pp'} |
content/presets/_shared/comfyui/form/samplers/extended.yml | {'label': 'DPM++ 3SDE', 'value': 'dpmpp_3sde'}; {'label': 'RES MULTISTEP', 'value': 'res_multistep'}; {'label': 'RES MULTISTEP A', 'value': 'res_multistep_ancestral'} |
content/presets/_shared/comfyui/form/schedulers/all.yml | {'label': 'Normal', 'value': 'normal'}; {'label': 'Simple', 'value': 'simple'}; {'label': 'Karras', 'value': 'karras'} |
content/presets/_shared/comfyui/form/schedulers/base.yml | {'label': 'Normal', 'value': 'normal'}; {'label': 'Simple', 'value': 'simple'}; {'label': 'Karras', 'value': 'karras'} |
content/presets/_shared/comfyui/form/schedulers/extended.yml | {'label': 'Bong Tangent', 'value': 'bong_tangent'} |
content/presets/_shared/resolutions/1k.yml | {'value': '1024x1024', 'ratio': [1, 1], 'description': 'Square 1K'}; {'value': '1280x832', 'ratio': [3, 2], 'description': 'Wide Landscape 1K'}; {'value': '832x1280', 'ratio': [2, 3], 'description': 'Tall Portrait 1K'} |
content/presets/_shared/resolutions/2k.yml | {'value': '2048x2048', 'ratio': [1, 1], 'description': 'Square 2K'}; {'value': '2496x1664', 'ratio': [3, 2], 'description': 'Wide Landscape 2K'}; {'value': '1664x2496', 'ratio': [2, 3], 'description': 'Tall Portrait 2K'} |
content/presets/_shared/resolutions/4k.yml | {'value': '2880x2880', 'ratio': [1, 1], 'description': 'Square 4K'}; {'value': '3520x2368', 'ratio': [3, 2], 'description': 'Wide Landscape 4K'}; {'value': '2368x3520', 'ratio': [2, 3], 'description': 'Tall Portrait 4K'} |
content/presets/_shared/resolutions/flux.yml | {'value': '1024x1024', 'ratio': [1, 1], 'description': 'Square', 'tier': 'Full'}; {'value': '1140x1472', 'ratio': [5, 6], 'description': 'Portrait', 'tier': 'Full'}; {'value': '1472x1140', 'ratio': [6, 5], 'description': 'Landscape', 'tier': 'Full'} |
content/presets/_shared/resolutions/flux3.yml | {'value': '1024x1024', 'ratio': [1, 1], 'description': 'Square', 'tier': 'Full'}; {'value': '1152x896', 'ratio': [9, 7], 'description': 'Landscape', 'tier': 'Full'}; {'value': '896x1152', 'ratio': [7, 9], 'description': 'Portrait', 'tier': 'Full'} |
content/presets/_shared/resolutions/flux_2k.yml | {'value': '2048x2048', 'ratio': [1, 1], 'description': 'Square 2K'}; {'value': '2560x1440', 'ratio': [16, 9], 'description': 'Widescreen 2K'}; {'value': '1440x2560', 'ratio': [9, 16], 'description': 'Vertical 2K'} |
content/presets/_shared/resolutions/minimax_h3_480p.yml | {'value': '832x480', 'ratio': [16, 9], 'description': 'Widescreen, Flex-trained 480p'}; {'value': '480x832', 'ratio': [9, 16], 'description': 'Vertical, Flex-trained 480p'}; {'value': '960x416', 'ratio': [21, 9], 'description': 'Ultrawide, Flex-trained 480p'} |
content/presets/_shared/resolutions/minimax_h3_canvas.yml | {'value': '1344x768', 'ratio': [16, 9], 'description': 'Widescreen (the released canvas)'}; {'value': '768x1344', 'ratio': [9, 16], 'description': 'Vertical'}; {'value': '1536x672', 'ratio': [16, 7], 'description': 'Ultrawide'} |
content/presets/_shared/resolutions/minimax_h3_fast.yml | {'value': '960x544', 'ratio': [30, 17], 'description': 'Widescreen, ~2.3x faster than 1344x768'}; {'value': '544x960', 'ratio': [17, 30], 'description': 'Vertical, faster'}; {'value': '832x480', 'ratio': [26, 15], 'description': 'Widescreen, ~0.4 MP'} |
content/presets/_shared/resolutions/minimax_h3_image.yml | {'value': '2048x2048', 'ratio': [1, 1], 'description': 'Square', 'tier': '4 MP'}; {'value': '2368x1760', 'ratio': [4, 3], 'description': 'Landscape', 'tier': '4 MP'}; {'value': '1760x2368', 'ratio': [3, 4], 'description': 'Portrait', 'tier': '4 MP'} |
content/presets/_shared/resolutions/moss_image.yml | {'value': '1024x1024', 'ratio': [1, 1], 'description': 'Square', 'tier': 'Full'}; {'value': '1152x896', 'ratio': [9, 7], 'description': 'Landscape', 'tier': 'Full'}; {'value': '896x1152', 'ratio': [7, 9], 'description': 'Portrait', 'tier': 'Full'} |
content/presets/_shared/resolutions/qwen_image21.yml | {'value': '1024x1024', 'ratio': [1, 1], 'description': 'Square (Compact)', 'tier': 'Compact'}; {'value': '1328x1328', 'ratio': [1, 1], 'description': 'Square', 'tier': 'Full'}; {'value': '2048x2048', 'ratio': [1, 1], 'description': 'Square (Large)', 'tier': 'Large'} |
content/presets/_shared/resolutions/sdxl.yml | {'value': '1024x1024', 'ratio': [1, 1], 'description': 'Square', 'tier': 'Full'}; {'value': '1152x896', 'ratio': [9, 7], 'description': 'Landscape', 'tier': 'Full'}; {'value': '896x1152', 'ratio': [7, 9], 'description': 'Portrait', 'tier': 'Full'} |
content/presets/_shared/resolutions/social_media.yml | {'value': '1920x1080', 'ratio': [16, 9], 'description': 'YouTube / Twitter'}; {'value': '1080x1080', 'ratio': [1, 1], 'description': 'Instagram Square'}; {'value': '1080x1350', 'ratio': [4, 5], 'description': 'Instagram Portrait'} |
content/presets/_shared/resolutions/social_media_video.yml | {'value': '720x720', 'ratio': [1, 1], 'description': 'Square'}; {'value': '960x960', 'ratio': [1, 1], 'description': 'Square (720P)'}; {'value': '576x720', 'ratio': [4, 5], 'description': 'Portrait (4:5)'} |
content/presets/_shared/resolutions/video.yml | {'value': '832x480', 'ratio': [16, 9], 'description': 'SD Landscape'}; {'value': '480x832', 'ratio': [9, 16], 'description': 'SD Portrait'}; {'value': '960x544', 'ratio': [16, 9], 'description': 'HQ Landscape'} |
content/presets/_shared/resolutions/zimage.yml | {'value': '512x512', 'ratio': [1, 1], 'description': 'Minimum Square', 'tier': 'Minimum'}; {'value': '576x448', 'ratio': [9, 7], 'description': 'Minimum Landscape', 'tier': 'Minimum'}; {'value': '448x576', 'ratio': [7, 9], 'description': 'Minimum Portrait', 'tier': 'Minimum'} |