Mass loss through stellar winds plays a dominant role in the evolution of massive stars . In particular the mass-loss rates of very massive stars ( VMSs , > 100 M _ { \odot } ) are highly uncertain . Such stars display Wolf-Rayet spectral morphologies ( WNh ) whilst on the main-sequence . Metal-poor VMSs are progenitors of gamma-ray bursts and pair instability supernovae . In this study we extended the widely used stellar wind theory by Castor , Abbott & Klein from the optically thin ( O star ) to the optically thick main-sequence ( WNh ) wind regime . In particular we modify the mass-loss rate formula in a way that we are able to explain the empirical mass-loss dependence on the Eddington parameter ( \Gamma _ { e } ) . The new mass-loss recipe is suitable for incorporation into current stellar evolution models for massive and very massive stars . It makes verifiable predictions , namely how the mass-loss rate scales with metallicity and at which Eddington parameter the transition from optically thin O star to optically thick WNh star winds occurs . In the case of the star cluster R136 in the Large Magellanic Cloud we find in the optically thin wind regime \dot { M } \propto \Gamma _ { e } ^ { 3 } while in the optically thick wind regime \dot { M } \propto 1 / ( 1 - \Gamma _ { e } ) ^ { 3.5 } . The transition from optically thin to optically thick winds occurs at \Gamma _ { e,trans } \approx 0.47 . The transition mass-loss rate is \log \dot { M } ~ { } ( M _ { \odot } \mathrm { yr } ^ { -1 } ) \approx - 4.76 \pm 0.18 , which is in line with the prediction by Vink & Gräfener assuming a volume filling factor of f _ { V } = 0.23 _ { -0.15 } ^ { +0.40 } .