LiteLLM
LiteLLM is a library that simplifies calling Anthropic, Azure, Huggingface, Replicate, etc. LLMs in a unified way.
You can use
LiteLLM
through either:
- LiteLLM Proxy Server - Server to call 100+ LLMs, load balance, cost tracking across projects
- LiteLLM python SDK - Python Client to call 100+ LLMs, load balance, cost tracking
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