Skip to content

Commit

Permalink
(feat) proxy_server add /v1
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-jaff committed Oct 11, 2023
1 parent afa6802 commit 329d27d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,19 @@ async def chat_completion(request: Request):
return response


# V1 Endpoints - some apps expect a v1 endpoint - these call the regular function
@router.post("/v1/completions")
async def completion(request: Request):
data = await request.json()
return litellm_completion(data=data, type="completion")

@router.post("/v1/chat/completions")
async def chat_completion(request: Request):
data = await request.json()
print_verbose(f"data passed in: {data}")
response = litellm_completion(data, type="chat_completion")
return response

def print_cost_logs():
with open('cost.log', 'r') as f:
# print this in green
Expand Down

0 comments on commit 329d27d

Please sign in to comment.