I´d love to lose weight with Lego! Do you know how your specific meds cause weight gain? Do they make you retain water, make you sluggish, hungrier, or something completely different? If they make you more hungry keto may well help with that. @Trusylver is our resident keto expert and I´m sure she has more helpful things to say than I do but I wanted to welcome you to the forum anyway.
Yikes indeed; that sucks! Fingers crossed keto can help out with that. I don´t do keto but I did more or less cut out sugar 3 months ago and I feel much better (and less hungry and crave-y) for it.