The present invention relates to an apparatus and method for venting a gas from a liquid, which are applicable to a wide variety of medical liquid delivery systems. The apparatus includes level detectors, a clamp, and a control apparatus operably connected to the level detectors and the clamp. The method includes detecting whether liquid or gas is present at the level detectors, and opening and closing a clamp to vent gas. The present invention also relates to an apparatus and method for controlling pressure differential across a semipermeable membrane by using a pressure sensor, a gas source, a valve, and a membrane.