Objective. The performance of silicon detectors with moderate internal gain, named low-gain avalanche diodes (LGADs), was studied to investigate their capability to discriminate and count single beam particles at high fluxes, in view of future applications for beam characterization and on-line beam monitoring in proton therapy. Approach. Dedicated LGAD detectors with an active thickness of 55 μm and segmented in 2 mm2 strips were characterized at two Italian proton-therapy facilities, CNAO in Pavia and the Proton Therapy Center of Trento, with proton beams provided by a synchrotron and a cyclotron, respectively. Signals from single beam particles were discriminated against a threshold and counted. The number of proton pulses for fixed energies and different particle fluxes was compared with the charge collected by a compact ionization chamber, to infer the input particle rates. Main results. The counting inefficiency due to the overlap of nearby signals was less than 1% up to particle rates in one strip of 1 MHz, corresponding to a mean fluence rate on the strip of about 5 × 107 p/(cm2·s). Count-loss correction algorithms based on the logic combination of signals from two neighboring strips allow to extend the maximum counting rate by one order of magnitude. The same algorithms give additional information on the fine time structure of the beam. Significance. The direct counting of the number of beam protons with segmented silicon detectors allows to overcome some limitations of gas detectors typically employed for beam characterization and beam monitoring in particle therapy, providing faster response times, higher sensitivity, and independence of the counts from the particle energy.