Skip to main content
A catalog has hundreds of products and each needs a short video. Starting from the photo you already have keeps the product exact: the vision model says what it is, a writer turns that into a two-scene script, an image model puts the same product in two new settings, one of them gets five seconds of camera motion, and a voice reads the line. It costs about 37 cents an ad, and the end card carries the tagline as type in the image, so nothing depends on fonts in your ffmpeg build.

Build it in your project

Paste this line into your agent (Claude Code, Codex, Cursor, OpenCode, Cline). It sets up your key, then builds the pipeline in your project:

The code

One file per language. Both read RUNCRATE_API_KEY from the environment; nothing secret is in the code.

What the proof run cost

The Python file on a studio photo of a glass bottle. Measured on 2026-10-23 against api.runcrate.ai; costs are what the account was billed, read from each response’s X-LLM-Cost header or usage.cost. The first Python run stopped at the mux on an ffmpeg without drawtext; the rerun reused the paid video and cost $0.0090 more. The TypeScript file end to end: $0.3735 in 217 s.

Scale it

  • A catalog: one ad per product is independent work, so run products in parallel (a thread pool locally, or a job group with one product per --params entry).
  • Variants for testing: the scene edits cost a tenth of a cent each, so make five end cards and pick; only the video costs real money.
  • The step that costs is cached: a rerun after a later failure does not pay for the video again (the script skips it when out/scene1.mp4 exists).
  • Ten-second ads: duration: 10 on Kling v2.6 doubles the video cost, and generate_audio: true doubles it again.

Gotchas found in the proof run

  • black-forest-labs/FLUX.1-kontext-dev hung for over 15 minutes on the first edit on the proof day, and a direct retry timed out at 180 s. FLUX.2 klein took 1.6 to 3.5 s for the same edit, with the reference passed as images: [data_url].
  • Image models answer JPEG, PNG or WebP whatever you name the file. The script sniffs the bytes before it sends a data URL, so a WebP saved as .jpg is still labelled right.
  • Homebrew’s ffmpeg has no drawtext, so a tagline drawn by ffmpeg fails there. Asking the image model for the words in the end card worked first time.
  • Kling v2.6 bills per second of the length you ask for, at $0.0735 a second without audio (catalog price on the day).