How to Build a Cost-Effective ChatGPT Alternative with OpenAI API