In this paper we introduce two algorithms for stable approximation with and recovery of short cosine sums. The used signal model contains cosine terms with arbitrary real positive frequency parameters and therefore strongly generalizes usual Fourier sums. The proposed methods both employ a set of equidistant signal values as input data. The ESPRIT method for cosine sums is a Prony-like method and applies matrix pencils of Toeplitz + Hankel matrices while the ESPIRA method is based on rational approximation of DCT data and can be understood as a matrix pencil method for special Loewner matrices. Compared to known numerical methods for recovery of exponential sums, the design of the considered new algorithms directly exploits the special real structure of the signal model and therefore usually provides real parameter estimates for noisy input data, while the known general recovery algorithms for complex exponential sums tend to yield complex parameters in this case.