Yep. As long as you’re in the window of when to do it. Some say you need to have done one in person before, not sure about that. Download the IMM eService IOS app (Thai Police Dept). Follow prompts and allow it to use your location GPS and have a phone number. Plus you need to be at your address
To apply for a Retirement Visa O-A you need to apply “in” your own country (your passport country).
You can apply in Thailand when on a 60 day visa for O (Retirement) visa but will need to meet the requirements including 800,000 baht in a Thai bank etc. best to look up on the Thai Immigration website
in your original questions you said you want to retire in Thailand so I assumed you were still in your “home country”. Very different from inside Thailand or another country!