**Comparative inner ear sample**

Three inner ear samples were analysed referred to as the 3D bony, 3D membranous and 2D membranous samples, comprising 341 species (Supplementary Methods). The 3D bony sample consists of 3D endocasts of bony semicircular canals (SC) of 234 extant species [7 amphibians, 67 lepidosaurs (69 specimens), 6 turtles, 9 crocodylians, 72 birds, 73 mammals], and 64 extinct species [1 diadectomorph, 3 non-saurian reptiles, 1 archosauromorph, 2 non-therapsid synapsids, 5 non-neotherapsid therapsids (6 specimens), 16 anomodonts (19 specimens), 5 gorgonopsians, 6 therocephalians (7 specimens), 9 non-probainognathian cynodonts (11 specimens), 3 non-mammaliamorph probainognathians, 9 non-mammalian mammaliamorphs (11 specimens), 4 mammals]. We used non-synapsid fossils to test the method outside the clade of interest at deep divergence time points. The 3D membranous sample consists of 3D endocasts of membranous semicircular ducts (SD) of 50 extant species (1 crocodylian, 9 birds, 3 lepidosaurs, 1 turtle51, 30 mammals, 3 amphibians52, 3 fishes53-55) Except for fishes, the corresponding bony endocasts of these specimens are part of the 3D bony sample. The 2D membranous sample consists of published photographs56-61 and measurements36 of membranous labyrinths of 40 extant fish species (19 chondrichthyans, 21 actinopterygians). The lists of specimens and measurements are provided in Supplementary Data 2.

**Data acquisition and processing**

The SC endocasts in the 3D bony sample were downloaded from MorphoSource.org or segmented using Amira 5.3.3 (Visage Imaging Inc. & Konrad-Zuse-Zentrum, Berlin, Germany) from existing and new computed tomography (CT) images obtained with μCT, or propagation phase-contrast synchrotron microtomography (Extended Data Fig. 1). Segmentation was done based on the contrast between bone and air for extant specimens, but manually for fossils. A wax endocast model of *Dimetrodon* sp. (FMNH PR 4976) was digitized using photogrammetry (Supplementary Note 1). The endocasts of SDs and SCs in the 3D membranous sample were segmented from µCT scans of the ear region of extant specimens, acquired from autopsies or museum collections and prepared as described previously27. Segmentation and additional processing27 was done in Avizo 7.1 (Visualization Science Group, Burlington, USA) and Geomagic Studio 12 (Raindrop Geomagic Inc, Morrisville, USA). Further information about the specimens and scans are given in Supplementary Data 3.

**Measurements of 3D specimens**

Four linear measurements were taken per SC for all specimens in the 3D bony and membranous samples: two-dimensional length of the slender portion27, cross-sectional diameter, and major and minor axes of each SC (Extended Data Fig. 2). These functionally relevant measurements mirror SD metrics and were designed to be expedite. The length of the slender portion is taken on the SD midline, which is closer to the outermost wall of the SC27,62,63, from the ampullar junction of the SD to the common crus or vestibule (Extended Data Fig. 2). The distal part of the slender portion of the lateral canal is often fused with the vestibule, especially in ectothermic taxa, and ends at the common crus wall. The major and minor axes are taken perpendicular to each other, following the ellipse that best fits the SD torus. They do not follow anatomical landmarks but their endpoints are placed on the SD midline (Extended Data Fig. 2). The radius of curvature and eccentricity of each SC torus was calculated from the semi-minor and semi-major axes, respectively taken as half the measured minor and major axes (Supplementary Methods). Measurements were taken five times and averaged to reduce error. Measurements of major and minor axes of the SC were taken using the ‘straight line’ tool of ImageJ64, on scaled screenshots from Amira or Avizo, where the screen plane was aligned to the plane of each SC. Measurement of lengths of slender portions27 were taken on the same screenshots, using the ‘segmented line’ tool of ImageJ. SC planes were approximated visually before taking screenshots. A comparison with a more accurate method, which use landmarks placed along each canal to find the best fitting SC planes, was made in XLSTAT 2018.1.165; no significant differences were found (paired Student t-test, N = 6, P = [0.054 – 0.93], two tailed). The cross-sectional diameter of each SC was measured in Amira, using the ‘SurfaceThickness’ tool, by selecting five distant points along the slender portion of the SC perpendicular to its plane and averaging their values (Extended Data Fig. 2). Cross-sectional diameters of problematic fossil specimens (e.g., showing obvious segmentation artefacts) were measured using the ‘straight line’ tool of ImageJ, on scaled screenshots where the plane of the SC was placed parallel to the screen plane. Seven fossil specimens (FMNH UR 161, BPI/1/375, MCZ 1161, GPIT/RE/7119, NHCC LB631, NHCC LB178, NHCC LB387) had incomplete SCs. We estimated missing measurements of these specimens in R v.4.0.366 with pls 2.7-367, using cross-validated partial least-square regressions on a set of 281 species with all measurements (Supplementary Data 2). Reproducibility was assessed in XLSTAT 2018.1.1 by comparing measurements taken by R.A. and R.D. on a subsample of 77 specimens. All 12 variables are left-skewed, and a two-tailed Kolmogorov-Smirnov showed no significant difference, p-value=[0.404-1.000]. Repeatability was tested by comparing measurements taken by R.A. and shows no significant intraobserver variation (repeatability scoring between 2.14 to 8.67%; signal to noise ratio minimum of 16.254 where >5 is considered adequate, Supplementary Data 4).

Morphological and functional analyses of the 3D membranous sample were performed using Ariadne Toolbox27. Input data included surfaces and linesets representing individual components of the duct system (e.g., slender parts and ampullae, modelled cupulae27). The average height of each cilia area was measured on the µCT scans. Endolymph density was taken as 1000 kg.m-3, Poisson ratio as 0.48 and cupula shear modulus as 1.44 Pa27. Output parameters included, among others, wall shape drag factor, three-dimensional length and cross-sectional area of the slender portion of each SD, enclosed area of the projection of each SD torus on its maximal response plane, and a transfer factor linking endolymph volume displacement to cilia deflection (deflection factor hereafter). Deflection factors of published specimens51-55 were estimated from average cupula thickness and cross-sectional area of the ampulla above the crista, following allometric regressions (Supplementary Note 2).

** **

**Measurements of 2D images**

The 2D membranous sample consists of published photographs56-61 and measurements36 of membranous labyrinths. We used ImageJ to process photographs and measure areas enclosed by SD torii, major and minor axes, lengths of slender portions, and inner duct radii (Supplementary Data 2). Photographs were generally taken in lateral view and show the planes of the anterior and posterior SDs at an angle, projected onto the sagittal plane. The resulting distortion can be corrected by multiplying the horizontal axis of the image by 1/cosine of the angle of a specific duct, providing a good representation of undistorted size and shape. Where available, the angles of the planes of the anterior and posterior ducts to the sagittal plane were measured in superior view. For specimens without a superior view, we generally used an angle of 45° to undistort the views (Supplementary Data 2). The undistorted views of the anterior and posterior ducts were used to measure corresponding SDs. When a superior view was available, measurements for the lateral SD were done on this view. For specimens without a superior view, the maximum distance measured between any points on the lateral semicircular duct in lateral view was taken as its major axis. Missing measurements were estimated in R, using cross-validated partial least-square regressions on a set with all measurements (Supplementary Data 2). Cross-sectional radii of bony canals were predicted from outer duct thickness, using allometric regressions (Supplementary Note 2).

**Body temperature, body size and phylogeny**

Body temperatures of extant species were obtained from the literature (Supplementary Data 2), supplemented by Traitbank (https://eol.org/traitbank). For ectothermic taxa, preferred body temperatures were chosen. When both activity range and preferred range of body temperatures were provided, we took the average of the latter. In a few instances (11 ectotherm species) we used online pet care information to estimate preferred body temperature. Values for fish species were obtained from FishBase (http://www.fishbase.org).

Three body size variables were used: condylobasal length, condylo-anteroorbital length, and square root of body mass. Condylobasal length (posteriormost border of the occipital condyle(s) to the anteriormost tip of the snout, projected onto the sagittal plane) was used to represent cranial size and could be measured for most specimens (Supplementary Data 2). To avoid bias introduced by snout lengths that are either exceptionally long (e.g., gharials) or short (e.g., anomodonts), we defined the condylo-anteroorbital length as the linear distance from the posteriormost border of the occipital condyle(s) to the anteriormost border of the orbit, projected onto the sagittal plane (see measurements in Supplementary Data 2). The body mass was measured whenever possible (Supplementary Data 2). We used typical adult values rather than extremes, and male and female values were averaged for sexually dimorphic species. For fossils and some specimens of the 3D bony sample, body mass was predicted using an allometric multiple regression of body mass and condylobasal and condylo-anteroorbital lengths (Supplementary Note 2). Predictions were refined by computing phylogenetically informed body mass residuals.

The phylogeny used in this study (Supplementary Data 5) was built in Mesquite 3.568, using relationships and divergence dates between extant taxa provided by TimeTree69 (http://www.timetree.org) as a backbone to which extinct clades and species where connected. Relationships at the level of Neoaves were modified from TimeTree to fit assumptions of other published accounts70,71. Relationships and divergence dates of actinopterygians and chondrichthyans that were not covered by TimeTree were obtained from the literature72-74. The reasoning behind phylogenetic relationships, divergence dates and last occurrence data is detailed in Supplementary Note 3 and follow best practices75.

**Defining the Thermo-Motility Index**

Following a single duct model, we characterize aspects of semicircular duct biomechanics using two parameters: the upper corner frequency, which limit the high frequency head motion optimally detected by the SD, and the gain to angular velocity, which determines sensitivity. The upper corner frequency and sensitivity of a SD can be expressed as26,27:

where ω2 is the upper corner frequency of the SD n (i.e., anterior, posterior and lateral); GV corresponds to its sensitivity; μ(T) is endolymph viscosity at temperature T; ρ is its density (1000kg.m-3); λμ,S and aS are the average wall shape drag factor and average cross-sectional area of the slender portion of the SD, respectively; Λ is the enclosed area of the projection of the SD torus on its maximal response plane; E is the deflection factor; and LS is the three-dimensional length of the slender portion of the SD (Supplementary Methods). As body size increases, upper corner frequencies of the SDs decrease while their sensitivities increase36, reflecting adaptations to more sluggish head motion. Similarly, as head motion becomes more vigorous (e.g., increased activity), increased upper corner frequencies and decreased sensitivities are predicted.

The aim of this study is to predict the thermal regime of extinct synapsids. Equ. 1 and 2 denote that increasing body temperature, as seen in endotherms, decrease upper corner frequencies and increase sensitivities of SDs, through endolymph viscosity. This would lead to degraded semicircular duct function if not compensated for, through morphological or physico-chemical adaptation of the SDs. Furthermore, as endotherms are more active than ectotherms of the same size34 (Supplementary Data 1), and show more vigorous head motion, they need even higher upper corner frequencies and lower sensitivities, leading to further SD adaptation. Tracking these SD adaptations thus offers an opportunity to assess the thermal regime of an organism, given its body size.

We re-expressed SD function to introduce the Thermo-Motility Index (TMI), which is positively related to body temperature and head motion and can be used to infer the thermal regime of an extinct organism. The TMI was designed to maximize membranous labyrinth information derived from preserved bony canals and facilitate comparisons of specimens of different body sizes (Supplementary Methods), because extinct organisms do not retain morphological information from the membranous labyrinth:

IB, IM and IE are the bony, membranous-only and endolymph parts of the TMI, respectively; P is either the upper corner frequency or sensitivity of the SD n and Z correspond to the body size variable; f(KH:Z) is a function that positively correlates to overall head motion KH relative to body size and reflects behavioural activity (Supplementary Methods); Cp,n,Z, CT1 and CT2 are constants; and ε is an error term reflecting the difference between SD function and head motion metrics.

Equ. 3 predicts that endotherms, which show higher body temperature, behavioural activity and overall head motion than ectotherms, will also have a higher TMI. Note from equation 3 that n × P × Z different TMIs can be computed, eighteen in the case of this study, representing all possible combinations of the anterior, posterior and lateral upper corner frequencies and sensitivities, and the three body size variables. These TMIs differ slightly but show similar patterns overall (Extended Data Fig. 5, Supplementary Data 2).

**The bony part of the TMI**

The bony part of the TMI maximizes functional information that can be obtained from bony canals while controlling for body size, and can be expressed as one of two equations, depending on whether the upper corner frequency or the sensitivity is considered (Equ. SM65 and 66 in Supplementary Methods). Variables of these equations correspond to the two-dimensional length and cross-sectional radius of the slender portion of a SC, both expressed relative to its radius of curvature; the radius of curvature of the SC, expressed relative to each body size variable; and the eccentricity of the SC torus. The radius of curvature was chosen as a scaling variable to isolate the effect of size and provide insight into the functional impact of the shape of the slender portion (relative length and thickness).

**The membranous-only part of the TMI**

The membranous-only part of the TMI corresponds to functional information measured from SDs that cannot be measured or estimated from bony SCs. It can be expressed as one of two equations, depending on whether upper corner frequency or sensitivity is considered (Equ. SM67 and 68 in Supplementary Methods). Variables of these equations correspond to the cross-sectional area of the slender portion of a SD, expressed relative to the radius of curvature and thickness of the slender portion of corresponding SC; the deflection factor of the cupula, expressed relative to the radius of curvature of corresponding SC; the wall shape drag factor; and two error terms, respectively relating the enclosed area of the SC and the length of its slender portion to corresponding measurements on the SD. Using measured variables, six different versions of the membranous-only part of the TMI were computed for each species in the 3D and 2D membranous sets. Then, for each specimen in the 3D bony set, the membranous-only part was predicted using values computed for the 3D membranous set, weighted according to phylogenetic relatedness.

**The endolymph part of the TMI**

The endolymph part of the TMI is related to endolymph viscosity through Eq. SM54 and 64 (Supplementary Methods). Data on endolymph viscosity at a given temperature has only been published for eight species (1 bird, 2 mammals, 5 euteleosts)32,42,76-81. Using published data, and these equations, we computed the endolymph parts for these species and found that, except for *Columba livia* and *Pleuronectes platessa*, they have low endolymph viscosity, close to that of water (Extended Data Fig. 4). The phylogenetic distribution of the endolymph part in available species indicates that low-viscosity endolymph was the basal condition for Euarchontoglires and Euteleostei, thus parsimoniously the basal condition for Osteichtyes too. This phylogenetic context allows us to assume *a priori* that the endolymph part of synapsid species did not differ from the basal condition. Following these observations, a low-viscosity endolymph part was chosen for all species analysed in this study except birds and pleuronectids. For non-avian diapsids, amphibians and chondrichthyans, theoretical and empirical relationships between the TMI and body temperature are consistent suggesting, *a posteriori*, the retention of low-viscosity endolymph in these taxa (Fig. 2).

**Statistical analyses**

Computation of TMIs and statistical analyses were done in R using packages phytools 0.7-7082, caper 1.0.183, geiger 2.0.784, phangorn 2.5.585, Rfast 2.0.186, phylogram 2.1.087 and ape 5.588. P-values were corrected by controlling the false discovery rate (fdr method).

Akaike weights were used for model averaging, and were obtained for each combination by regressing the body temperature ratio (Equ. 3) onto the TMI (Supplementary Note 2, Extended Data Fig. 5). To assess correlations between morphological parameters of SCs and the weighted TMI, we first computed raw averages of the relative canal thickness, the relative slender length, the relative radius of curvature and the eccentricity of the three SCs. We then computed phylogenetic contrasts of the weighted TMI and these average morphological parameters, and calculated Spearman correlations between them (Extended Data Table 1).

Logistic and phylogenetic logistic regressions were fitted to predict the thermoregulatory regime of extant amniote specimens from their weighted TMI (Supplementary Note 2). Resulting logistic regressions were used to predict probabilities of endothermy for each node of the tree and each fossil species, using corresponding weighted TMI (Fig. 3, Extended Data Fig. 6, Extended Data Table 2, 3). Weighted TMI of each node of the phylogenetic tree were obtained by maximum likelihood reconstruction of ancestral states under Brownian motion, using weighted TMI of all tips. Accuracy of predictions was assessed one hundred times by randomly selecting 151 extant species, fitting a logistic regression to predict their thermoregulatory regime from their weighted TMI, using the fitted logistic regression to predict the thermoregulatory regime of 75 extant species that were not used to produce the logistic regression, and comparing outcomes with real thermoregulatory regimes. An endothermic regime was predicted for a probability higher than 0.5 in these tests.