In situ mass spectral measurements of the gas composition at the substrate surface were made during filament-assisted diamond growth. The input gases were various mixtures of CH4, O2, and H2 chosen in order to discern the effects of oxygen addition on diamond formation and growth. The gas phase chemistry was modeled as a 1-dimensional flow reactor, and the measured and calculated species mole fractions were in good agreement. The model was then used to estimate mole fractions of several atomic and radical species which could not be measured. We find that addition of O2 has only a small effect on the radical mole fractions. However, O2 can reduce the effective initial hydrocarbon mole fraction, which is important because higher quality diamond is grown at lower initial hydrocarbon mole fraction. Most importantly, perhaps, O2 addition leads to the formation of sufficient gas phase OH to remove non-diamond (pyrolytic) carbon from the film. Thus, O2 addition allows diamond films to be grown under composition and temperature conditions which otherwise would produce largely non-diamond carbon.