| .. | ||
| _experimental | ||
| db | ||
| example_config_yaml | ||
| hooks | ||
| queue | ||
| secret_managers | ||
| tests | ||
| __init__.py | ||
| _types.py | ||
| .gitignore | ||
| admin_ui.py | ||
| cached_logo.jpg | ||
| enterprise | ||
| health_check.py | ||
| lambda.py | ||
| llamaguard_prompt.txt | ||
| logo.jpg | ||
| openapi.json | ||
| otel_config.yaml | ||
| post_call_rules.py | ||
| proxy_cli.py | ||
| proxy_config.yaml | ||
| proxy_server.py | ||
| README.md | ||
| schema.prisma | ||
| start.sh | ||
| utils.py | ||
litellm-proxy
A local, fast, and lightweight OpenAI-compatible server to call 100+ LLM APIs.
usage
$ pip install litellm
$ litellm --model ollama/codellama
#INFO: Ollama running on http://0.0.0.0:8000
replace openai base
import openai # openai v1.0.0+
client = openai.OpenAI(api_key="anything",base_url="http://0.0.0.0:8000") # set proxy to base_url
# request sent to model set on litellm proxy, `litellm --model`
response = client.chat.completions.create(model="gpt-3.5-turbo", messages = [
{
"role": "user",
"content": "this is a test request, write a short poem"
}
])
print(response)
See how to call Huggingface,Bedrock,TogetherAI,Anthropic, etc.