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: Agno checks LITELLM_API_KEY first. If it’s not set, it falls back to the provider-specific key for the model you’re using, e.g. OPENAI_API_KEY for an OpenAI model.

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.