In traditional thermodynamics the Carnot cycle yields the ideal performance
bound of heat engines and refrigerators. We propose and analyze a minimal model
of a heat machine that can play a similar role in quantum regimes. The minimal
model consists of a single two-level system with periodically modulated energy
splitting that is permanently, weakly, coupled to two spectrally-separated heat
baths at different temperatures. The equation of motion allows to compute the
stationary power and heat currents in the machine consistently with the
second-law of thermodynamics. This dual-purpose machine can act as either an
engine or a refrigerator (heat pump) depending on the modulation rate. In both
modes of operation the maximal Carnot efficiency is reached at zero power. We
study the conditions for finite-time optimal performance for several variants
of the model. Possible realizations of the model are discussed