litellm/litellm/proxy
2023-12-12 17:18:51 -08:00
..
example_config_yaml
hooks fix(proxy_server.py): support for streaming 2023-12-09 16:23:04 -08:00
queue (chore) linting fix 2023-12-05 13:23:35 -08:00
tests test: remove local test 2023-12-05 12:45:52 -08:00
__init__.py
_types.py feat(proxy_server.py): add new /key/update endpoint 2023-12-12 17:18:51 -08:00
.gitignore
custom_auth.py test: fix test imports 2023-12-06 17:21:47 -08:00
custom_callbacks.py fix(main.py): pass user_id + encoding_format for logging + to openai/azure 2023-12-12 15:46:44 -08:00
health_check.py feat(proxy_server.py): enable background health checks 2023-12-07 19:40:06 -08:00
lambda.py
openapi.json
otel_config.yaml
proxy_cli.py fix: fix run_ollama_serve to only run if api base is none 2023-12-09 21:31:46 -08:00
proxy_config.yaml (docs) - proxy_config.yaml 2023-12-11 09:06:27 -08:00
proxy_server.py feat(proxy_server.py): add new /key/update endpoint 2023-12-12 17:18:51 -08:00
README.md
schema.prisma fix(proxy_server.py): enable pre+post-call hooks and max parallel request limits 2023-12-08 17:11:30 -08:00
start.sh
utils.py fix(proxy/utils.py): fix db writes on retry 2023-12-11 21:14:12 -08:00

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.