In ectothermic organisms, it is hypothesized that metabolic rates mediate influences of temperature on the ecological and evolutionary processes governing biodiversity. However, it is unclear how and to what extent the influence of temperature on metabolism scales up to shape large-scale diversity patterns. In order to clarify the roles of temperature and metabolism, new theory is needed. Here, we establish such theory and model eco-evolutionary dynamics of trophic networks along a broad temperature gradient. In the model temperature can influence, via metabolism, resource supply, consumers' vital rates and mutation rate. Mutation causes heritable variation in consumer body size, which diversifies and governs consumer function in the ecological network. The model predicts diversity to increase with temperature if resource supply is temperature-dependent, whereas temperature-dependent consumer vital rates cause diversity to decrease with increasing temperature. When combining both thermal dependencies, a unimodal temperature-diversity pattern evolves, which is reinforced by temperature-dependent mutation rate. Studying coexistence criteria for two consumers showed that these outcomes are owing to temperature effects on mutual invasibility and facilitation. Our theory shows how and why metabolism can influence diversity, generates predictions useful for understanding biodiversity gradients and represents an extendable framework that could include factors such as colonization history and niche conservatism.