Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

fix(agent): photoreal stills + motion-rich i2v + batch submits

mrbizarro04f563412325
diff --git a/agent/image_engine.py b/agent/image_engine.py
index e6699ec..d2faa81 100644
--- a/agent/image_engine.py
+++ b/agent/image_engine.py
@@ -225,6 +225,15 @@ def health_check(config: ImageEngineConfig) -> tuple[bool, str]:
MFLUX_FAMILY_BIN = {
"flux1": "mflux-generate",
"flux2": "mflux-generate-flux2",
+ # FLUX.2 Klein Edit — image-conditioned variant of FLUX.2. Like qwen_edit
+ # it takes --image-paths (REQUIRED) and composes the prompt onto the
+ # reference image(s). Distilled at 4 steps for the klein-4b/9b base
+ # models (guidance MUST be 1.0); the klein-base-4b/9b non-distilled
+ # variants run at 25+ steps with real guidance (4.0 typical) and
+ # produce photorealistic output instead of the distilled illustrative
+ # look. See engine_override "flux2_edit" (distilled) vs
+ # "flux2_edit_high" (base, photoreal) in agent/tools.py.
+ "flux2_edit": "mflux-generate-flux2-edit",
"z_image": "mflux-generate-z-image",
"z_image_turbo": "mflux-generate-z-image-turbo",
"fibo": "mflux-generate-fibo",
@@ -246,6 +255,13 @@ MFLUX_FAMILY_BIN = {
MFLUX_FAMILY_DEFAULTS = {
"flux1": {"steps": 25, "guidance": 4.5, "base_model": "dev"},
"flux2": {"steps": 4, "guidance": 1.0, "base_model": "flux2-klein-4b"},
+ # flux2_edit default: 4 steps + guidance 1.0 (the distilled klein-4b
+ # path, fastest). Switch to klein-base-4b/9b + steps 25 + guidance 4.0
+ # via engine_override="flux2_edit_high" for photorealistic output —
+ # see agent/tools.py engine_override branches. The distilled path
+ # FORCES guidance == 1.0 (mflux's flux2_edit_generate.py rejects any
+ # other value); the base path REQUIRES guidance > 1.0 to do real CFG.
+ "flux2_edit": {"steps": 4, "guidance": 1.0, "base_model": "flux2-klein-4b"},
"z_image": {"steps": 25, "guidance": 5.0, "base_model": ""},
"z_image_turbo": {"steps": 9, "guidance": 0.0, "base_model": ""},
"fibo": {"steps": 30, "guidance": 5.0, "base_model": ""},
@@ -481,13 +497,13 @@ def _generate_mflux(prompt: str, n: int, width: int, height: int,
f"depending on family."
)
- # qwen_edit refuses to start without --image-paths (mflux argparse
- # marks it required for the qwen-edit CLI). Catch this here with a
- # clear validation error instead of letting the user wait minutes
- # for a confusing argparse failure.
- if fam == "qwen_edit" and not refs:
+ # qwen_edit and flux2_edit BOTH refuse to start without --image-paths
+ # (mflux argparse marks it required on both edit-flavored CLIs).
+ # Catch here with a clear validation error instead of letting the
+ # user wait minutes for a confusing argparse failure.
+ if fam in ("qwen_edit", "flux2_edit") and not refs:
raise ValueError(
- "Qwen-Image-Edit-2509 needs at least 1 reference image — drop "
+ f"{fam} needs at least 1 reference image — drop "
"a photo into one of the 3 reference slots above, or switch "
"the Engine dropdown to FLUX.2 [klein] / Z-Image-Turbo for "
"text-only generation."
@@ -529,13 +545,22 @@ def _generate_mflux(prompt: str, n: int, width: int, height: int,
"--guidance", str(eff_guidance),
"--seed", *[str(s) for s in seeds],
]
- # Multi-reference input — only the qwen_edit family consumes
- # --image-paths today (mflux v0.11.1+). For other families we
- # silently drop refs and tag refs_ignored=True on each result.
+ # Reference image input — three different argument shapes across
+ # mflux's edit-flavored CLIs:
+ # qwen_edit / flux2_edit : --image-paths (plural, 1+ images)
+ # kontext : --image-path (singular, 1 image only)
+ # Other families silently drop refs and tag refs_ignored=True.
+ # mflux v0.17+. Adding more edit families? Update this dispatch.
refs_used: list[str] = []
- if refs and fam == "qwen_edit":
+ if refs and fam in ("qwen_edit", "flux2_edit"):
refs_used = [str(Path(r).resolve()) for r in refs]
cmd.extend(["--image-paths", *refs_used])
+ elif refs and fam == "kontext":
+ # kontext only consumes a single image. Use the first ref;
+ # the agent's tools.py refs validation already caps at 3 so
+ # we silently take refs[0] without warning here.
+ refs_used = [str(Path(refs[0]).resolve())]
+ cmd.extend(["--image-path", refs_used[0]])
# Optional Lightning / acceleration LoRAs
if config.mflux_lora_paths:
cmd.append("--lora-paths")
@@ -651,7 +676,7 @@ def _generate_mflux(prompt: str, n: int, width: int, height: int,
"model": config.mflux_model,
"width": width, "height": height,
"refs": refs_used,
- "refs_ignored": (bool(refs) and fam != "qwen_edit"),
+ "refs_ignored": (bool(refs) and fam not in ("qwen_edit", "flux2_edit")),
"lora_paths": list(config.mflux_lora_paths or []),
})
diff --git a/agent/prompts.py b/agent/prompts.py
index cf79a2c..73c7a2a 100644
--- a/agent/prompts.py
+++ b/agent/prompts.py
@@ -121,6 +121,27 @@ Today is {today}. Phosphene version: {repo_version}. Hardware tier:
5. **No surprises while the user is asleep.** Don't switch quality
tiers, change resolutions, or add bonus clips that weren't in the
approved plan.
+6. **Push back when the user's instructions will produce broken
+ output.** Don't silently follow a directive that the rest of this
+ prompt says will fail. Common ones:
+ - User asks for `aspect="1:1"` but the shots are i2v at 16:9 →
+ stop, explain that the square still gets cropped into widescreen,
+ suggest 16:9 unless the deliverable is genuinely a square video.
+ - User passes a value not in the docs (`accel="distilled"`,
+ `quality="ultra"`, `engine_override="flux2_edit_v3"`) → stop,
+ point at the valid values, ask which they meant.
+ - User asks you to reuse the still prompt for the i2v video prompt
+ ("just animate the still, gentle motion") → stop, explain the
+ i2v prompt needs explicit motion beats (see Phase C section
+ below), draft the rewritten beats, ask for approval.
+ - User asks for **photorealistic** stills but specifies a distilled
+ engine (`engine_override="flux2_edit"` is distilled) → stop,
+ suggest `flux2_edit_high` or `qwen_edit_high` and explain the
+ trade (3-5 min/image vs 30 s, but actually photographic).
+ The user almost always wants the failure NOT to happen; their
+ directive is shorthand for an outcome, not a literal command.
+ Treat their words as INTENT, not script — same as you treat
+ dialogue prompts.
# Tool protocol — fenced action blocks
@@ -135,6 +156,42 @@ Block at END of reply. Anything before is shown to the user. Block
must be valid JSON. When done with a workflow, call `finish` to stop
the loop.
+# Batch submits — use `submit_shots` for multi-shot pieces
+
+If you need to queue **2 or more shots** in the same turn (typical
+for a multi-scene short film, an overnight render batch, the user's
+"queue them all and I'll come back in the morning" workflow), call
+`submit_shots` ONCE with the full list — DO NOT loop `submit_shot`.
+
+Why: when the panel's local chat engine is configured to auto-pause
+during renders (the default), the LTX worker stops the chat server
+the moment it picks the FIRST job from the queue. Any subsequent
+chat call you'd make to issue another `submit_shot` will fail with
+`Connection error`. With `submit_shots`, the entire batch lands in
+one tool dispatch, the runtime exits cleanly afterward (auto_finish
+default true), and the user wakes to a folder of finished mp4s.
+
+Pattern:
+```action
+{{"tool": "submit_shots", "args": {{
+ "shots": [
+ {{"prompt": "...", "mode": "i2v", "ref_image_path": "/abs/path/s1.png",
+ "duration_seconds": 6, "label": "S1 beach"}},
+ {{"prompt": "...", "mode": "i2v", "ref_image_path": "/abs/path/s2.png",
+ "duration_seconds": 6, "label": "S2 cafe"}},
+ ...
+ ]
+}}}}
+```
+
+Compose your written wrap-up summary BEFORE the action block — the
+text above the block is what the user reads when they wake up. The
+runtime will not call you again after `submit_shots`.
+
+Use the singular `submit_shot` only for a single shot, or for
+follow-up "redo S3" / "tweak S5" actions inside an interactive
+session where the user is still typing.
+
# Phosphene's modes
| Mode | Use for | Notes |
@@ -327,6 +384,19 @@ that PNG as `ref_image_path` and submit the video render with
because the look is locked at frame 0 by a still the user actually
chose.
+**Engine for photorealistic stills with character refs:** default to
+`engine_override="flux2_edit_high"` (FLUX.2 Klein-Base-Edit, Q8, 25
+steps, guidance 4.0 — non-distilled, ~3-5 min/image, photographic
+output). Alternatives: `qwen_edit_high` (Qwen-Image-Edit-2509 Q8 30
+steps — strong on multi-character composition) and `kontext_high`
+(FLUX.1 Kontext Q8 30 steps — different aesthetic). The bare
+`flux2_edit` and `qwen_edit` presets are FAST but DISTILLED — output
+is illustrative / cartoon-like, not photographic. Use them only when
+the user explicitly asks for "draft" / "iteration speed". When in
+doubt, prefer photographic over fast — re-rendering 5 photographic
+stills at 4 min each (20 min total) beats handing back 5 cartoon
+stills the user has to throw away.
+
`mode: "t2v"` only when the user explicitly opts out of the anchor
workflow ("just t2v, skip the picker"), or the shot is so abstract
that no still serves as a useful anchor (a generic ambient cutaway).
@@ -598,6 +668,13 @@ When the user asks for **more variations of an already-generated shot**
stacks below in the chat as "Take 2 / 2". The user can pick from any
take.
+**Aspect: default to "16:9" for i2v shots.** The video render is
+1280×704 (16:9). A 1:1 still gets cropped/letterboxed into the
+widescreen frame at render time, which reads as a slow zoom — no
+matter what your prompt asks for. Pass `aspect="1:1"` only when the
+user explicitly wants a square output (rare; 16:9 is right for almost
+every cinematic shot).
+
A still prompt is NOT a video prompt. Differences:
- **No dialogue.** Audio comes with the video render in Phase C, not
@@ -614,8 +691,89 @@ A still prompt is NOT a video prompt. Differences:
- **60-120 words.** Tighter than video prompts; the still has no
temporal beats to fill.
-The video prompt in Phase C carries the dialogue, the action beats,
-and any camera motion. The anchor still controls the look.
+# Writing prompts FOR i2v VIDEO renders (Phase C) — DIFFERENT FROM STILL PROMPTS
+
+**The single most common mistake** is passing the still's prompt
+unchanged into `submit_shot`. The result: the model has nothing to
+animate, and you get 4 seconds of an almost-still image with maybe
+some background drift ("just a slow zoom"). A user shipped exactly
+this and reported "the videos don't have anything on them, the
+character barely moves." The still prompt described a *snapshot*; the
+video had no instructions for what should *happen*.
+
+**Rule:** every i2v `submit_shot` prompt MUST include explicit motion
+beats — what the *character* and *camera* do over the clip's duration.
+The anchor still already locks composition, lighting, and identity;
+your job in the i2v prompt is **time** — what changes.
+
+Allocation (matches the action-beats rule below): ~1 explicit beat per
+2–3 seconds. So:
+
+| Duration | Minimum beats |
+|---|---|
+| 4 s | 2 explicit beats (a 4 s clip is the floor — under that, motion is hard to read) |
+| 6 s | 2–3 beats |
+| 8 s | 3–4 beats + 1.5 s tail |
+| 12 s | 4–5 beats + dialogue allocation |
+
+**Beats are character / camera / environment changes, not adjectives.**
+"Calm", "soft", "gentle", "warm", "relaxing" describe a *static mood*
+— they are NOT beats. Beats are verbs of *change*: turns, breathes,
+looks up, looks down, smiles, frowns, walks, lifts, sets down, opens,
+closes, pours, sips, raises eyebrow, exhales, blinks, leans in,
+straightens, picks up, puts down. Camera beats: slow push-in, slight
+handheld sway, gentle dolly, micro pan. Environment beats: light
+flickers, steam rises, leaves drift, neon flicker, rain drips off
+brim, snow drift across boots.
+
+**Worked side-by-side example — same scene, two prompts:**
+
+STILL prompt (Phase B), 1024×1024 anchor:
+> "Bizarro the AI character relaxing on a tropical beach at golden
+> hour, calm ocean, warm soft lighting, photorealistic."
+
+What's wrong if you reuse this for i2v: zero verbs of change.
+"relaxing" is a state, "calm" is a state, "warm" is a state. The
+model has nothing to animate. You get 4 s of the still with a
+quarter-second of breathing.
+
+i2v VIDEO prompt (Phase C), same scene at 6 s:
+> "Medium shot of Bizarro on a tropical beach at golden hour. He
+> breathes in slowly, eyes drift closed for a beat, then he reopens
+> them and looks out toward the horizon. Gentle waves roll in across
+> the foreground sand. Slight handheld sway, slow push-in. Soft warm
+> golden-hour lighting, shallow depth of field, photorealistic, no
+> text, no logos."
+
+That prompt: 3 character beats (breathes / closes eyes / reopens +
+looks), 1 environment beat (waves rolling), 1 camera beat (handheld
++ push-in). Locks the look at the end with the master-style suffix.
+
+**Director-rewrite checklist before every `submit_shot`:**
+
+1. Does the prompt name AT LEAST `ceil(duration / 3)` explicit beats?
+ If not — STOP, rewrite. Don't ship.
+2. Does the prompt say what the *character* does over the clip?
+ "Sitting", "standing", "relaxing" without a transition is stasis.
+3. Did you accidentally just paste the still prompt? If you can't
+ point at a verb of change, you did. Rewrite.
+4. Camera direction: at most ONE camera move per clip (LTX picks one
+ framing — see "What LTX 2.3 is bad at" above). "Slow push-in" or
+ "slight handheld sway" — pick one, not both.
+5. End with the master-style suffix verbatim.
+
+**For the SHORTEST clips (4 s):** still need 2 beats. A 4 s clip with
+1 beat reads as static. Examples:
+- "He breathes in once, then opens his eyes."
+- "She glances down at the cup, then up at the camera."
+- "Steam rises from the coffee; he raises the cup, eyes still on the page."
+
+**Negative example — NEVER ship a prompt like this for i2v:**
+> "Character at scene, calm, soft lighting, gentle motion, photorealistic."
+
+That's a still description with a "gentle motion" tag bolted on. The
+model can't infer what motion. Result: stasis. If you wrote this,
+DELETE it and rewrite with explicit beats before calling submit_shot.
# Director's craft — translating script to LTX prompts
diff --git a/agent/runtime.py b/agent/runtime.py
index 704da26..1d3e1ca 100644
--- a/agent/runtime.py
+++ b/agent/runtime.py
@@ -404,8 +404,15 @@ def run_turn(session: Session, user_message: str | None,
)
session.messages.append({"role": "user", "content": tool_result_msg})
- # 5. If the model called `finish`, stop the loop.
- if tool_name == "finish":
+ # 5. If the model called `finish`, OR a tool set the
+ # `_finish_after_turn` flag in tool_state (e.g. submit_shots
+ # with auto_finish=true — needed because the LTX worker pauses
+ # the local chat engine the moment it picks up the FIRST job
+ # from the queue, so any subsequent chat call would fail with
+ # "Connection error"; the agent must commit the whole batch
+ # AND signal completion in a single tool dispatch), stop the
+ # loop.
+ if tool_name == "finish" or session.tool_state.pop("_finish_after_turn", False):
session.finished = True
yield emit(TurnEvent("done", {"reason": "finished", "step": step_i}))
return
@@ -426,7 +433,7 @@ def list_tool_catalog() -> list[dict]:
and `body` (rest, trimmed). Stable order matches `render_tools_doc`.
"""
order = [
- "estimate_shot", "submit_shot", "get_queue_status",
+ "estimate_shot", "submit_shot", "submit_shots", "get_queue_status",
"wait_for_shot", "extract_frame", "inspect_clip",
"generate_shot_images", "get_selected_anchors", "upload_image",
"read_document", "list_loras", "get_master_style",
@@ -488,7 +495,7 @@ def render_tools_doc() -> str:
"generate_shot_images", "get_selected_anchors", "list_library_images",
"inspect_clip", "extract_frame", "upload_image",
# submission + wait
- "submit_shot", "get_queue_status", "wait_for_shot",
+ "submit_shot", "submit_shots", "get_queue_status", "wait_for_shot",
# style + memory
"list_loras", "get_master_style",
"read_project_notes", "append_project_notes", "read_document",
diff --git a/agent/tools.py b/agent/tools.py
index 9292eed..71ec14d 100644
--- a/agent/tools.py
+++ b/agent/tools.py
@@ -285,13 +285,30 @@ def _submit_shot(args: dict, ops: PanelOps, session: dict) -> dict:
if quality not in ("quick", "balanced", "standard", "high"):
raise _ToolValidationError(f"quality must be quick|balanced|standard|high, got {quality!r}")
- accel = (args.get("accel") or "turbo").lower()
- if accel not in ("exact", "boost", "turbo"):
- accel = "turbo"
+ # accel: panel uses "off"/"boost"/"turbo" (panel UI labels "off" as
+ # "Exact" — accept that alias for friendliness). Reject anything else
+ # explicitly so a typo like accel="distilled" fails fast instead of
+ # silently coercing to "turbo" and producing surprisingly motion-poor
+ # output. (This is the bug we hit in session fd13625972ee — the agent
+ # passed "distilled", got silently turned into "turbo", and the user
+ # wondered why every clip was barely-moving.)
+ raw_accel = (args.get("accel") or "turbo").lower()
+ if raw_accel == "exact":
+ accel = "off"
+ elif raw_accel in ("off", "boost", "turbo"):
+ accel = raw_accel
+ else:
+ raise _ToolValidationError(
+ f"accel must be off|boost|turbo (or alias 'exact' for off), "
+ f"got {raw_accel!r}. Default is 'turbo'. 'off' = full sampler "
+ f"every step (best motion); 'boost' = ~10-15% faster; 'turbo' = "
+ f"~20-25% faster (skips up to 3 steps via cache — costs motion "
+ f"on subtle scenes)."
+ )
# Modes that don't allow acceleration are normalized later by the panel
# but we mirror the rule here so estimates match what the queue runs.
if mode in ("extend", "keyframe") or quality == "high":
- accel = "exact"
+ accel = "off"
duration = float(args.get("duration_seconds", 5.0))
if duration <= 0:
@@ -556,6 +573,131 @@ def _submit_shot(args: dict, ops: PanelOps, session: dict) -> dict:
}
+@tool("submit_shots")
+def _submit_shots(args: dict, ops: PanelOps, session: dict) -> dict:
+ """Submit MULTIPLE shots in ONE tool call. This is the right tool
+ when queuing a batch (a multi-shot short film, a 5-clip storyboard,
+ overnight render of N scenes).
+
+ **Why this exists.** When the panel's local chat engine
+ (`phosphene_local`) is configured with `auto_pause_during_renders`
+ (the default), the LTX worker stops mlx-lm.server the moment it
+ picks up the FIRST job from the render queue — to free RAM for the
+ diffusion run. Any subsequent chat call from the agent fails with
+ `Connection error` until the queue drains. Calling individual
+ `submit_shot` tools in sequence therefore gets you exactly ONE
+ shot queued, then a crash. `submit_shots` batches the entire
+ plan into a single tool dispatch + (by default) signals
+ end-of-turn so the runtime exits before another chat call is
+ needed. This is the path Salo's "queue them all so renders run
+ overnight" workflow expects.
+
+ Args:
+ shots: list[dict] (required) — each item is the same arg shape
+ as `submit_shot`. Required per shot:
+ { "prompt": str, "mode": "i2v"|"t2v"|..., "label": str,
+ "ref_image_path": str (i2v only),
+ "duration_seconds": float, "quality": str, ... }
+ Each item is dispatched through the same validation as a
+ single `submit_shot`, so an invalid one fails its row but
+ does NOT abort the rest of the batch.
+ auto_finish: bool = true — when true (default), the runtime
+ treats this dispatch as terminal and exits the agent loop
+ after returning. Set to false ONLY when you have follow-up
+ non-chat work that doesn't need the engine (rare).
+
+ Returns:
+ { "submitted": int,
+ "failed": int,
+ "results": [ {ok: bool, job_id?: str, error?: str, label?: str}, ... ],
+ "queue_depth": int,
+ "auto_finished": bool }
+
+ The agent's chat reply that calls submit_shots is the LAST one
+ until the user types again. Compose your written summary BEFORE
+ the action block — that's what the user will read when they wake.
+ """
+ shots = args.get("shots")
+ if not isinstance(shots, list) or not shots:
+ raise _ToolValidationError(
+ "shots must be a non-empty list of shot specs (each the "
+ "same shape as submit_shot args). Got: "
+ f"{type(shots).__name__}"
+ )
+ if len(shots) > 50:
+ # Practical cap: 50 × 6 s standard turbo ≈ 4 hours wall.
+ # Anything larger is almost certainly an agent loop bug.
+ raise _ToolValidationError(
+ f"shots list too long ({len(shots)}); cap is 50 per call. "
+ "Split the batch into multiple turns if the user really "
+ "wants more."
+ )
+
+ auto_finish = args.get("auto_finish")
+ if auto_finish is None:
+ auto_finish = True
+ auto_finish = bool(auto_finish)
+
+ results: list[dict] = []
+ submitted = 0
+ failed = 0
+ for idx, shot in enumerate(shots):
+ if not isinstance(shot, dict):
+ results.append({
+ "ok": False,
+ "index": idx,
+ "label": None,
+ "error": "validation: shot must be a dict",
+ })
+ failed += 1
+ continue
+ label = (shot.get("label") or "")[:80]
+ try:
+ r = _submit_shot(shot, ops, session)
+ results.append({
+ "ok": True,
+ "index": idx,
+ "label": label or None,
+ "job_id": r.get("job_id"),
+ "estimated_wall_seconds": r.get("estimated_wall_seconds"),
+ "frames": r.get("frames"),
+ "width": r.get("width"),
+ "height": r.get("height"),
+ })
+ submitted += 1
+ except _ToolValidationError as e:
+ results.append({
+ "ok": False, "index": idx, "label": label or None,
+ "error": f"validation: {e}",
+ })
+ failed += 1
+ except Exception as e: # noqa: BLE001
+ results.append({
+ "ok": False, "index": idx, "label": label or None,
+ "error": f"{type(e).__name__}: {e}",
+ })
+ failed += 1
+
+ snap = ops.queue_snapshot() or {}
+ queue_depth = len(snap.get("queue") or [])
+
+ if auto_finish and submitted > 0:
+ # Signal the runtime to exit the loop after this dispatch
+ # returns. Required because the LTX worker pauses the local
+ # chat engine on first render — any follow-up chat call would
+ # fail with "Connection error". See agent/runtime.py for the
+ # corresponding consumer of this flag.
+ session["_finish_after_turn"] = True
+
+ return {
+ "submitted": submitted,
+ "failed": failed,
+ "results": results,
+ "queue_depth": queue_depth,
+ "auto_finished": (auto_finish and submitted > 0),
+ }
+
+
@tool("get_queue_status")
def _get_queue_status(args: dict, ops: PanelOps, session: dict) -> dict:
"""Read the FIFO queue + currently running job + recent history.
@@ -867,18 +1009,47 @@ def _generate_shot_images(args: dict, ops: PanelOps, session: dict) -> dict:
engine_override: str = "" — per-call engine choice, OVERRIDES the
user's saved Settings without changing it.
Valid values:
+ "flux2_edit" 4-step Q4 distilled FLUX.2
+ Klein-Edit, ~30 s/image,
+ NEEDS refs. Distilled =
+ fast but ILLUSTRATIVE
+ style (cartoonish).
+ "flux2_edit_high" 25-step Q8 NON-DISTILLED
+ FLUX.2 Klein-Base-Edit
+ with guidance 4.0,
+ ~3-5 min/image, NEEDS
+ refs. Use this when the
+ user asks for
+ PHOTOREALISTIC stills —
+ this is the default
+ photoreal path.
"qwen_edit_lightning" 4-step Q4 + Lightning LoRA,
~10-15 s/image, NEEDS refs
"qwen_edit" 8-step Q4, ~1 min/image,
NEEDS refs
- "qwen_edit_high" 30-step Q8, ~5 min/image,
- NEEDS refs
+ "qwen_edit_high" 30-step Q8 + guidance 4.0,
+ ~5 min/image, NEEDS refs.
+ Alternative photoreal
+ path; multi-ref-strong.
+ "kontext_high" 30-step Q8 FLUX.1 Kontext
+ guidance 4.5, ~3 min/image,
+ NEEDS refs. Mature
+ image-conditioning
+ family — different
+ aesthetic than flux2/qwen.
"flux2" 4-step T2I, ~15 s/image,
no refs supported
"z_image_turbo" 9-step T2I, ~30 s/image,
no refs supported
"mock" flat colored squares,
instant (testing only)
+ **Default for photoreal stills with refs:
+ "flux2_edit_high"** (or qwen_edit_high if
+ multi-character composition is needed).
+ Use the bare "flux2_edit" only when the user
+ explicitly asks for "fast iteration" or
+ "draft quality" — its distilled weights
+ produce illustrative output, not photographs.
Use this to react to errors: if a qwen_edit
call returns "needs at least 1 reference image"
and the user explicitly didn't provide one,
@@ -953,7 +1124,43 @@ def _generate_shot_images(args: dict, ops: PanelOps, session: dict) -> dict:
# validation error instead of silently using the saved config.
engine_override = (args.get("engine_override") or "").strip()
if engine_override:
- if engine_override == "qwen_edit_lightning":
+ if engine_override == "flux2_edit":
+ # Distilled klein-4b — fast but illustrative. mflux's
+ # flux2_edit_generate.py FORCES guidance == 1.0 on distilled
+ # bases; passing anything else would parser.error. Pass the
+ # mflux SHORTHAND name (not the HF repo) so mflux resolves
+ # the correct base config.
+ cfg = _image_engine.ImageEngineConfig(
+ kind="mflux",
+ mflux_model="flux2-klein-4b",
+ mflux_family="flux2_edit",
+ mflux_quantize=4,
+ mflux_steps=4,
+ mflux_guidance=1.0,
+ )
+ elif engine_override == "flux2_edit_high":
+ # Non-distilled klein-base-4b — accepts real CFG and renders
+ # photorealistic. ~3-5 min/image at Q8. The default
+ # photoreal path when the user has a character ref.
+ #
+ # CRITICAL: pass the SHORTHAND mflux model name
+ # ("flux2-klein-base-4b") instead of an HF repo path.
+ # mflux's flux2_edit_generate.py uses ModelConfig.from_name
+ # to detect "is this a distilled base?" via substring match.
+ # If you pass "black-forest-labs/FLUX.2-klein-4B" as model
+ # the substring check sees "klein-4b" (no "base") and
+ # rejects guidance != 1.0 — the photoreal path silently
+ # falls back to the distilled config and you get the
+ # illustrative output anyway.
+ cfg = _image_engine.ImageEngineConfig(
+ kind="mflux",
+ mflux_model="flux2-klein-base-4b",
+ mflux_family="flux2_edit",
+ mflux_quantize=8,
+ mflux_steps=25,
+ mflux_guidance=4.0,
+ )
+ elif engine_override == "qwen_edit_lightning":
cfg = _image_engine.ImageEngineConfig(
kind="mflux",
mflux_model="Qwen/Qwen-Image-Edit-2509",
@@ -978,6 +1185,20 @@ def _generate_shot_images(args: dict, ops: PanelOps, session: dict) -> dict:
mflux_family="qwen_edit",
mflux_quantize=8,
mflux_steps=30,
+ mflux_guidance=4.0,
+ )
+ elif engine_override == "kontext_high":
+ # FLUX.1 Kontext-dev — image-conditioning, mature family.
+ # Q8 + 30 steps + guidance 4.5 produces a different
+ # aesthetic than flux2/qwen — useful when those two
+ # produce inconsistent output for a specific composition.
+ cfg = _image_engine.ImageEngineConfig(
+ kind="mflux",
+ mflux_model="black-forest-labs/FLUX.1-Kontext-dev",
+ mflux_family="kontext",
+ mflux_quantize=8,
+ mflux_steps=30,
+ mflux_guidance=4.5,
)
elif engine_override == "flux2":
cfg = _image_engine.ImageEngineConfig(
@@ -998,8 +1219,9 @@ def _generate_shot_images(args: dict, ops: PanelOps, session: dict) -> dict:
else:
raise _ToolValidationError(
f"engine_override={engine_override!r} unknown. Valid: "
+ f"flux2_edit | flux2_edit_high | "
f"qwen_edit | qwen_edit_lightning | qwen_edit_high | "
- f"flux2 | z_image_turbo | mock"
+ f"kontext_high | flux2 | z_image_turbo | mock"
)
safe_label = re.sub(r"[^a-z0-9_-]", "_", label.lower())[:40] or "untitled"