December 23, 2024

5 min read

LLM Gateway: what it is and why it matters


While building Ottic, we faced a common challenge: integrating with multiple LLM providers. As the number of models we used grew, so did the complexity of managing different LLM providers and workflows. This back-and-forth slowed us down, so we developed an LLM Gateway to streamline the process. It didn’t just save time—it transformed how we work. That’s when we realized: if this is so useful for us, why not make it open-source and share it with others?

Check out our Open-Source LLM Gateway on GitHub

I wrote this article to share what I learned from shifting to a multi-model approach and why it’s worth exploring.

TLDR;

  • a) Multi-model = + faster tests, - costs, optimized LLM usage for specific tasks.
  • b) LLM gateways are modern components enabling efficient multi-model use;
  • c) Features of LLM gateways: smart routing, monitoring, guardrails, fallbacks;
  • d) Different schemas across vendors cause friction; LLM gateways help solve it.
  • e) We build an LLM gateway. It helped us and we decided to open-sourced it.

From "one" to "many"

Currently there are more than +200 LLM models.

With the evolution of the GenAI landscape, we've moved past the stage where companies relied on just a single LLM provider for their applications.

16 Changes to the Way Enterprises Are Building and Buying Generative AI (A16z, 2024)

As we step into 2025, the "one LLM provider fits all" approach is no longer viable. Applications are becoming increasingly complex, and AI agents demand cost-effective, optimized solutions to function effectively

LLM gateways have become an essential building block for LLM-powered apps.

What is an LLM Gateway?

An LLM Gateway, also known as an LLM Proxy, is a middleware designed to streamline and optimize interactions between applications and various LLM APIs.

While an application can communicate directly with providers like OpenAI, Google’s Gemini, Anthropic, and others, an LLM Gateway manages traffic across these providers.

Why does it matter?

Relying on 1 LLM provider = not getting the most efficient solution.

Using multiple models providers allows you to:

  1. Get the best from each provider for different parts of your app;
  2. Quickly tap into advancements of other LLMs providers without friction.
  3. Avoid being hit by frequent LLM disruptions (increasingly common);
OpenAI service disruptions from Oct - Dec 2024.

At Ottic, we evaluating AI outputs to help companies improve their AI products. To ensure reliable evaluations, we use more than one model provider in an approach we call "Multi LLM-as-a-Judge." Instead of relying on a single LLM to evaluate an output, which can lead to biased or inconsistent results, we use multiple models. Each LLM reviews the AI output, and their combined feedback provides a balanced and verdict (passed or failed).

LLM Shopping: Seeking the Multi-Model Advantage

Not all providers are created equal.

Model Key features Use cases Limitations
Claude 3.5 Sonnet Advanced conversational and reasoning Coding, complex Q&A -
Llama 3 Expanded 128.000 token context Long form text, complex reasoning -
Gemini
Maintains context over extended inputs Long document management -
GPT 4-o High coherence, complex problem-solving Human like text generation High latency and cost
Code Llama Fine tuned for code (e.g. Python) Code generation, developer workflows Limited to code
Different LLM providers excel at specific use cases.

Shopping for the best option for each part of your application end up optimizing performance, reducing costs, and ensuring scalability. LLM gateways allow you to "shop" across multiple providers, getting the best of each one of them to a more robust and scalable solution.

16 Changes to the Way Enterprises Are Building and Buying Generative AI (A16z, 2024)
💡
"LLM shopping" is when organizations route calls within their application to make the most of each provider, recognizing that different parts of the application can be better served by a specific model provider.

Patterns and benefits of LLM gateways


🧠 Smart Routing = using different model providers for different tasks

  • Optimizes efficiency

📊 Monitoring and Centralized Logs = tracking AI activity

  • Attribute AI costs to specific users or departments
  • Track how AI is used (for compliance and audits)
  • Monitor application response speed and accuracy over time

🛡️ Guardrails = aligning with standards and mitigating risks

  • Filter sensitive data (e.g., Personally Identifiable Information)
  • Ensure outputs comply with organizational standards
  • Prevent inappropriate AI responses (e.g., harmful or biased content)

🔄 Fallbacks = avoiding vendor service disruptions

  • Increase uptime by enabling real-time switching to alternative vendors
  • Improves user experience

Challenges of multi model integration

While technically straightforward, managing a multi-model approach can introduce friction when switching between model providers.

Different API Calls - Anthropic vs. OpenAI

Each provider has its own API and it's own output schema, making it time-consuming to manage differences. Switching models providers often requires updating your code, which becomes challenging as options grow, including the growing open-source LLM list.

A simpler solution is to unify API access through an LLM gateway, allowing you to switch providers seamlessly without changing your code.

Open-source LLM gateway

At Ottic, we struggled with managing multiple LLM providers and their different APIs as we added more models. To fix this, we built an LLM Gateway that simplified everything, saving time and improving how we work. Seeing its value, we decided to make it open-source and share it.

Check out our Open-Source LLM Gateway on GitHub

It is a lightweight, open-source library built for fast and reliable connections to LLMs. It simplifies integrations with multiple providers, support streams, unify different model outputs, offering fallbacks with model params conversion, and minimal latency with LLM providers (client-side solution.)

Here's a basic example of how to use the LLM Gateway library

Conclusion 🎯

An LLM Gateway is more than just a routing mechanism—it’s a strategic tool for optimizing AI applications at scale.

If you’re building AI applications and looking to streamline your LLM architecture, an LLM Gateway might be the key to unlocking your next level of innovation. Check the Open-Source LLM Gateway on GitHub

Written by
Rafael Pinheiro

Rafael Pinheiro

Co-founder at Ottic