Your genny problem could be caused by a number of things. as someone who works on these things, if you posted complete model/spec/ser. no. I may be a little better able to help. Most Probable cause is fuel pump or control board (the control board feeds power to fuel pump) To determine actual fault, you need to be able to test fuel delivery as soon as shuts off, and check for power to fuel pump from control board.
Onan has posted two different groups of fuel pumps that had higher than normal failure rates. Need to have manufacturer's date code from pump to determine if yours might fall in one of these dates
also, when your unit shuts off, it should display fault code (series of light blinks at start stop switch) your operators manual should tell you how to read these codes, and this can help to identify system (fuel, ignition, voltage output, etc)that is at fault