We present a new concept of spectroscopic sensor based on optomechanical transduction. The optomechanical interaction induces a strong dependence of the mechanical properties of a membrane on the optical losses induced by the absorption of an intra-cavity gas. Optically quantifying the variation of these parameters allows us to measure the gas concentration. The system is analysed theoretically and numerically with FEM simulation to estimate the responsivity. Fiber Bragg Grating based Extrinsic Fiber Fabry-Pérot cavity of various types as well as integrated mid-infrared cavities with highly reflective Bragg multilayers mirrors and silicon or stoichiometric silicon nitride membrane are studied.