Abstract : In this paper we construct weighted path models to compute Whittaker vectors in the completion of Verma modules, as well as Whittaker functions of fundamental type, for all finite-dimensional simple Lie algebras, affine Lie algebras, and the quantum algebra $U_q(\mathfrak{sl}_{r+1})$. This leads to series expressions for the Whittaker functions. We show how this construction leads directly to the quantum Toda equations satisfied by these functions, and to the $q$-difference equations in the quantum case. We investigate the critical limit of affine Whittaker functions computed in this way.