We discuss here constraints on the particle acceleration models from the observed gamma-ray bursts spectra . The standard synchrotron shock model assumes that some fraction of available energy is given instantaneously to the electrons which are injected at high Lorentz factor . The emitted spectrum in that case corresponds to the spectrum of cooling electrons , F _ { \nu } \propto \nu ^ { -1 / 2 } , is much too soft to account for the majority of the observed spectral slopes . We show that continuous heating of electrons over the life-time of a source is needed to produce hard observed spectra . In this model , a prominent peak develops in the electron distribution at energy which is a strong function of Thomson optical depth \tau _ { T } of heated electrons ( pairs ) . At \tau _ { T } \gtrsim 1 , a typical electron Lorentz factor \langle \gamma \rangle \sim 1 - 2 and quasi-thermal Comptonization operates . It produces spectrum peaking at a too high energy . Optical depths below 10 ^ { -4 } would be difficult to imagine in any physical scenario . At \tau _ { T } \approx 10 ^ { -4 } – 10 ^ { -2 } , \langle \gamma \rangle \sim 30 - 100 and synchrotron self-Compton radiation is the main emission mechanism . The synchrotron peak should be observed at 10–100 eV , while the self-absorbed low-energy tail with F _ { \nu } \propto \nu ^ { 2 } can produce the prompt optical emission ( like in the case of GRB 990123 ) . The first Compton scattering radiation by nearly monoenergetic electrons peaks in the BATSE energy band and can be as hard as F _ { \nu } \propto \nu ^ { 1 } reproducing the hardness of most of the observed GRB spectra . The second Compton peak should be observed in the high-energy gamma-ray band , possibly being responsible for the 10–100 MeV emission detected in GRB 941017 . A significant electron-positron pair production reduces the available energy per particle , moving spectral peaks to lower energies as the burst progresses .