Inelastic losses are crucial to a quantitative analysis of x-ray absorption spectra. However, current treatments are semi-phenomenological in nature. Here a first-principles, many-pole generalization of the plasmon-pole model is developed for improved calculations of inelastic losses. The method is based on the GW approximation for the self-energy and real space multiple scattering calculations of the dielectric function for a given system. The model retains the efficiency of the plasmonpole model and is applicable both to periodic and aperiodic materials over a wide energy range.The same many-pole model is applied to extended GW calculations of the quasiparticle spectral function. This yields estimates of multi-electron excitation effects, e.g., the many-body amplitude factor S 2 0 due to intrinsic losses. Illustrative calculations are compared with other GW calculations of the self-energy, the inelastic mean free path, and experimental x-ray absorption spectra.