Use observed LiteLLM cost for LiteLLM-routed calls (#529)
Register a litellm.success_callback that captures kwargs['response_cost'] into a new observed-cost bucket on LLMUsageLedger. record() skips the tokens-times-registry estimate for LiteLLM-routed models so we do not double-count with the callback; OpenAI direct routes keep estimating since LiteLLM is not invoked for them. Per-agent attribution for LiteLLM-routed calls is apportioned by token share at to_record() time.
This commit is contained in:
@@ -219,6 +219,9 @@ ignore = [
|
||||
# ReportState carries scan artifact/report fields and
|
||||
# a runtime ``Callable`` annotation on ``vulnerability_found_callback``.
|
||||
"strix/report/state.py" = ["TC003", "PLR0912", "PLR0915", "E501", "PERF401"]
|
||||
"strix/report/usage.py" = ["PLC0415"]
|
||||
"strix/report/cost_capture.py" = ["PLC0415"]
|
||||
"strix/config/models.py" = ["PLC0415"]
|
||||
# Interface utility branches per scope-mode / target-type combination;
|
||||
# splitting would obscure the decision tree without simplifying it.
|
||||
"strix/interface/utils.py" = ["PLR0912", "BLE001", "PLC0415"]
|
||||
|
||||
Reference in New Issue
Block a user