In this paper, we propose an energy functional at the level of DFT + U + V that allows us to compute selfconsistently the values of the onsite interaction, Hubbard U and Hund J, as well as the intersite interaction V. This functional extends the previously proposed ACBN0 functional [L. A. Agapito et al., Phys. Rev. X 5, 011006 (2015)] including both onsite and intersite interactions. We show that this ab initio self-consistent functional yields improved electronic properties for a wide range of materials, ranging from sp materials to strongly correlated materials. This functional can also be seen as an alternative general and systematic way to construct parameter-free hybrid functionals, based on the extended Hubbard model and a selected set of Coulomb integrals, and might be used to develop novel approximations. By extending the DFT + U method to materials where strong local and nonlocal interactions are relevant, this work opens the door to the ab initio study the electronic, ionic, and optical properties of a larger class of strongly correlated materials in and out of equilibrium.