litellm/openai_proxy
2023-10-25 14:09:39 -07:00
..
tests (test) proxy server, add new caching test 2023-10-25 14:07:46 -07:00
.env.template build(openai_proxy/main.py): adding support for routing between multiple azure deployments 2023-10-25 11:16:02 -07:00
__init__.py build(openai_proxy/main.py): adding support for routing between multiple azure deployments 2023-10-25 11:16:02 -07:00
config build(openai_proxy/main.py): adding support for routing between multiple azure deployments 2023-10-25 11:16:02 -07:00
Dockerfile build(openai_proxy/main.py): adding support for routing between multiple azure deployments 2023-10-25 11:16:02 -07:00
main.py build(openai_proxy): docker build fixes 2023-10-25 13:34:04 -07:00
openapi.json build(openai_proxy/main.py): adding support for routing between multiple azure deployments 2023-10-25 11:16:02 -07:00
README.md Update README.md 2023-10-25 14:09:39 -07:00
requirements.txt build(openai_proxy/main.py): adding support for routing between multiple azure deployments 2023-10-25 11:16:02 -07:00
utils.py build(openai_proxy/utils.py): fix docker build issues 2023-10-25 13:39:47 -07:00

openai-proxy

A simple, fast, and lightweight OpenAI-compatible server to call 100+ LLM APIs.

Usage

docker run -e PORT=8000 -p 8000:8000 ghcr.io/berriai/litellm:latest

# UVICORN: OpenAI Proxy running on http://0.0.0.0:8000

Endpoints:

  • /chat/completions - chat completions endpoint to call 100+ LLMs
  • /router/completions - for multiple deployments of the same model (e.g. Azure OpenAI), uses the least used deployment. Learn more
  • /models - available models on server

Making Requests to Proxy

Curl

Call OpenAI

curl http://0.0.0.0:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
     "model": "gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'

Call Bedrock

curl http://0.0.0.0:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
     "model": "bedrock/anthropic.claude-instant-v1",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'

Running Locally

$ git clone https://github.com/BerriAI/litellm.git
$ cd ./litellm/openai-proxy
$ uvicorn main:app --host 0.0.0.0 --port 8000

See how to call Huggingface,Bedrock,TogetherAI,Anthropic, etc.