Catalyzes the NAD(P)H-dependent reduction of ketopantoate into pantoic acid. (R)-pantoate + NAD(+) = 2-dehydropantoate + H(+) + NADH (R)-pantoate + NADP(+) = 2-dehydropantoate + H(+) + NADPH Cofactor biosynthesis; coenzyme A biosynthesis. Belongs to the ketopantoate reductase family.