Current response and gain spectrum of a terahertz quantum cascade laser is analyzed at different temperatures by a non equilibrium Green's functions approach. The simulations are compared to recent results of time domain spectroscopy. Being able to retrieve higher harmonics of the response function, nonlinear phenomena in quantum cascade lasers are studied theoretically. For different temperatures, gain is simulated under operating conditions and related to the intensity inside the cavity, showing the degradation of performance with temperature. Resolving the electron densities in energy, shows the breakdown of inversion at high intensities.