Catalyzes the production of D-threo-tetrahydrobiopterin (tetrahydrodictyopterin or DH4), also known as dictyopterin, and in a much smaller amount that of it's stereoisomer L-erythro-tetrahydrobiopterin ((6R)-L-erythro-5,6,7,8-tetrahydrobiopterin or BH4) (PubMed:16527408). Prefers 1-oxo-2-D-hydroxypropyl-tetrahydropterin to 6-pyruvoyltetrahydropterin (6-pyruvoyl-5,6,7,8-tetrahydropterin) as a substrate, thereby maintaining dominant production of DH4 over BH4 in sufficient supply of an aldose reductase-like enzyme (PubMed:16527408). DH4 represents more than 95% of the total tetrahydrobiopterin production. It has a direct antioxidant function to protect mitochondria against oxidative stress (PubMed:17976377). Essential for the last step of BH4 synthesis (PubMed:10987137, PubMed:15896778). Also catalyzes the conversion of sepiapterin to L-erythro-7,8-dihydrobiopterin, which is then reduced to BH4 by dihydrofolate reductase, constituting the salvage pathway of BH4 (PubMed:10987137). L-erythro-7,8-dihydrobiopterin + NADP(+) = H(+) + NADPH + sepiapterin (6R)-L-erythro-5,6,7,8-tetrahydrobiopterin + 2 NADP(+) = 6-pyruvoyl-5,6,7,8-tetrahydropterin + 2 H(+) + 2 NADPH Inhibited by N-acetylserotonin and to a lesser extent by melatonin. Optimum pH is 5.5. Optimum temperature is 30 degrees Celsius. Mutant cells produce about 3% of tetrahydropteridines when compared to wild-type production. They display retarded growth, poor spore viability, impaired mitochondrial function, and increased susceptibility to oxidative stress induced by hydroxylamine or cumene-hydroperoxide. In another mutant, it was found 18% of BH4 and 0.6% of DH4 production of the wild-type level. Belongs to the sepiapterin reductase family. Dictyopterin was not identified in one of the enzymatic assays [PubMed:10987137].