The headphone jack is stuck in headphone mode, disabling the internal speakers. You don't say which G4 it is, but try inserting and removing headphones a few times. Also try resetting the PRAM and PMU. If it still does not work, the logic board may have a problem.
The key problem has nothing to do with this. Doing the resets may fix that too. If not, there could be a problem with the keyboard itself.
Steve