Tannin (TA), as a natural phenolic compound with strong antioxidant activity, has been used as a feed additive for various animals. In this study, we fed a diet containing 800 mg/kg of tannin on Litopenaeus vannamei for 56 days and then subjected to acute ammonia stress for 48 hr to investigate the effect of dietary tannin on the ammonia stress response of L. vannamei through transcriptomic and metabolomic analysis. The transcriptome analysis indicated that ammonia stress-induced differential expression of 4,185 genes, while tannin-fed shrimp only had 964 differentially expressed genes. Compared with the TA_0 group, 59 pathways were significantly altered, and the pathways of “starch and sucrose metabolism,” “retinol metabolism,” “arachidonic acid metabolism,” “lysosome,” and “amino sugar and nucleotide sugar metabolism” were highly enriched in the TS_0 group. Compared with the TS_0 group, six pathways were significantly altered, and the pathways of “dilated cardiomyopathy,” “complement and coagulation cascades,” “cardiac muscle contraction,” “fructose and mannose metabolism,” “cGMP-PKG signaling pathway,” and “beta-alanine metabolism” were significantly enriched in the TS_800 group. Metabolomic analysis showed that a total of 107 differential metabolites (DMs) were identified in the TS_0 vs. TA_0 group, while 75 DMs were identified in the TS_800 vs. TS_0 group. Based on KEGG annotation, it was found that a large amount of DM was significantly enriched in amino acid metabolism pathways in the TS_0 group, including “arginine and proline metabolism,” “alanine, aspartic acid, and glutamic acid metabolism,” “β-Alanine metabolism and tyrosine metabolism” indicated that tannins affect the metabolism of amino acids. The integration of DEGs and DMs indicates that dietary tannins highly alter the digestion and absorption functions of proteins, as well as the biosynthesis and metabolism of amino acids. This study provides new insights into the adaptation of Pacific white shrimp to ammonia stress and the addition of tannins to feed to enhance immune function.