We present a model explaining the high-energy emission of blazars via the inverse Compton (IC) process, in the Thomson regime, of a relativistic electron-positron beam impinging on soft photons coming from a standard accretion disc. We use a simple formalism to treat the anisotropy of the disc emission, which is fully described by the Eddington parameters of the radiation field. Combined with the anisotropy of the particle distribution, this allows us to compute the anisotropic IC emitted power. We derive, self-consistently, the soft photon and particle densities by a hydrodynamical approach involving pair creation and annihilation processes. The computation of the opacity to pair production gives rise to an energy-dependent `gamma photosphere' where the opacity to pair production tau_lambdalambda(epsilon1)=1 (epsilon_1 is the photon energy). The location and luminosity of the emission zone are very strongly constrained, depending essentially on the central mass of the black hole and the accretion rate. The opacity effect enables us to reproduce the spectral break observed in the MeV range of radio loud quasars such as 3C273 and 3C279. The change in spectral index can exceed the value of 0.5 predicted by incomplete Compton cooling. This model gives a good fit of both spectra over ten decades in energy. We discuss the possible origin of the high variability of the quasars either from a sudden variation of the pair density, or from a helical motion of the beam.