def image_to_video(
        self,
        image_url: str,
        save_at: str,
        duration: float,
        config: dict,
        prompt: Optional[str] = None,
    ):
        """
        Generate video from an image URL.
        """
        try:
            model_name = config.get("model_name", "fal-ai/fast-svd-lcm")
            arguments = {"image_url": image_url, "duration": duration}

            if model_name == "fal-ai/haiper-video/v2/image-to-video":
                arguments["duration"] = 6

            if prompt:
                arguments["prompt"] = prompt

            res = fal_client.run(
                model_name,
                arguments=arguments,
            )

            video_url = res["video"]["url"]

            with open(save_at, "wb") as f:
                f.write(requests.get(video_url).content)
        except Exception as e:
            raise Exception(f"Error generating video: {type(e).__name__}: {str(e)}")

        Generate video from an image URL.
        
backend/director/tools/fal_video.py