A gas delivery system that provides positive airway pressure therapy is disclosed. A mask (216) couples to a patient&rsquos face to deliver pressurized gas to an airway of the patient. The mask includes a flow generator system (220) disposed on the mask and that pressurizes the gas, the flow generator including at least one motor. A controller controls the at least one motor and may use the data from a number of sensors to modify this control. A diverter valve activated by the incoming gas blocks a unassisted breathing vent (238) in the mask. During no flow the valve blocks the inlet from the flow generator system so the patient may breath through the breathing vent. The flow generator may be detached from the mask and used with a base unit to supply gas to a second mask.