The purpose of this study was to investigate the effects of melittin on production performance, antioxidant function, immune function, heat shock protein, intestinal morphology, and cecal microbiota of heat-stressed quails. A total of 120 (30-day-old) male quails were randomly divided into 3 groups. Each group consisted of 4 replicates with 10 birds per replicate. The ambient temperature of the control group (group W) was 24°C ± 2°C. The heat stress group (group WH) and the heat stress+melittin group (group WHA2) were subjected to heat stress for 4 h from 12:00 to 16:00 every day, and the temperature was 36°C ± 2°C for 10 d. The results showed that compared with the group W, heat stress significantly decreased growth performance, serum and liver antioxidative function, immune function, intestinal villus height (VH) and villus height-to-crypt depth ratio (VH/CD), and cecal microbiota Chao and ACE index (P < 0.05). The crypt depth (CD) in the small intestine, and HSP70 and HSP90 mRNA levels in the heart, liver, spleen, and kidney were significantly increased (P < 0.05). Dietary melittin significantly increased growth performance, serum and liver antioxidative function, immune function, intestinal VH and VH/CD, and cecal microbiota Shannon index in heat-stressed quails (P < 0.05). Melittin significantly decreased small intestinal CD, and HSP70 and HSP90 mRNA levels in the viscera (P < 0.05). Furthermore, dietary melittin could have balanced the disorder of cecal microbiota caused by heat stress and increased the abundance and diversity of beneficial microbiota (e.g., Firmicutes were significantly increased). PICRUSt2 functional prediction revealed that most of the KEGG pathways with differential abundance caused by high temperature were related to metabolism, and melittin could have restored them close to normal levels. Spearman correlation analysis showed that the beneficial intestinal bacteria Anaerotruncus, Bacteroidales_S24-7_group_norank, Lachnospiraceae_unclassified, Shuttleworthia, and Ruminococcaceae_UCG-014 increased by melittin were positively correlated with average daily feed intake, the average daily gain, serum and liver superoxide dismutase, IgG, IgA, bursa of Fabricius index, and ileum VH and VH/CD. In sum, our results demonstrate for the first time that dietary melittin could improve the adverse effects of heat stress on antioxidant function, immune function, heat shock protein, intestinal morphology, and cecal microbiota in quails, consequently improving their production performance under heat stress.