Why I stopped hardcoding AI API calls and built a simple abstraction layer
Dev.to AI
•
Generative AI
AI Business
The moment I knew I had to change my approach It was 11 PM on a Wednesday. I had just finished integrating GPT-4 into my side project - a little tool that helps developers write documentation. Everything worked perfectly with OpenAI. Then my client said, "We need to also Anthropic's Claude because of compliance requirements." I looked at my code. I had a single function called ask_gpt that made direct HTTP calls to OpenAI's API. It was littered with API key checks, model names, and temperature settings.