litellm-mirror/litellm/proxy
2023-12-06 11:29:59 -08:00
..
example_config_yaml (docs) add example config.yaml 2023-12-04 18:08:57 -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
.gitignore fix(gitmodules): remapping to new proxy 2023-10-12 21:23:53 -07:00
__init__.py update proxy cli 2023-09-28 16:24:41 -07:00
custom_auth.py feat(proxy_server.py): allow user to override api key auth 2023-12-04 18:32:58 -08:00
custom_callbacks.py (docs) custom callbacks proxy 2023-12-04 11:20:27 -08:00
lambda.py Add mangum. 2023-11-23 00:04:47 -05:00
openapi.json (feat) add swagger.json for litellm proxy 2023-10-13 20:41:04 -07:00
otel_config.yaml (feat) proxy: otel logging 2023-12-01 21:04:08 -08:00
proxy_cli.py (feat) proxy cli, better description of config yaml param 2023-12-05 18:11:29 -08:00
proxy_config.yaml (feat) proxy: add mode in model info 2023-12-06 11:29:59 -08:00
proxy_server.py (fix) proxy - move new health check import 2023-12-06 10:13:06 -08:00
README.md (docs) update readme proxy server 2023-11-17 17:40:44 -08:00
schema.prisma fix(proxy_server.py): hash keys 2023-12-02 19:30:03 -08:00
start.sh fix(factory.py): fixing llama-2 non-chat models prompt templating 2023-11-07 21:33:54 -08:00
types.py (feat) add mode for config.yaml health checks 2023-12-06 11:16:29 -08:00
utils.py test: fix linting errors 2023-12-04 18:43:01 -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.