LLMs and LiteLLM

LLMs and LiteLLM
LLMLiteLLMGenerative AIAI AgentsNVIDIANOOAOpenAIAnthropicGeminiAI EngineeringMachine LearningLLM IntegrationAI DevelopmentModel SwitchingMulti-Model AIPython

LLM vs LiteLLM: What's the Difference?

When building an AI application or agent, you can either integrate directly with an LLM provider or use an abstraction layer such as LiteLLM.

Direct LLM Integration

With a direct integration, your application communicates with a specific provider's API.

Your App → OpenAI API → GPT

If you later switch to Anthropic, Gemini, or another provider, you generally need to adapt your integration because each provider has its own API format, authentication, model configuration, and features.

This approach is simple and gives you full access to the provider's native capabilities.

What Is LiteLLM?

LiteLLM provides a unified interface for interacting with different LLM providers.

Instead of creating separate integrations:

Your App → OpenAI

Your App → Anthropic

Your App → Gemini

you can use:

             ┌→ OpenAI

Your App → LiteLLM → Anthropic

             └→ Gemini

Your application talks to LiteLLM, while LiteLLM handles the provider-specific differences.

The main benefit is that switching models can often be done by changing the model configuration rather than rewriting your LLM integration.

LiteLLM in NVIDIA's NOOA

I came across this while experimenting and creating an agent with NVIDIA's NOOA (NVIDIA Object-Oriented Agents) framework.

NOOA provides a get_llm_client interface that can work with different providers, including OpenAI, Anthropic, Ollama, and vLLM. Under the hood, NOOA uses LiteLLM to provide this abstraction.

This means the same agent can be configured to use different models without changing the agent's core logic.

NOOA Agent

↓

get_llm_client()

↓

LiteLLM

↓

OpenAI / Anthropic / Ollama / vLLM

Pros

The main advantage is flexibility:

LiteLLM also provides additional capabilities such as routing, fallbacks, retries, and usage/cost tracking.

Cons

The trade-off is another abstraction layer.

Final Thoughts

A direct LLM integration gives you simplicity and full provider-specific control.

LiteLLM gives you a common interface and flexibility across providers.

If you're only using one provider, direct integration may be all you need. But when building agents or applications where you expect to experiment with or switch between models, LiteLLM can save you from maintaining a separate integration for every provider.

The key idea: write your LLM integration once, and change the model without rewriting the application around a new provider.