We develop a model framework that can be used to derive the forward-looking credit loss distributions for banks' credit exposures, to use it for (1) assessing the adequacy of provisions at the bank-portfolio level; (2) macro stress testing; and (3) informing the sufficiency of capital requirements, both from a micro- and macro-prudential perspective. The model is semi-structural and simulation-based, entailing a large number of simulated macro-financial scenarios instead of employing handpicked scenarios and ad-hoc scenario weights. The way the model-based credit loss distributions are generated can be made compatible with IFRS 9 or any other accounting regime. The model codes are made available online along with this paper.