Skip to main content

Why We Built an OpenAI-Compatible API Gateway

2 min read

Building an AI product means choosing between lock-in and flexibility. We chose flexibility — and built an OpenAI-compatible API gateway using LiteLLM that lets developers switch models without changing a single line of code.

One of the first architectural decisions we faced when building GabForge AI was how to handle model routing. We needed to support local llama.cpp inference, hosted open-weight models, and frontier providers — all from a single, stable API surface that developers could rely on. The answer was an OpenAI-compatible API gateway.

We chose LiteLLM as the routing backbone. LiteLLM translates any incoming OpenAI-format request into the native format of over 100 model providers, handles retries, load balancing, and cost tracking, and exposes a single `/v1/chat/completions` endpoint. This means any tool or library that already speaks the OpenAI protocol — LangChain, LlamaIndex, Instructor, Cursor, Continue — works with GabForge AI without modification.

The gateway layer also solves the developer experience problem. Instead of managing five different API keys and five different SDKs, developers configure one base URL and one key. Model selection becomes a parameter, not an architectural decision. Teams can A/B test models, shadow-deploy new models alongside existing ones, and roll back instantly — all without touching application code.

We added cost guardrails, per-user rate limiting, and a detailed usage dashboard on top of LiteLLM's foundation. Every token in and out is logged, attributed, and surfaced in the GabForge Dashboard so teams can optimise spend intelligently. The gateway is self-hostable — deploy it alongside your application and your data never leaves your infrastructure. This is the developer-first AI infrastructure we wished had existed when we started building.