Active inference (AIF) is a theory of the behavior of information-processing open dynamic systems. It describes them as generative models (GM) generating inferences on the causes of sensory input they receive from their environment. Based on these inferences, GMs generate predictions about sensory input. The discrepancy between a prediction and the actual input results in prediction error. GMs then execute action policies predicted to minimize the prediction error. The free-energy principle provides a rationale for AIF by stipulating that information-processing open systems must constantly minimize their free energy (through suppressing the cumulative prediction error) to avoid decay. The theory of homeostasis and allostasis has a similar logic. Homeostatic set points are expectations of living organisms. Discrepancies between set points and actual states generate stress. For optimal functioning, organisms avoid stress by preserving homeostasis. Theories of AIF and homeostasis have recently converged, with AIF providing a formal account for homeo- and allostasis. In this paper, we present bacterial chemotaxis as molecular AIF, where mutual constraints by extero- and interoception play an essential role in controlling bacterial behavior supporting homeostasis. Extending this insight to the brain, we propose a conceptual model of the brain homeostatic GM, in which we suggest partition of the brain GM into cognitive and physiological homeostatic GMs. We outline their mutual regulation as well as their integration based on the free-energy principle. From this analysis, affect and self-efficacy emerge as the main regulators of the cognitive homeostatic GM. We suggest fatigue and depression as target neurocognitive phenomena for studying the neural mechanisms of such regulation.