mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Merge pull request #9331 from BerriAI/litellm_patch_disable_spend_updates
[Patch] - Allow disabling all spend updates / writes to DB
This commit is contained in:
commit
82fe63dde9
3 changed files with 30 additions and 2 deletions
|
@ -969,7 +969,9 @@ class ProxyLogging:
|
|||
|
||||
async def async_post_call_streaming_hook(
|
||||
self,
|
||||
response: Union[ModelResponse, EmbeddingResponse, ImageResponse],
|
||||
response: Union[
|
||||
ModelResponse, EmbeddingResponse, ImageResponse, ModelResponseStream
|
||||
],
|
||||
user_api_key_dict: UserAPIKeyAuth,
|
||||
):
|
||||
"""
|
||||
|
@ -2474,6 +2476,18 @@ class ProxyUpdateSpend:
|
|||
e=e, start_time=start_time, proxy_logging_obj=proxy_logging_obj
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def disable_spend_updates() -> bool:
|
||||
"""
|
||||
returns True if should not update spend in db
|
||||
Skips writing spend logs and updates to key, team, user spend to DB
|
||||
"""
|
||||
from litellm.proxy.proxy_server import general_settings
|
||||
|
||||
if general_settings.get("disable_spend_updates") is True:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
async def update_spend( # noqa: PLR0915
|
||||
prisma_client: PrismaClient,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue