LiteLLM Proxy
Route PraisonAI agents through a self-hosted LiteLLM Proxy gateway
Environment Variables
import os
from praisonaiagents import Agent
os.environ["LITELLM_PROXY_BASE_URL"] = "http://localhost:4000"
os.environ["LITELLM_PROXY_API_KEY"] = "your-proxy-key"
agent = Agent(
name="Proxy Agent",
llm="litellm-proxy/gpt-4",
)Aliases: litellm-proxy, llm-proxy, litellm-gateway. Model IDs are passed through unchanged (no prefix added).
Python
# export LITELLM_PROXY_BASE_URL=http://localhost:4000
# export LITELLM_PROXY_API_KEY=your-key
from praisonaiagents import Agent
agent = Agent(
instructions="You are a helpful assistant",
llm="llm-proxy/gpt-4o",
)
agent.start("Summarise LiteLLM Proxy benefits")Self-Hosted vs Cloud
| Deployment | LITELLM_PROXY_BASE_URL |
|---|---|
| Local dev | http://localhost:4000 |
| Docker / k8s | Your service URL |
| LiteLLM cloud | Provider-supplied endpoint |