For what it's worth, there's already a free Raycast extension that lets you supply your own OpenAI key which lets you do this pretty easily. Wherever possible, I lean towards the BYOK (bring your own key approach).
As a previous Alfred user, I would say that I miss the way that alfred searches files better, but everything else like plugins and overall usefulness find Raycast to be way way better.
I actually used this before but Raycast has some really nice presets or macros. I’m not sure what you’d call them, but being able to quicklink settings for different ai engines is really great.
https://github.com/raycast/extensions/tree/99c7c7c4fa02afba9...