First time cat owner wants to know when it's time to say goodbye

JerseyFrank went on a bit of a rant said
1

I adopted a kitten 13 years ago. He's always been a playful, active, fast, hungry, large, long, shiny-coated cat; though his activity has reduced over the years. This past year has been tough for us. He's gone from a peak weight of 15 pounds (slightly overweight. He's long!), to about 10 pounds. He started vomiting about 12-18 months ago. At first, it was occasional, but the frequency has steadily increased. He urinates about twice as much as he typically did in prior years. He's been to the vet multiple times. He's got hyperthyroidism, and minor loss of kidney function.
His vomiting has now gotten out of control. It's nearly every day. He's ruined all carpets in the house. He pees on couches and throw pillows. He has infrequent bouts of diarrhea that don't make it to the litter box.

But through it all, he's still playful when presented with the right toy, and still wants his now-bony body to be stroked and pet.

I've always known that in the face of apparent suffering, I'd have to euthanize him. I never considered that the suffering would be mine, and so prolonged. I don't want to put him down, and I don't want to live under the constant barrage of urine, vomit, and feces.

At what point, if any, is it right to say goodbye?