Primary cilia are shown to adjust length in response to cellular nutrient availability, with a special role for glutamine-mediated anaplerosis via the enzyme ASNS, which was found to be located at the base of cilia. Consistently, cells lacking cilia show an altered response to glutamine during metabolic stress.Depriving cells of nutrients triggers an energetic crisis, which is resolved by metabolic rewiring and organelle reorganization. Primary cilia are microtubule-based organelles at the cell surface, capable of integrating multiple metabolic and signalling cues, but their precise sensory function is not fully understood. Here we show that primary cilia respond to nutrient availability and adjust their length via glutamine-mediated anaplerosis facilitated by asparagine synthetase (ASNS). Nutrient deprivation causes cilia elongation, mediated by reduced mitochondrial function, ATP availability and AMPK activation independently of mTORC1. Of note, glutamine removal and replenishment is necessary and sufficient to induce ciliary elongation or retraction, respectively, under nutrient stress conditions both in vivo and in vitro by restoring mitochondrial anaplerosis via ASNS-dependent glutamate generation. Ift88-mutant cells lacking cilia show reduced glutamine-dependent mitochondrial anaplerosis during metabolic stress, due to reduced expression and activity of ASNS at the base of cilia. Our data indicate a role for cilia in responding to, and possibly sensing, cellular glutamine levels via ASNS during metabolic stress.