promptdojo_
Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Final drill. Synthesize price + retake + quality into a router: route_to_model(budget, quality_floor, retake_tolerance) that takes:

  • budget (float): max dollars per finished minute the user can spend.
  • quality_floor (str): minimum acceptable quality, one of "ai_flavored", "client_grade", "premium".
  • retake_tolerance (float): the retake multiplier the user expects to hit.

Each model has a quality_tier per this table:

Modelquality_tier$/sec
Hailuo 02 (768p)ai_flavored0.045
Veo 3.1 Lite (720p)ai_flavored0.05
Kling 3.0 standardclient_grade0.084
Sora 2 (720p)client_grade0.10
Sora 2 Pro (720p)premium0.30
Veo 3 (with audio)premium0.40
Sora 2 Pro (1024p)premium0.50

Quality ordering (each tier accepts higher tiers as substitutes): ai_flavored < client_grade < premium. So if quality_floor == "client_grade", both client_grade and premium models are eligible.

Algorithm:

  1. Filter models down to those whose quality_tier is >= quality_floor.
  2. Compute each eligible model's $/min real = price_per_sec × 60 × retake_tolerance.
  3. Keep only models where $/min real <= budget.
  4. From the remaining set, return the CHEAPEST one (lowest $/min real). On a tie, prefer the model that appears EARLIER in the PRICES dict order.
  5. If no model fits, return "NO MATCH".

Five scenarios run. Expected output:

$10 + ai_flavored + 2.5x       -> Hailuo 02 (768p)
$20 + client_grade + 3.0x      -> Kling 3.0 standard
$50 + premium + 1.5x           -> Sora 2 Pro (720p)
$200 + premium + 4.0x          -> Sora 2 Pro (720p)
$2 + client_grade + 5.0x       -> NO MATCH

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.