What if the object is unknown (meaning there is no knowledge of gender or number)? Would it be OK to say,
За чего он благодарит?