mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix: also extract output_cost_per_second for custom per-second pricing
Per Greptile review: the previous implementation only read input_cost_per_second, missing deployments configured with output_cost_per_second only. Now falls back to output_cost_per_second when input_cost_per_second is not set.
This commit is contained in:
parent
ae720d0dee
commit
4b75229d6e
1 changed files with 2 additions and 1 deletions
|
|
@ -1127,8 +1127,9 @@ def completion_cost( # noqa: PLR0915
|
|||
"output_cost_per_token": _output_cost if _output_cost is not None else 0.0,
|
||||
}
|
||||
# Also extract custom_cost_per_second if available
|
||||
# Prefer input_cost_per_second; fall back to output_cost_per_second
|
||||
if custom_cost_per_second is None:
|
||||
_cost_per_second = _model_info.get("input_cost_per_second")
|
||||
_cost_per_second = _model_info.get("input_cost_per_second") or _model_info.get("output_cost_per_second")
|
||||
if _cost_per_second is not None:
|
||||
custom_cost_per_second = _cost_per_second
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue