The image formation in coded aperture spectral imagers is key information for processing the acquired compress data, and the optical system design and calibration of these instruments require great care. We propose an analytical model for CASSI systems that builds upon ray-tracing equations of each optical component. The model takes into account optical distortions, sampling effects, and optical misalignments, and allows accurate modeling and fast calibration. Numerical comparisons with a simpler model usually exploited in the literature are provided, and an experimental validation is presented.