  Recent associations of high-energy neutrinos with active galactic nuclei
(AGN) have revived the interest in leptohadronic models of radiation from
astrophysical sources. The rapid increase in the amount of acquired
multi-messenger data will require soon fast numerical models that may be
applied to large source samples. We develop a time-dependent leptohadronic
code, LeHaMoC, that offers several notable benefits compared to other existing
codes, such as versatility and speed. LeHaMoC solves the Fokker-Planck
equations of photons and relativistic particles (i.e. electrons, positrons,
protons, and neutrinos) produced in a homogeneous magnetized source that may
also be expanding. The code utilizes a fully implicit difference scheme that
allows fast computation of steady-state and dynamically evolving physical
problems. We first present test cases where we compare the numerical results
obtained with LeHaMoC against exact analytical solutions and numerical results
computed with ATHE$\nu$A, a well-tested code of similar philosophy but
different numerical implementation. We find a good agreement (within 10-30%)
with the numerical results obtained with ATHE$\nu$A without evidence of
systematic differences. We then demonstrate the capabilities of the code
through illustrative examples. First, we fit the spectral energy distribution
from a jetted AGN in the context of a synchrotron-self Compton model and a
proton-synchrotron model using Bayesian inference. Second, we compute the
high-energy neutrino signal and the electromagnetic cascade induced by hadronic
interactions in the corona of NGC 1068. LeHaMoC is easily customized to model a
variety of high-energy astrophysical sources and has the potential to become a
widely utilized tool in multi-messenger astrophysics.
