mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
* feat(spend): report guardrail spend separately in daily activity Model and key spend in /user/daily/activity/aggregated include the cost of guardrails like Bedrock guardrails, and nothing in the response says how much. A customer that bills tenants per key and per model could not get model cost alone, so tenants that pay AWS for their own guardrails were charged for them twice Daily spend rows now carry a guardrail_spend column next to spend, and every breakdown in the daily activity responses exposes it, so model cost is spend - guardrail_spend. spend keeps its meaning, so budgets still count guardrail cost as before The value comes from the request's cost_breakdown.guardrail_cost, capped at the row's spend because an allowance discount or a repeat job poll can charge less than the guardrail cost the breakdown records. The delivery ledger freezes it into the accounting payload next to accounting_savings, since the stored payload does not keep cost_breakdown, and the legacy daily queue writes the same value The migration only adds the column with a 0 default, so rows written before it read 0 * fix(spend): count guardrail spend on rows billed without a cost breakdown A request blocked before the LLM call is billed for its guardrails straight from guardrail_information, so it carries no cost_breakdown and its guardrail_spend read 0. Both writers now price guardrail_spend from guardrail_information with guardrail_information_cost, the same function success and failure rows use to add guardrail cost to spend Also fills guardrail_spend in the client usage view built from request logs, qualifies the field description for rows recorded before it existed, and adds the lock timeout the migration checks require * fix(ui): avoid a nested ternary when reading guardrail entries from request logs --------- Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| image | ||
| migrations | ||
| test_chunked_in_lists.py | ||
| test_cleanup_transactions.py | ||
| test_global_spend_refresh_writer.py | ||
| test_harness_lifecycle.py | ||
| test_managed_file_flat_ids_index.py | ||
| test_migration_entrypoint.py | ||
| test_partition_transactions.py | ||
| test_prisma_engine_port.py | ||
| test_prisma_migration_lock.py | ||
| test_proxy_boot_without_general_settings.py | ||
| test_proxy_database_lifespan.py | ||
| test_reader_writer_regeneration.py | ||
| test_request_log_indexes_at_boot.py | ||
| test_roi_observed.py | ||
| test_roi_sync_store.py | ||
| test_skill_publication.py | ||
| test_skill_submissions.py | ||
| test_spend_lock_order.py | ||
| test_spendlogs_delivery.py | ||
| test_spendlogs_ledger_parity.py | ||
| test_transaction_atomicity.py | ||
| test_v1_migration_error_logging.py | ||