  The stellar initial mass function (IMF) in the early universe is essential to
understand the formation of ancient galaxies. To this end, we conduct a series
of long-term radiation hydrodynamic simulations following star cluster
formation, varying the metallicity from $Z/Z_\odot = 10^{-4}$ to $1$. We
particularly consider the effects of protostellar radiative feedback, which
modify the exact shape of the IMF and determine the star formation efficiency
(SFE), i.e. the ratio between the mass in stars and the initial gas mass in the
parental cloud. Our results show that the IMF changes from a Salpeter-type to a
top-heavy function as the metallicity decreases. When $Z/Z_\odot \lesssim
10^{-2}$, the IMF becomes log-flat and distinct from a Salpeter-like IMF.
Stellar feedback is effective in shaping both the low- and high-mass ends of
the IMF. Heating of dust grains by stellar radiation suppresses small-scale
fragmentation and reduces the number of low-mass stars with $M_* \lesssim
1~M_\odot$ at all metallicities. The ionizing radiation hinders the growth of
massive stars, steepening the slope of the IMF at the high-mass end. The
resulting feedback is more effective at lower metallicity, and star formation
is regulated by stellar radiative feedback, with the SFE decreasing with
decreasing metallicity. We suggest that the unexpectedly large number of
UV-bright galaxies at $z>10$ reported by JWST observations can be explained by
considering star cluster formation at $Z/Z_\odot \sim 10^{-2}$ or $10^{-3}$,
where the IMF is top-heavy, but the SFE is not too low due to stellar feedback.
