A process and system for insitu hydrogenation employing a gas generator in a borehole for burning a hydrogen-rich mixture of hydrogen and oxygen. The gas generator comprises a housing forming a chamber with a combustion zone at one end and a restricted outlet at the other end. A cooling annulus surrounds the chamber with passages leading from the annulus to the chamber. Hydrogen and oxygen are supplied downhole to the generator to form a hydrogen-rich combustible mixture in the combustion zone which is burned whereby hydrogen and steam are injected from the restricted outlet. Hydrogen also is supplied to the cooling annulus. The flow of hydrogen and oxygen to the generator is controlled to maintain the temperature of the exhaust gases at a level sufficient to crack the hydrocarbons in the formations into lighter segments for reaction with the excess hot hydrogen to form lighter and less viscous end products which are recovered from a production well.