The study presents a three-step decision framework for weaning from mechanical ventilation: 1. readiness, 2. success of spontaneous breathing test (SBT), and 3. decision to extubate. The goal was to create an artificial intelligence model for stage 3 that predicts successful extubation, defined as the need for no reintubation or non-invasive ventilation within 48 hours. They retrospectively analyzed data from 5,202 adult patients after successful SBT, using routinely collected data from electronic health records. They trained seven algorithms and evaluated them according to accuracy, sensitivity, specificity, positive and negative predictive value, and area under the curve (AUC). The LightGBM model achieved the best results with an accuracy of 0.797, a sensitivity of 0.800, a specificity of 0.763, a positive predictive value of 0.977, a negative predictive value of 0.231, and an AUC of 0.850. The most important factors for extubation success according to SHAP analysis were SpO₂/FiO₂ ratio, ward type, bilateral lower limb muscle strength, and dynamic lung compliance (Cdyn). The authors also created a functional web-based prototype of this model to verify its applicability in practice and pave the way for future prospective clinical evaluation.