I want a way to replace openAI api, in a pyqt app, everything in this app should be able to be bundled into an standalone .exe

Most solutions use some kind of UI to interact, host an api and then query it.

Does anyone know how I may achieve something like this?