Litellm

Latest version: v1.52.14

Safety actively analyzes 682416 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 85 of 93

1.18.12

Not secure
What's Changed

1. UI Improvements by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1575
![screenshot-rocks](https://github.com/BerriAI/litellm/assets/29436595/dbf3a2c7-a292-4664-9ced-f6341971482c)
New Endpoints - [Spend Tracking]
- `/spend/keys` - View all keys created, ordered by spend
- `/spend/logs` - View all spend logs, if request_id is provided, only logs for that request_id will be returned

Example response for `/spend/logs`
json
[{"request_id":"chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e","call_type":"acompletion","api_key":"51**","spend":7.25e-05,"startTime":"2024-01-18T18:07:54.071000Z","endTime":"2024-01-18T18:07:55.510000Z","model":"cohere.command-text-v14","user":"litellm-is-awesome-user","modelParameters":{},"messages":[{"role":"user","content":"what llm are you-444"}],"response":"{\"id\":\"chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e\",\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"content\":\" I am an AI chatbot, trained as an LLM by Cohere. Is there anything else you would like to know about LLMs? \",\"role\":\"assistant\"}}],\"created\":1705630075,\"model\":\"cohere.command-text-v14\",\"object\":\"chat.completion\",\"system_fingerprint\":null,\"usage\":{\"prompt_tokens\":7,\"completion_tokens\":31,\"total_tokens\":38}}","usage":{"total_tokens":38,"prompt_tokens":7,"completion_tokens":31},"metadata":{"headers":{"host":"0.0.0.0:8000","accept":"*/*","user-agent":"curl/7.88.1","content-type":"application/json","authorization":"Bearer sk-zNhplEZxJ-yOuZkqRvwO_g","content-length":"224"},"endpoint":"http://0.0.0.0:8000/chat/completions","deployment":"bedrock/cohere.command-text-v14","model_group":"BEDROCK_GROUP","user_api_key":"2b6e4ff4c14f67b6ccd7318948f0d66fe8724099224baeaf4733792a2048aeb3","caching_groups":null,"user_api_key_user_id":"ishaan2berri.ai","user_api_key_metadata":{}},"cache_hit":""}]

2. [Feat] Make Proxy Auth Exceptions OpenAI compatible by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1576
🚨 If you use Custom Auth on the Proxy, It will actually raise an now https://docs.litellm.ai/docs/proxy/virtual_keys#custom-auth

Auth Errors Before PR - using OpenAI JS/Python

js
AuthenticationError: 401 status code (no body)
at APIError.generate (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/node_modules/openai/error.js:47:20)
at OpenAI.makeStatusError (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/node_modules/openai/core.js:255:33)
at OpenAI.makeRequest (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/node_modules/openai/core.js:294:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOpenAI (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/test_openai_js.js:12:22) {
status: 401,
headers: {
'content-length': '117',
'content-type': 'application/json',
date: 'Mon, 22 Jan 2024 21:21:14 GMT',
server: 'uvicorn'
},
error: undefined,
code: undefined,
param: undefined,
type: undefined
}



Auth Errors After PR - using OpenAI JS/Python

js
AuthenticationError: 401 Authentication Error: invalid user key - token does not exist
at APIError.generate (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/node_modules/openai/error.js:47:20)
at OpenAI.makeStatusError (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/node_modules/openai/core.js:255:33)
at OpenAI.makeRequest (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/node_modules/openai/core.js:294:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOpenAI (/Users/ishaanjaffer/Github/litellm/litellm/proxy/tests/test_openai_js.js:12:22) {
status: 401,
headers: {
'content-length': '131',
'content-type': 'application/json',
date: 'Tue, 23 Jan 2024 00:26:52 GMT',
server: 'uvicorn'
},
error: {
message: 'Authentication Error: invalid user key - token does not exist',
type: 'auth_error',
param: 'None',
code: 401
},
code: 401,
param: 'None',
type: 'auth_error'


3. [Fix] Streaming - Use same `response_id` across chunks by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1572
Streaming Responses (for non OpenAI/Azure) After this PR - `id` is the same across chunks
shell
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content='The', role='assistant'))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' sky', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=',', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' a', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' canvas', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' of', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' blue', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' and', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=' gold', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content=',', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())
chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2
ModelResponse(id='chatcmpl-8e5a8a5f-46ba-47d9-8858-c4d81aa4efc2', choices=[StreamingChoices(finish_reason=None, index=0, delta=Delta(content='\n', role=None))], created=1706043294, model='berri-benchmarking-Llama-2-70b-chat-hf-4', object='chat.completion.chunk', system_fingerprint=None, usage=Usage())

* [WIP] fix(utils.py): fix proxy streaming spend tracking by krrishdholakia in https://github.com/BerriAI/litellm/pull/1574
* feat(proxy/utils.py): Support keys with budget duration (resets spend on duration end) by krrishdholakia in https://github.com/BerriAI/litellm/pull/1570



**Full Changelog**: https://github.com/BerriAI/litellm/compare/v1.18.11...v1.18.12

1.18.11

Not secure
What's Changed
* [Fix] LiteLLM Proxy - Streaming Sagemaker Support on /chat/completions by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1569


**Full Changelog**: https://github.com/BerriAI/litellm/compare/v1.18.10...v1.18.11

1.18.10

Not secure
What's Changed
* [Feat] Add Budgets Per API Key - LiteLLM Proxy by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1552
* fix(utils.py): move from pkg_resources to importlib by krrishdholakia in https://github.com/BerriAI/litellm/pull/1556
* feat(utils.py): emit response cost as part of logs by krrishdholakia in https://github.com/BerriAI/litellm/pull/1557
* [Feat] Add REAL Sagemaker streaming by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1561


**Full Changelog**: https://github.com/BerriAI/litellm/compare/v1.18.9...v1.18.10

1.18.9

Not secure
What's Changed
* docs: Fix import statement for provider's sample code by kihaya in https://github.com/BerriAI/litellm/pull/1535
* Litellm GitHub action build admin UI by ShaunMaher in https://github.com/BerriAI/litellm/pull/1505
* [Feat] Proxy Auth - Use custom_key_generate by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1538
* [Fix] Router - Usage Based Routing with fallbacks (Track the correct tpm/rpm) by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1555
* [Feat] support custom cost tracking per second by krrishdholakia in https://github.com/BerriAI/litellm/pull/1551

New Contributors
* kihaya made their first contribution in https://github.com/BerriAI/litellm/pull/1535

**Full Changelog**: https://github.com/BerriAI/litellm/compare/v1.18.7...v1.18.9

1.18.8

Not secure
What's Changed
* [Feat] Add typehints for litellm.Router by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1529
* [Feat] Litellm.Router set custom cooldown times by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1534


**Full Changelog**: https://github.com/BerriAI/litellm/compare/v1.18.6...v1.18.8

1.18.7

Not secure
What's Changed

1. Improved `litellm.Router` logging for fallbacks
**Example Log for one call**
shell
LiteLLM Router - INFO: get_available_deployment for model: azure/gpt-4-fast, No deployment available
LiteLLM Router - INFO: litellm.completion(model=None) Exception No models available.
LiteLLM Router - INFO: get_available_deployment for model: azure/gpt-4-basic, No deployment available
LiteLLM Router - INFO: litellm.completion(model=None) Exception No models available.
LiteLLM Router - INFO: get_available_deployment for model: openai-gpt-4, Selected deployment: {'model_name': 'openai-gpt-4', 'litellm_params': {'model': 'gpt-3.5-turbo', 'api_key': 'sk-PhEM****', 'tpm': 2000}, 'tpm': 2000, 'model_info': {'id': '5a4b95fa-c018-4767-85c2-c4851c57cf34'}} for model: openai-gpt-4
LiteLLM Router - INFO: litellm.completion(model=gpt-3.5-turbo) 200 OK


How to use in python
python
router = litellm.Router(
model_list=model_list,
fallbacks=fallbacks_list,
set_verbose=True,
debug_level="DEBUG" optional, default=INFO
)


2. Improvements to Usage Based Routing - litellm.Router
Before making the first call, we check if any of the deployments have TPM to make the call, Thanks georgeseifada for this!
3. [Feat] Add typehints for litellm.Router by ishaan-jaff in https://github.com/BerriAI/litellm/pull/1529



**Full Changelog**: https://github.com/BerriAI/litellm/compare/v1.18.6...v1.18.7

Page 85 of 93

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.