litellm/tests/unit/proxy/spend_tracking
Mateo Wang 3a991e258a
feat(responses): store each bridged turn's path to the root so a fork replays only its ancestors (#49519)
* feat(responses): store each bridged turn's path to the root so a fork replays only its ancestors

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): keep the spend log read-only typed so the type discipline gate holds

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): type the first turn's completion request so the basedpyright gate holds

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): record every replayed turn as the path when continuing a session stored without one

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): type the bridged completion kwargs so the basedpyright gate holds

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integrations): add the previous response ids key to the pub sub spend log fixture

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): stamp the path into the request's own metadata dict so router io token refunds stay deduped

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(spend-logs): carry litellm_previous_response_ids through the Rust spend log row and retention tables

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* style(rust): format the always-kept spend log metadata table

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): validate the replayed request ids as strings for the type gate

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(rust): add only the new metadata key to the spend log goldens instead of re-recording them

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-23 12:43:11 -08:00
..
native_budgets_golden fix(proxy): size the budget hold for Gemini native generateContent bodies (#53412) 2026-11-22 23:03:18 +00:00
__init__.py
native_budgets_replica.py feat(budgets): replace the python budget hold and settle engine with a rust engine admitted at auth (#51535) 2026-11-15 16:03:51 -08:00
test_background_interaction_settlement.py fix(interactions): keep background interaction bills through crashes, late restarts, and deployment keys (#45743) 2026-10-16 12:00:08 +00:00
test_baseline_accounting.py
test_budget_reservation.py fix(proxy): size the budget hold for Gemini native generateContent bodies (#53412) 2026-11-22 23:03:18 +00:00
test_budget_reservation_redis_failure.py feat(budgets): replace the python budget hold and settle engine with a rust engine admitted at auth (#51535) 2026-11-15 16:03:51 -08:00
test_budget_reservation_redis_failure_ledger.py feat(budgets): run the ledger's post-call spend counter step in rust (#52166) 2026-11-20 16:31:03 -08:00
test_budget_reservation_rust.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_budget_reservation_rust_ledger.py feat(budgets): run the ledger's post-call spend counter step in rust (#52166) 2026-11-20 16:31:03 -08:00
test_carried_budget_state.py fix(proxy): show committed spend in the remaining budget gauges (#49199) 2026-11-09 20:05:37 +00:00
test_cloudzero_endpoints.py
test_committed_spend.py fix(proxy): show committed spend in the remaining budget gauges (#49199) 2026-11-09 20:05:37 +00:00
test_compression_savings.py
test_cost_finalization.py feat(proxy): add a surcharge on customer requests (#52406) 2026-11-19 00:45:10 +08:00
test_customer_budget_alerts.py feat(proxy): add app groups with shared budgets and usage (#53232) 2026-11-21 12:50:58 -08:00
test_customer_cost_margin.py feat(proxy): let an app set its own surcharge on customer requests (#52492) 2026-11-18 19:56:06 +00:00
test_customer_window_accounting.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_customer_window_accounting_rust.py feat(budgets): replace the python budget hold and settle engine with a rust engine admitted at auth (#51535) 2026-11-15 16:03:51 -08:00
test_input_tokens.py fix(proxy): size the budget hold for Gemini native generateContent bodies (#53412) 2026-11-22 23:03:18 +00:00
test_key_metadata_recovery.py
test_native_budget_checks.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_native_budgets.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_native_budgets_ledger.py feat(budgets): run the ledger's post-call spend counter step in rust (#52166) 2026-11-20 16:31:03 -08:00
test_native_budgets_proxy_path.py feat(customer portal): set budgets per customer and gateway app (#52477) 2026-11-18 17:31:03 +00:00
test_native_budgets_proxy_path_ledger.py feat(budgets): run the ledger's post-call spend counter step in rust (#52166) 2026-11-20 16:31:03 -08:00
test_native_spend_log_row_type.py feat(spend-logs): rust spend log row builder (#52161) 2026-11-20 16:31:03 -08:00
test_performance_alerts.py feat(alerts): detect daily changes in recorded usage (#50666) 2026-11-11 18:23:02 -08:00
test_ptu_feature_flag.py
test_ptu_flat_cost_rollup.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_rust_spend_counters.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_savings.py fix(spend): keep a NaN or infinite cost from wedging daily spend writes (#48829) 2026-10-30 08:27:35 -07:00
test_search_api_logging.py
test_session_page.py fix(spend): read only the newest rows when paging sessions (LIT-8513) (#48886) 2026-11-03 10:51:09 -08:00
test_session_spend_total.py feat(auto_router): report a session's whole spend and name why savings stay unestimated (#51066) 2026-11-10 17:07:11 -08:00
test_spend_capture_rate.py
test_spend_counter_batch.py feat(budgets): replace the python budget hold and settle engine with a rust engine admitted at auth (#51535) 2026-11-15 16:03:51 -08:00
test_spend_counter_batch_ledger.py test(spend): assert ledger callback counts apart from wire command order in the remaining spend counter tests (#53471) 2026-11-21 23:37:10 +00:00
test_spend_event.py fix(spend): write a background response's settling read in-process when the spend collector is on (#50957) 2026-11-10 18:19:17 -08:00
test_spend_event_producer.py test(unit): keep unix socket paths in unit tests under the macOS AF_UNIX limit (#45040) 2026-10-28 20:23:22 -07:00
test_spend_log_error_logger.py
test_spend_logs_ledger_setting.py feat(spend-logs): rust spend log callback (#52182) 2026-11-20 16:31:04 -08:00
test_spend_management_endpoints.py feat(responses): store each bridged turn's path to the root so a fork replays only its ancestors (#49519) 2026-11-23 12:43:11 -08:00
test_spend_query_optimization.py fix(proxy): cancel the Admin UI's raw spend-log reads in Postgres after 30s (#49965) 2026-11-03 16:07:00 -08:00
test_spend_tracking_utils.py feat(proxy): add app groups with shared budgets and usage (#53232) 2026-11-21 12:50:58 -08:00
test_subscription_billing_periods.py feat(usage): show subscription-covered providers and account fees separately (#44772) 2026-10-30 03:58:36 -07:00