We focus on a recently experimentally realized scenario of normal-metal-insulator-superconductor tunnel junctions coupled to a superconducting resonator. We develop a first-principles theory to describe the effect of photon-assisted electron tunneling on the quantum state of the resonator. Our results are in very good quantitative agreement with the previous experiments on refrigeration and heating of the resonator using the photon-assisted tunneling, thus providing a stringent verification of the developed theory. Importantly, our results provide simple analytical estimates of the voltage-tunable coupling strength and temperature of the thermal reservoir formed by the photon-assisted tunneling. Consequently, they are used to introduce optimization principles for initialization of quantum devices using such a quantum-circuit refrigerator. Thanks to the first-principles nature of our approach, extension of the theory to the full spectrum of quantum electric devices seems plausible.