You need to know generator output power, fuel consumption rate, and cost of fuel.
So say:
P = power output in kilowatts.
R = fuel consumption rate in gallons per hour.
C = Cost of fuel in dollars per gallon.
Then electricity costs you R*C/P in dollars per kWh.
If these aren't available, some estimates can be made anyways, but some additional information about generator would be required. Most importantly, type of fuel.
Edit: I'm assuming we are talking about self-cost.