Abstract:[Objective] To explore the vitamin B12 synthesis in ruminant gastrointestine and evaluate the effect of Lactobacillus plantarum (LAC) or Macleaya cordata (MAC) on the synthesis of vitamin B12 by the ileal microbiota of weaned goats. [Methods] Twenty weaned black goats with similar body weights and ages were randomly assigned into a control group (n=7), a LAC group (n=7), and a MAC group (n=6). The control group was fed with a normal diet, and the LAC and MAC groups with normal diets supplemented with LAC P-8 at 4.0×109 CFU/g and 0.3 g/d MAC (3.75%), respectively. The contents in the middle section of ileum were collected for metagenomic sequencing. VB12Path and KEGG were employed to analyze the sequencing results. [Results] A total 55 and 49 key genes associated with vitamin B12 synthesis were identified in VB12Path and KEGG, respectively. The alpha and beta diversity of genes involved in vitamin B12 synthesis were changed by the supplementation of LAC or MAC (P<0.05). Compared with that in the control group, the diversity of the LAC group showed little difference and that of the MAC group decreased (P<0.05). The abundance of genes involved in precorrin-2 synthesis pathway, aerobic and anaerobic synthesis pathways, salvage pathway, and Post-AdoCbi-P pathway (e.g., gltX, cbiT, cobT, and btuD) in LAC and MAC groups was higher than that in the control group. [Conclusion] The supplementation of LAC or MAC enhanced the synthesis of vitamin B12 by ileal microorganisms. This study expands our understanding and analytical method of the microbial vitamin B12 synthesis.