Aims: Heart failure (HF) is a serious death-related disease. HF patients can deteriorate rapidly, i.e., acute onset, and lead to severe clinical events, even death. It requires complex treatments to handle HF acute onset. There is a deficiency of time if doctors act after HF acute onset. Thus, the early detection of HF acute onset is of great help to reduce mortality. This study aims to develop a real-time machine learning model for HF acute onset prediction based on bedside vital signs monitoring. Methods: A group of 2273 patients were analyzed retrospectively from the Medical Information Mart for Intensive Care III (MIMIC-III) database. The start time of applying ventilator to patients was regarded as the HF acute onset, excluding scheduled operations of ventilator. Based on vital signs, we extracted a total number of 43 features for building machine learning model. Extreme Gradient Boosting (XGBoost) was used to develop a real-time prediction model. Three-fold cross validation determined the consistency of model accuracy. SHAP value was used to assess the feature contribution for prediction in the model. Results: On the test set, the model predicted 96% of HF acute onset, 60% of which were identified more than 40 min in advance, resulting in an area under the receiver operating characteristic curve of 0.94. Conclusion: Current results suggest the generated model can help predict patients with acute onset of HF. The model prediction provide more timely notifications for doctors to achieve better patients treatment.