mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-28 04:04:31 +00:00
(fix) spend tracking per key - when no cache hit
This commit is contained in:
parent
86de925179
commit
b7f1ad5355
1 changed files with 6 additions and 4 deletions
|
@ -691,6 +691,7 @@ async def update_database(
|
|||
await prisma_client.update_data(token=token, data={"spend": new_spend})
|
||||
|
||||
valid_token = user_api_key_cache.get_cache(key=token)
|
||||
if valid_token is not None:
|
||||
valid_token.spend = new_spend
|
||||
user_api_key_cache.set_cache(key=token, value=valid_token)
|
||||
elif custom_db_client is not None:
|
||||
|
@ -715,6 +716,7 @@ async def update_database(
|
|||
)
|
||||
|
||||
valid_token = user_api_key_cache.get_cache(key=token)
|
||||
if valid_token is not None:
|
||||
valid_token.spend = new_spend
|
||||
user_api_key_cache.set_cache(key=token, value=valid_token)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue