  We present the matrix models that are the generating functions for branched
covers of the complex projective line ramified over $0$, $1$, and $\infty$
(Grotendieck's dessins d'enfants) of fixed genus, degree, and the ramification
profile at infinity. For general ramifications at other points, the model is
the two-logarithm matrix model with the external field studied previously by
one of the authors (L.Ch.) and K.Palamarchuk. It lies in the class of the
generalised Kontsevich models (GKM) thus being the Kadomtsev--Petviashvili (KP)
hierarchy $\tau$-function and, upon the shift of times, this model is
equivalent to a Hermitian one-matrix model with a general potential whose
coefficients are related to the KP times by a Miwa-type transformation. The
original model therefore enjoys a topological recursion and can be solved in
terms of shifted moments of the standard Hermitian one-matrix model at all
genera of the topological expansion. We also derive the matrix model for clean
Belyi morphisms, which turns out to be the Kontsevich--Penner model introduced
by the authors and Yu. Makeenko. Its partition function is also a KP hierarchy
tau function, and this model is in turn equivalent to a Hermitian one-matrix
model with a general potential. Finally we prove that the generating function
for general two-profile Belyi morphisms is a GKM thus proving that it is also a
KP hierarchy tau function in proper times.
