Skip to main content
LiteLLM provides a unified interface for various LLM providers, allowing you to use different models with the same code. Agno integrates with LiteLLM in two ways:
  1. Direct SDK integration - Using the LiteLLM Python SDK
  2. Proxy Server integration - Using LiteLLM as an OpenAI-compatible proxy

Prerequisites

For both integration methods, you’ll need:
Set up your API key: Regardless of the model used(OpenAI, Hugging Face, or XAI) the API key is referenced as LITELLM_API_KEY.

SDK Integration

The LiteLLM class provides direct integration with the LiteLLM Python SDK.

Basic Usage

Using Hugging Face Models

LiteLLM can also work with Hugging Face models:

Configuration Options

The LiteLLM class accepts the following parameters:

Examples

View more examples here.