How are research assistantships for international graduate students funded in the US?
Can international students be paid through NIH/NSF grants that are awarded to the PI


Yes. International students are generally not eligible for personal federal fellowships, such as the NSF Graduate Research Fellowship Program, but they can still be paid through regular research grants awarded to the PI.


  I was under the impression that theses government grants are usually good for a shorter duration (2-3 years). How can the department be certain of further funds at the time of admitting a candidate?


They can't. This is a major source of pressure for PIs in some fields; they have to secure funding for already enrolled students, as well as future students. If the PI is not able to secure funding through research grants, there may be institutional fellowships, industry funding, teaching assistantships, or other sources of funding that can be used in a pinch.

But, this is not really any different for international students vs any other students.