To address the problems of intermittent and uncontrollable solar irradiance faced by grid-connected photovoltaic power plants, this paper proposes an ultra-short-term solar irradiance prediction model that combines K-means clustering with the Extreme Learning Machine (ELM). The K-means algorithm is first applied to cluster solar irradiance data from different seasons in Shanghai based on spatial similarity. Subsequently, the ELM algorithm is employed to train the model, significantly improving both prediction accuracy and training speed. Compared with the prediction accuracy of the model before clustering, the root-mean-square error (RMSE) of the clustered model is significantly reduced by 28.75 % in spring, and 0.30 %, 6.70 % and 5.92 % in summer, Autumn and winter, respectively. In addition, the model demonstrates stable predictive performance at different time resolutions (5, 10 and 15 minutes) with R2 values close to 1, confirming its accuracy and stability under small sample conditions. In terms of training speed, ELM’s training time is more than 100 times faster than Support Vector Regression (SVR) and significantly shorter than traditional models such as PSO-BP and Random Forest (RF), showing its great advantage in application scenarios that require fast response. Overall, the K-means-ELM model is able to accurately capture the overall trend and sudden changes in solar irradiance, which is of great application value for enhancing the efficiency and stability of solar power generation systems.