In the natural conception group, after adjusting for age, BMI, pregnancy weight gain, delivery gestational week, nulliparous, assisted reproduction, pregnancy hypertension, and pre-existing diabetes, elevated ALT levels directly affected neonatal birth weight (β = 0.0292, 95% CI: 0.0097–0.0627), while GDM had an indirect effect on neonatal birth weight (β = 0.0026, 95% CI: 0.0010–0.0048), with GDM accounting for 8.4% of the mediation effect. Here, GPT is linked to gestational diabetes.