I want to write a visa application letter for an online friend and his partner to visit the UK for New Year. They're Russian, and we've never met in person. I'm happy to put them up in my house, and provide a copy of my ID and proof of address. However, what I'd really like to know is what the risk to me personally would be if something goes wrong, e.g. one of them requires a hospital visit or they miss their flight home -- none of the gov.uk pages seem to cover advice/penalties for the UK person writing the invitation.
what the risk to me personally would be if something goes wrong
If you are acting in good faith there is no risk to you. If you are lying (say just selling a letter that someone hoped would aid their visa application) that is a different matter and you could face serious consequences.
It is well recognised that you cannot guarantee "no overstay" (it is difficult enough for the Government to deport undesirables, let alone a private individual) nor that your visitor/s will have no car accident or such like that incurs medical costs way beyond their insurance coverage.
Offering to ensure they do not overstay is actually unhelpful (you lose credibility by 'guaranteeing' what is out of your control).
You are not expected to stump up for any costs not covered by the visitor's insurance and I doubt anybody is suggesting you should.
You just need to show a willingness and ability to shoulder some or all of subsistence costs. In connection with proof of address, it would be helpful if you could supply evidence that either it is the address of a property you own or that your landlord is agreeable to your visitors staying with you.
If your visitors do misbehave, you would be tarnished by association and any sponsorship letter you wrote thereafter more likely to make certain a visa is not issued than to be helpful to the applicant.
Separate from consequences is the point (effectiveness) raised in a Comment by @Gayot Fow. Since you have never even met your proposed visitors your letter is not going to "weigh heavy". What's to say you won't find you can't stand one another once they turn up on your doorstep, and you immediately kick them out onto the street?
However, in terms of "on the doorstep", your presence in the airport at the time of their arrival should be helpful.