Piperidine and indolizidine are two basic units of alkaloids that are frequently observed in natural and synthetic compounds. Their biosynthesis in natural products is highly conserved and mostly derived from the incorporation of lysine cyclization products. Through in vitro reconstitution, we herein identified a novel pathway involving a group of polyketide-derived indolizidines, which comprises the processes of tandem two-electron thioester reduction, transamination, and imine reduction to convert acyl carrier protein (ACP)-tethered polyketide chains into the piperidine moieties of their indolizidine scaffolds. The enzymes that catalyze the imine reduction are distinct from previous known imine reductases, which have a fold of acyl-CoA dehydrogenase but do not require flavin for reduction. Our results not only provide a new way for the biosynthesis of the basic units of alkaloids but also show a novel class of imine reductases that may benefit the fields of biocatalysis and biomanufacturing.