Files
litellm/litellm/proxy
2024-06-15 11:46:15 -07:00
..
2024-06-14 20:33:02 -07:00
2024-06-15 10:40:02 -07:00
2024-03-25 09:01:42 -07:00
2024-06-11 14:25:33 -07:00
2023-12-25 14:11:20 +05:30
2024-06-15 11:40:36 -07:00
2024-04-13 10:09:18 -07:00
2023-11-23 00:04:47 -05:00
2024-02-21 17:34:42 -08:00
2023-12-01 21:04:08 -08:00
2024-06-14 18:41:51 -07:00
2024-06-15 11:46:15 -07:00
2023-11-17 17:40:44 -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.