If you've built an application that uses multiple LLM providers, you probably know the pain:
- Different API keys
- Different base URLs
- Different SDKs
- Different billing dashboards
- Different request formats
At first, integrating another model seems easy. But maintaining several providers in a production application can become surprisingly messy.
The usual approach
You might end up with code like this:
const openaiClient = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
const anthropicClient = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
Then you need separate logic for each provider, error handling, retries, usage tracking, and billing.
What if you could use one compatible endpoint?
An API gateway that supports OpenAI-compatible and Anthropic-compatible formats can simplify this setup.
For example, UberLLM provides:
- One API key for multiple models
- OpenAI-compatible endpoints
- Anthropic-compatible endpoints
- A model catalog covering multiple providers
With the OpenAI SDK, the integration looks familiar:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.uberllm.dev/v1",
apiKey: process.env.UBERLLM_API_KEY,
});
const response = await client.chat.completions.create({
model: "deepseek/deepseek-v4-flash",
messages: [
{
role: "user",
content: "Explain dependency injection in simple terms.",
},
],
});
console.log(response.choices[0].message.content);
The main change is the base URL, API key, and model ID. Your existing OpenAI SDK workflow stays largely the same.
Is this the right architecture for every project?
Not necessarily.
Before adopting a gateway, I'd evaluate:
- Provider availability and reliability
- Model pricing and billing transparency
- Streaming and tool-calling compatibility
- Rate limits and error handling
- Data handling and security requirements
- Observability and request-level cost tracking
For some applications, direct provider integrations are still the better choice.
For others, a unified endpoint can reduce integration and maintenance overhead.
One option worth exploring
I've been looking into UberLLM, which offers OpenAI- and Anthropic-compatible APIs behind one endpoint.
If you'd like to explore it, here's my referral link: https://uberllm.dev/?ref=755g76v
Disclosure: This is a referral link. I may receive a commission if you sign up and purchase credits through it.
I'd be interested to hear how other developers manage multiple LLM providers in production.
Do you prefer direct integrations, a self-hosted gateway, or a managed API gateway?
Top comments (0)