is the electromagnetic counterpart of the accreting supermassive black hole in the Galactic center. Its emission is variable in the near-infrared (NIR) and X-ray wavelengths on short timescales (several minutes to a few hours). The NIR light curve displays red-noise variability, while the X-ray light curve exhibits bright flares that rise by many orders of magnitude upon the stable X-ray quiescent emission. Every X-ray flare is associated with a bright NIR flux change, but the opposite is not always true. The physical origin of NIR and X-ray flares is still under debate. We introduce a model for the production of NIR and X-ray flares flares from an active region in where particle acceleration takes place intermittently. A fraction of electrons from their thermal pool is accelerated to higher energies while they radiate via synchrotron and synchrotron self-Compton (SSC) processes. in contrast to other radiation models for flares, the particle acceleration is not assumed to be instantaneous. We studied the evolution of the particle distribution and the emitted electromagnetic radiation from the flaring region by numerically solving the kinetic equations for electrons and photons. Our calculations took the finite duration of particle acceleration, radiative energy losses, and physical escape from the flaring region into account. To gain better insight into the relation of the model parameters, we complemented our numerical study with analytical calculations. Flares are produced when the acceleration episode has a finite duration. The rising part in the light curve of a flare is related to the particle acceleration timescale, while the decay is controlled by the cooling or escape timescale of particles. The emitted synchrotron spectra are power laws whose photon index is determined by the ratio of the acceleration and escape timescales, followed by an exponential cutoff. This occurs at the characteristic synchrotron photon energy emitted by particles with the maximum Lorentz factor (where energy loss and gain rates become equal). The NIR flux increases before the onset of the X-ray flare, and the time lag is linked to the particle acceleration timescale. Bright X-ray flares, such as the one observed in 2014, have gamma -ray counterparts that might be detected by the Cherenkov Telescope Array Observatory. Our generic model for NIR and X-ray flares favors an interpretation of diffusive nonresonant particle acceleration in magnetized turbulence. If direct acceleration by the reconnection electric field in macroscopic current sheets causes the energization of particles during flares in then models considering the injection of preaccelerated particles into a blob where particles cool and/or escape would be appropriate to describe the flare.