---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "FLUX LoRA Training & Wan VACE 14B fal.ai Skill"
description: "Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex to run long-running fal.ai GPU pipelines cleanly via queue.fal.run (zero 504 timeouts): train custom FLUX LoRAs ($2.00/1,000 steps) and archive .safetensors locally, run calibrated fal-ai/flux-lora inference ($0.035/MP, CFG 3.5), and execute masked Alibaba Wan VACE 14B video object removal ($0.08/s) with +12px FFmpeg mask dilation."
canonical: "https://framesfield.com/skills/flux-lora-training-and-wan-vace-fal-skill"
---

# FLUX LoRA Training & Wan VACE 14B fal.ai Skill

> Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex to run long-running fal.ai GPU pipelines cleanly via queue.fal.run (zero 504 timeouts): train custom FLUX LoRAs ($2.00/1,000 steps) and archive .safetensors locally, run calibrated fal-ai/flux-lora inference ($0.035/MP, CFG 3.5), and execute masked Alibaba Wan VACE 14B video object removal ($0.08/s) with +12px FFmpeg mask dilation.

- **Canonical URL:** https://framesfield.com/skills/flux-lora-training-and-wan-vace-fal-skill
- **Raw Payload URL:** https://framesfield.com/raw/skills/flux-lora-training-and-wan-vace-fal-skill
- **Asset Type:** SKILL.md
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** fal.ai Queue API / FLUX LoRA / Wan VACE 14B / FFmpeg
- **License:** MIT
- **Last Verified:** 2026-12-01

## Setup & Install

```bash
mkdir -p .claude/skills/flux-lora-wan-vace-fal && curl -fsSL https://framesfield.com/raw/skills/flux-lora-training-and-wan-vace-fal-skill -o .claude/skills/flux-lora-wan-vace-fal/SKILL.md

```

## Copyable Asset (SKILL.md)

````markdown
---
name: flux-lora-wan-vace-fal
description: Run asynchronous fal.ai custom FLUX LoRA training (fal-ai/flux-lora-fast-training at $2.00 per 1,000 steps), calibrated FLUX LoRA inference (fal-ai/flux-lora at $0.035/MP), and mask-guided Alibaba Wan VACE 14B video editing (fal-ai/wan-vace-14b at $0.08/sec 720p) via queue.fal.run. Use when training brand/character LoRAs, archiving .safetensors for ComfyUI, or executing surgical video object removal with FFmpeg CFR prep and mask dilation.
---

# FLUX LoRA Training & Wan VACE 14B fal.ai Skill

## 1. Mandatory Pre-Flight Guardrails (Always Print Estimate First)
- **NEVER use synchronous `https://fal.run` for LoRA training or Wan VACE 14B**—both take 60–240s and trigger HTTP 504 timeouts while billing continues. Always submit to `https://queue.fal.run/<endpoint>`, log `request_id`, and poll `status_url` every 8–10s.
- **Verified Rates (2026-12-01):**
  - `fal-ai/flux-lora-fast-training`: **`$2.00` per 1,000 steps** (scales linearly with steps).
  - `fal-ai/flux-lora`: **`$0.035` per output megapixel** (or `$0` local ComfyUI after downloading `.safetensors`).
  - `fal-ai/wan-vace-14b`: **`$0.08` per output video second** at 720p (`$0.40` per 5s; or `$0` local Apache-2.0 ComfyUI).
- **FFmpeg Modern Flag Rule:** Use `-fps_mode cfr` (NEVER removed `-vsync cfr` on FFmpeg 7–9).

## 2. FLUX LoRA Training (`queue.fal.run/fal-ai/flux-lora-fast-training`)
1. Verify local dataset folder first: `12–20` sharp (`>=768px`) varied stills for characters/SKUs (`is_style: false`, `create_masks: true`) OR `15–25` diverse subjects for house art styles (`is_style: true`, `create_masks: false`). Reject blurry `<768px` frames.
2. Enforce a rare synthetic `trigger_word` (e.g., `ff_brand_v1`, never an English dictionary word).
3. Queue training asynchronously:
```bash
curl -sS -X POST "https://queue.fal.run/fal-ai/flux-lora-fast-training" \
  -H "Authorization: Key $FAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "images_data_url": "'"$ZIP_URL"'",
    "trigger_word": "'"$TRIGGER"'",
    "steps": 1000,
    "is_style": false,
    "create_masks": true
  }'
```
4. Poll `status_url` until `COMPLETED`, fetch `response_url`, and **immediately download `diffusers_lora_file.url`** via `curl -fsSL` into local permanent storage / `ComfyUI/models/loras/` (NEVER `models/checkpoints/`).
5. Run a 4-image calibration strip (`$0.14`) on `fal-ai/flux-lora` locking `seed: 4096` and `guidance_scale: 3.5` across `scale` `[0.65, 0.78, 0.88, 1.00]`. Production sweet spot is almost always `0.78–0.88`.

## 3. Wan VACE 14B Video Object Removal (`queue.fal.run/fal-ai/wan-vace-14b`)
1. Conform raw phone/VFR footage to constant 24fps CFR and save 48 kHz WAV audio first:
```bash
ffmpeg -v warning -y -i raw.mov -r 24 -fps_mode cfr -pix_fmt yuv420p -c:v libx264 -crf 16 -an plate_cfr24.mp4
ffmpeg -v warning -y -i raw.mov -vn -c:a pcm_s16le -ar 48000 original_audio_48k.wav
```
2. Dilate any Meta SAM 2 binary mask video by `+11–12px` radially so cast shadows sit inside the white inpaint area:
```bash
ffmpeg -v warning -y -i sam2_mask.mp4 \
  -vf "format=gray,boxblur=12:1,lut=y='if(gt(val,18),255,0)',boxblur=2:1,format=yuv420p" \
  -r 24 -fps_mode cfr -c:v libx264 -crf 18 -an mask_dilated.mp4
```
3. **Prompt Rule:** NEVER name the deleted object in `prompt`! Describe strictly the revealed clean background; put unwanted items in `negative_prompt`.
4. Submit async to `queue.fal.run/fal-ai/wan-vace-14b` with `match_input_frames_per_second: true` and `match_input_num_frames: true`, download result MP4, and re-mux `original_audio_48k.wav`.
````

## Example Input

```text
Train a custom FLUX LoRA for our ceramic bottle from ./bottle_shots (trigger ff_bottle_v1, 1,000 steps), download the .safetensors file permanently, and run a 4-scale calibration strip at CFG 3.5.
```

## Expected Output

```text
Pre-flight estimate: $2.00 training (1,000 steps) + $0.14 calibration (4 × $0.035/MP) = $2.14.
1) Audited ./bottle_shots -> 16 valid >=1024px stills packed into lora_dataset.zip (0 skipped).
2) Queued fal-ai/flux-lora-fast-training via queue.fal.run (is_style=false, create_masks=true) -> COMPLETED in 168s.
3) Archived ff_bottle_v1.safetensors (84 MB) locally -> ready for cloud or ComfyUI/models/loras/.
4) Generated 4-scale strip (0.65 / 0.78 / 0.88 / 1.00, seed 4096, guidance_scale 3.5) -> scale 0.82 cleanest.
```

## Requirements

- FAL_KEY exported in environment, plus curl, jq, Python 3 + Pillow, and FFmpeg 5.1–9.x
- Claude Code, Cursor, or Codex agent workspace

## Known Limits

- Verify local FLUX base checkpoint commercial rights if loading downloaded .safetensors offline in ComfyUI
- Wan VACE 14B outputs native 720p—chain Topaz Video Upscale API ($0.08/s) or composite inside a feathered mask over untouched 4K plates

## Implementation Notes

## Automate async fal.ai LoRA training & Wan VACE 14B editing safely

This skill teaches your coding agent the exact queue architecture, dataset quality checks, FFmpeg 9.x `-fps_mode cfr` conform commands, and `+12px` binary matte dilation required to run [FLUX LoRA Fast Trainer](/specs/flux-lora-trainer) (`$2.00`) and [Alibaba Wan VACE 14B](/specs/wan-vace-14b) (`$0.08/s`) reliably under one `FAL_KEY` without hitting 504 gateway timeouts or ghost shadow artifacts.

Explore all fal.ai agent workflows on our [fal.ai Skills Directory](/skills/for/fal-ai), or pair with [Workflow 51](/workflows/custom-flux-lora-brand-style-and-character-training-pipeline) and [Workflow 52](/workflows/sam2-masking-and-wan-vace-video-object-removal-pipeline).
