Mini-Neptunes seem to be common planets. In this work we investigate the possible formation histories and predicted occurrence rates of mini-Neptunes, assuming that the planets form beyond the iceline. We consider pebble and planetesimal accretion accounting for envelope enrichment and two different opacity conditions. We find that the formation of mini-Neptunes is a relatively frequent output when envelope enrichment by volatiles is included, and that there is a "sweet spot" for mini-Neptune formation with a relatively low solid accretion rate of ~10−6 M ⊕ yr−1. This rate is typical for low/intermediate-mass protoplanetary disks and/or disks with low metallicities. With pebble accretion, envelope enrichment and high opacity favor the formation of mini-Neptunes, with more efficient formation at large semimajor axes (~30 au) and low disk viscosities. For planetesimal accretion, such planets can also form without enrichment, with the opacity being a key aspect in the growth history and favorable formation location. Finally, we show that the formation of Neptune-like planets remains a challenge for planet formation theories.