Fix spend tracking for anthropic_messages and allm_passthrough_route

This commit is contained in:
naaa760 2026-03-20 15:43:19 +05:30
parent d7c419bfee
commit 84fd1ac86c

View file

@ -1066,6 +1066,8 @@ def completion_cost( # noqa: PLR0915
"""
try:
call_type = _infer_call_type(call_type, completion_response) or "completion"
if call_type in ("anthropic_messages", "allm_passthrough_route"):
call_type = "completion"
if (
(call_type == "aimage_generation" or call_type == "image_generation")
@ -1664,6 +1666,8 @@ def response_cost_calculator(
"aembedding",
"completion",
"acompletion",
"anthropic_messages",
"allm_passthrough_route",
"atext_completion",
"text_completion",
"image_generation",