Skip to main content

LiteLLM

LiteLLM is a library that simplifies calling Anthropic, Azure, Huggingface, Replicate, etc. LLMs in a unified way.

You can use LiteLLM through either:

Installation and setup

Install the litellm python package.

pip install litellm

Chat models

ChatLiteLLM

See a usage example.

from langchain_community.chat_models import ChatLiteLLM
API Reference:ChatLiteLLM

ChatLiteLLMRouter

You also can use the ChatLiteLLMRouter to route requests to different LLMs or LLM providers.

See a usage example.

from langchain_community.chat_models import ChatLiteLLMRouter
API Reference:ChatLiteLLMRouter

Was this page helpful?