An ab initio study of the effect on nonlinear optical (NLO) properties of medium-size polymethineimine (PMI) chains caused by doping with an alkali metal atom along the backbone is presented. Both the electronic and (preliminary) vibrational static first hyperpolarizabilities are investigated. Doping leads to the injection of an excess electron into the PMI chain, which is accompanied by major enhancement of its NLO response. Along with the hyperpolarizability, other electronic and structural properties depend strongly upon the position of doping along the chain. The vibrational contribution is larger than the corresponding electronic one for most of the cases studied.