mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
refactor: keep the pre-existing cost-estimate comment and usage cost read out of the cleanup
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
0a89eefca0
commit
2d0ee09e58
2 changed files with 2 additions and 1 deletions
|
|
@ -634,6 +634,7 @@ async def estimate_cost(
|
|||
# Pinning one moment keeps an off-peak window that opens mid-quote from pricing the totals on
|
||||
# one side of it and the reported rates on the other.
|
||||
with pinned_billing_time(current_billing_time()):
|
||||
# Use completion_cost which handles all the logic including margins/discounts
|
||||
try:
|
||||
cost_per_request: Final = completion_cost(
|
||||
completion_response=mock_response,
|
||||
|
|
|
|||
|
|
@ -1323,7 +1323,7 @@ def _stamp_responses_usage_cost(
|
|||
if usage_obj is None:
|
||||
return
|
||||
response_obj.usage = usage_obj # rebind-ok: the stamped cost has to ride on the response the client receives
|
||||
if isinstance(usage_obj.cost, (int, float)):
|
||||
if isinstance(getattr(usage_obj, "cost", None), (int, float)):
|
||||
return
|
||||
try:
|
||||
cost: Final[float | None] = logging_obj._response_cost_calculator(result=response_obj)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue