litellm/tests/proxy_unit_tests
devin-ai-integration[bot] ffe0c4c185
fix(proxy)!: enforce user budget on team keys (read-time + reservation) with UI opt-out (#32005)
* fix: enforce user budget on team keys

User budget was skipped when the key belonged to a team, letting
users exceed their personal budget by going through a team key.

Remove the team_object guard in _user_max_budget_check so user
budgets are always enforced. Add skip_user_budget_on_team_key
general_settings flag to opt back into the old behavior.

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

* fix: update test to expect user budget enforcement on team keys

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

* fix(proxy): enforce user budget on team keys in reservation path and expose skip flag in UI

Extends the read-time fix so the optimistic budget reservation also reserves the user spend counter for team-scoped keys, register skip_user_budget_on_team_key in ConfigGeneralSettings so /config/field/update accepts it, and surface it as a Boolean toggle on the Admin UI General Settings table via allowed_args in /config/list.

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

* test: assert budget_exceeded ProxyException in personal budget test

Tighten the broad pytest.raises(Exception) so the test only passes when
the auth flow rejects with a budget_exceeded ProxyException, and switch
the new ConfigGeneralSettings field to Optional[bool] to match the
surrounding annotation style

* fix: revert to bool | None to stay under UP045 strict budget

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: ryan-crabbe-berri <ryan@berri.ai>
2026-07-14 13:21:32 -07:00
..
example_config_yaml
test_configs
test_model_response_typing
azure_fine_tune.jsonl
batch_job_results_furniture.jsonl
conftest copy.py
conftest.py
data_map.txt
eagle.wav
gettysburg.wav
large_text.py
messages_with_counts.py
model_cost.json
openai_batch_completions.jsonl
openai_batch_completions_router.jsonl
speech_vertex.mp3
test_aproxy_startup.py
test_audit_logs_proxy.py
test_auth_checks.py
test_banned_keyword_list.py
test_blog_posts_endpoint.py
test_check_batch_cost.py
test_check_responses_cost.py
test_custom_callback_input.py
test_custom_logger_s3_gcs.py
test_custom_tokenizer_bug.py
test_db_schema_changes.py
test_default_end_user_budget_simple.py
test_deployed_proxy_keygen.py
test_deprecated_key_grace_period.py
test_e2e_pod_lock_manager.py
test_gemini_agents_endpoints.py
test_get_favicon.py
test_get_image.py
test_google_endpoint_routing.py
test_google_gemini_proxy_request.py
test_jwt.py
test_jwt_key_mapping.py
test_key_generate_dynamodb.py
test_key_generate_prisma.py
test_models_fallback_endpoint.py
test_multipart_bypass_repro.py
test_prisma_client_backoff_retry.py
test_prompt_test_endpoint.py
test_proxy_config_unit_test.py
test_proxy_custom_auth.py
test_proxy_custom_logger.py
test_proxy_encrypt_decrypt.py
test_proxy_exception_mapping.py
test_proxy_gunicorn.py
test_proxy_pass_user_config.py
test_proxy_reject_logging.py
test_proxy_routes.py
test_proxy_server.py
test_proxy_server_caching.py
test_proxy_server_keys.py
test_proxy_server_langfuse.py
test_proxy_server_spend.py
test_proxy_setting_guardrails.py
test_proxy_token_counter.py
test_proxy_utils.py
test_realtime_cache.py
test_reducto_ocr_route.py
test_request_size_limit_middleware.py
test_response_polling_handler.py
test_response_polling_pre_call_checks.py
test_search_api_logging.py
test_server_root_path.py
test_skills_db.py
test_ui_path_detection.py
test_unit_test_max_model_budget_limiter.py
test_unit_test_proxy_hooks.py
test_update_daily_tag_spend.py
test_update_spend.py
test_user_api_key_auth.py fix(proxy)!: enforce user budget on team keys (read-time + reservation) with UI opt-out (#32005) 2026-07-14 13:21:32 -07:00
test_zero_cost_model_budget_bypass.py
vertex_key.json