litellm/tests/test_litellm/proxy/hooks
ryan-crabbe-berri 527dc0a8bb
feat(proxy): add apply_user_budget_to_team_keys opt-in (#36102)
* feat(proxy): add apply_user_budget_to_team_keys opt-in

PR #32005 made a user's personal max_budget apply to their team-scoped keys
too, and PR #35271 reverted the whole thing (behavior plus the
skip_user_budget_on_team_key opt-out) because that flipped the default for
everyone. This brings the behavior back the other way round: default is
unchanged, and general_settings.apply_user_budget_to_team_keys opts a
deployment into charging the key owner's personal budget on team keys.

The flag reaches all three personal-budget gates so an opted-in deployment
enforces consistently: the read-time check in common_checks, the optimistic
reservation counter in _get_budget_counters, and the _PROXY_MaxBudgetLimiter
pre-call hook. It is also in the /config/list allowed args and, unlike the
reverted flag, in the _update_general_settings propagation allowlist, so the
Admin UI General Settings toggle actually takes effect at runtime; an explicit
YAML value still wins over the DB value on reload.

get_config_list's allowed_args moves to a module-level frozen mapping of
field name to type string, dropping 18 LIT002 violations and rebuilding one
less dict per request.

* style(proxy): drop explanatory comments from the budget flag paths
2026-08-07 15:40:13 +00:00
..
litellm_skills Litellm oss 090626 (#30021) 2026-06-10 10:34:07 -07:00
test_async_post_call_streaming_iterator_hook.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_batch_file_validation.py revert: undo teamless all-team-models denial from #32022 and #29746 (#32032) 2026-07-03 18:56:07 -07:00
test_dynamic_rate_limiter.py fix(dynamic_rate_limiter): inject clock so active-project window is stable within a request (#32299) 2026-07-06 18:12:47 -07:00
test_dynamic_rate_limiter_v3.py fix(rate-limit): enforce token limits when the pre-call increment is zero 2026-07-31 18:05:50 -07:00
test_image_generation_guardrails.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_key_management_event_hooks.py fix(proxy): hash caller-supplied key in key update audit log object_id (#34632) 2026-07-25 10:45:51 -07:00
test_max_budget_limiter.py feat(proxy): add apply_user_budget_to_team_keys opt-in (#36102) 2026-08-07 15:40:13 +00:00
test_max_budget_per_session_limiter.py Agents - add max budget + tpm/rpm limiting per agent AND per agent session (#22849) 2026-03-07 19:12:42 -08:00
test_max_iterations_limiter.py Agents - add max budget + tpm/rpm limiting per agent AND per agent session (#22849) 2026-03-07 19:12:42 -08:00
test_parallel_request_limiter.py Litellm oss 090626 (#30021) 2026-06-10 10:34:07 -07:00
test_parallel_request_limiter_v3.py fix(rate-limit): block check-only counters at the limit and scope tpm reservation to tokens 2026-08-01 11:56:18 -07:00
test_post_call_failure_hook_integration.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_post_call_response_headers_hook.py fix(proxy): extend response headers hook to streaming, TTS, image gen, and pass-through (#24232) 2026-06-09 22:10:23 +02:00
test_post_call_streaming_hook_integration.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_post_call_success_hook_integration.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_prompt_injection_detection.py fix: prompt injection not working (#16701) 2025-11-17 20:04:57 -08:00
test_proxy_hooks_init.py [Fix] Proxy: Address Greptile feedback on hook-cycle PR 2026-05-04 20:13:31 -07:00
test_proxy_rate_limit_provider_field.py refactor(rate-limits): move the v3 limiter per-request stash off request metadata onto a ContextVar 2026-07-30 14:00:20 -07:00
test_proxy_track_cost_callback.py fix(batch): track cost for managed batches with no attributable key/user/team 2026-08-02 12:20:46 +05:30
test_rate_limiter_toctou.py refactor(rate-limits): move the v3 limiter per-request stash off request metadata onto a ContextVar 2026-07-30 14:00:20 -07:00
test_send_invite_email.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_sensitive_data_routing.py [internal copy of #29511] feat(guardrails): add sensitive data routing to on-premise models (#29531) 2026-06-04 22:22:28 -07:00
test_tpm_concurrent.py refactor(rate-limits): move the v3 limiter per-request stash off request metadata onto a ContextVar 2026-07-30 14:00:20 -07:00
test_user_management_event_hooks.py test(proxy): cover the user-created audit hook's database read-back 2026-07-31 19:48:30 +00:00