The study hypothesis is that Optiflow may reduce the extubation failure rate for high risk patients in medical intensive care unit.In the intervention group, patients fulfilling inclusion criteria and not presenting any of the exclusion criteria will receive high-flow nasal cannula (Optiflow Airvo2, Fisher \& Paykel Healthcare Ltd., New Zealand) after extubation. The oxygen concentration (FiO2) will be set to reach an oxygenation target similar to control patients (see below), while the gas flow rate will be set at 50 L/min.In the control group, patients fulfilling inclusion criteria and not presenting any of the exclusion criteria will receive standard oxygen therapy including nasal cannula or oxygen mask after extubation. The FiO2 will be set to obtain a arterial oxygen saturation (SpO2) between 92% and 98% (or between 88% and 95% in hypercapnic patients). NIPPV or intubation will be applied in both group if respiratory distress noted. High flow nasal cannula will be tried before NIPPV or intubation in the control group patients.