Optimizing Costs with GPT-4: Balancing Performance and Budget