litellm/tests/test_litellm/proxy
Yuneng Jiang afa4a6fe78
refactor(proxy): make the config file win over the database
The precedence used to vary per key: some keys let a stored row win, some
let the file win, some merged the two. That meant an operator could not
answer "which value is live?" without knowing the key.

Now file presence decides ownership. A key the config file declares is
config-owned, whatever the database holds, and a key the file omits falls
back to the stored row. KeyRule no longer carries a RuleKind, only which
row the stored value lives in.

Writes to a config-owned key are refused at the two surfaces that reach
the database instead of being stored and silently ignored: save_config
and /config/field/update both 400 naming the key and the config file path.

Both read endpoints now report source and editable off the same
SettingsStore, so /config/field/info and /config/list can no longer
disagree inside one process.

Replaces the 786-case checked-in JSON fixture with cases generated from
the rule table, so the matrix tests no longer assert that resolve() agrees
with a snapshot of resolve().

BREAKING CHANGE: a dashboard or /config/field/update write to a setting
the config file declares now returns 400 instead of being stored. Remove
the key from the config file to let the database own it.
2026-09-18 01:28:21 -07:00
..
_experimental/mcp_server fix(mcp): retain selected guardrails for virtual REST calls 2026-09-17 10:40:33 -07:00
a2a fix(a2a): reject malformed protocolVersion suffixes while keeping semver prereleases 2026-07-21 13:24:58 -07:00
agent_endpoints refactor(proxy): resolve config and DB settings precedence in one SettingsStore 2026-09-17 23:36:27 -07:00
analytics_endpoints fix(proxy): attribute gate-rejected requests to their endpoint in cache analytics (#40824) 2026-09-12 16:03:38 -07:00
anthropic_endpoints fix(proxy): keep litellm_call_id on shaped errors and list_batches failure hook 2026-09-16 03:02:50 +00:00
auth test: keep the pinning-test removal free of unrelated reformatting 2026-09-18 04:27:28 +00:00
batches_endpoints fix(proxy): keep litellm_call_id on shaped errors and list_batches failure hook 2026-09-16 03:02:50 +00:00
client Merge pull request #41672 from BerriAI/litellm_autoroute_start_stop 2026-09-17 16:07:00 -07:00
common_utils Merge remote-tracking branch 'origin/main' into litellm_remove_brittle_price_pinning_tests 2026-09-18 00:29:52 +00:00
config_resolvers refactor(proxy): make the config file win over the database 2026-09-18 01:28:21 -07:00
container_endpoints fix(containers): page upstream until a non-admin container list fills its limit 2026-09-02 21:26:34 -07:00
credential_endpoints fix(credentials): answer 409 on a name collision, let PATCH resolve values from model_id 2026-09-15 10:41:43 -07:00
db fix(spend_tracking): attribute router-rejected requests to the model group provider 2026-09-16 23:10:47 +00:00
discovery_endpoints chore(proxy): drop explanatory docstrings from credentials hint helper and tests 2026-09-14 19:29:30 +00:00
enterprise_billing feat(proxy): push-based OTLP billable-request metering for enterprise deployments (#31592) 2026-07-15 12:12:52 -07:00
experimental/mcp_server test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
fine_tuning_endpoints test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
google_endpoints test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
guardrails Merge pull request #41220 from BerriAI/litellm_post_call_guardrail_context 2026-09-17 00:31:46 -07:00
health_endpoints Merge pull request #40814 from BerriAI/litellm_gate_health_services_alert_tests 2026-09-12 21:13:30 -07:00
hooks test(proxy): drive the heuristics responsiveness check without mutable state 2026-09-17 22:39:15 +00:00
image_endpoints Merge remote-tracking branch 'origin/main' into litellm_fix_image_edits_bracketed_alias 2026-09-17 14:49:54 -07:00
list_api feat: page the public model hub table off /public/v1/model_hub, keeping every filter (#39691) 2026-09-03 22:36:16 -07:00
logging_endpoints fix(usage): recover aliases for v1.99 double-hashed spend keys 2026-09-03 14:21:25 +00:00
management_endpoints refactor(proxy): make the config file win over the database 2026-09-18 01:28:21 -07:00
management_helpers fix(router): reject a blank Jev api_key so it cannot pair with a caller-chosen api_base 2026-09-17 16:38:54 -07:00
memory feat(proxy): add a search param to key, memory, audit, and spend log listings 2026-09-03 15:20:13 -07:00
middleware feat(proxy): resolve root_path per request from a configured prefix list (SERVER_ROOT_PATHS) (#35935) 2026-09-07 11:54:59 -07:00
ocr_endpoints fix(ocr): validate body req_format in the proxy endpoint and run its tests in CI 2026-08-17 18:29:35 +00:00
openai_files_endpoint refactor(proxy): drop redundant docstrings from upload allowlist helpers and tests 2026-09-14 19:00:49 +00:00
pass_through_endpoints test(proxy): forward each method through the typesafe route to a mocked upstream 2026-09-17 18:19:42 -07:00
policy_engine feat(policy_engine): bound priority to int32 and expose it in the Admin UI 2026-09-17 06:47:53 +00:00
prompts fix(prompts): accept a string prompt_version and carry the viewed environment into code snippets 2026-08-29 12:55:34 -07:00
proxy_server refactor(proxy): make the config file win over the database 2026-09-18 01:28:21 -07:00
public_endpoints test(proxy): drop docstrings from the Add Model provider tests 2026-09-07 15:12:41 -07:00
rag_endpoints fix(proxy): surface the upstream status code when a RAG query fails 2026-09-15 17:53:57 -07:00
realtime_endpoints refactor(proxy): replace configurable model access denied message with a fixed clean client message 2026-09-16 01:44:36 +00:00
rerank_endpoints fix(proxy): carry litellm_call_id through endpoint specific error logs and failure responses 2026-09-16 02:29:26 +00:00
response_api_endpoints fix(count_tokens): preserve image inputs when counting Responses API tokens 2026-08-31 12:43:17 -07:00
shutdown feat(proxy): native /health/drain preStop hook for graceful shutdown (#29439) 2026-06-02 16:30:44 -07:00
spend_tracking test: keep behavior tests that read the cost map for a later fixture rewrite 2026-09-18 04:52:06 +00:00
test_configs
types_utils feat(proxy): unified custom_key_policy hook for key generate, update and regenerate 2026-09-12 16:09:24 -07:00
ui_crud_endpoints refactor(proxy): make the config file win over the database 2026-09-18 01:28:21 -07:00
utils fix(mcp): retain selected guardrails for virtual REST calls 2026-09-17 10:40:33 -07:00
vector_store_endpoints fix(proxy): let authorized internal users open vector store details (#40150) 2026-09-07 13:10:09 -07:00
vector_store_files_endpoints test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
video_endpoints fix(videos): forward uploaded source file on /v1/videos/edits to the provider 2026-08-24 15:34:21 -07:00
__init__.py
conftest.py test(proxy): keep a leaked llm_router out of the next test in the worker 2026-08-20 23:19:17 -07:00
test__types.py feat(jwt): allow virtual_key_claim_field per issuer 2026-09-13 00:41:08 +00:00
test_aiohttp_cleanup_closed.py
test_aiohttp_session_recovery.py
test_api_key_masking_in_errors.py
test_audio_speech_prometheus_hooks.py fix(proxy): match /v1/audio/speech content-type to the returned audio format 2026-08-29 13:44:43 -07:00
test_batch_expiry.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_batch_metadata_none_fix.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_batch_retrieve_bedrock.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_batch_x_litellm_model_encoding.py test(proxy): give the x-litellm-model fallback test deterministic openai env creds 2026-08-17 12:42:57 -07:00
test_blocked_response_usage.py fix(guardrails): remove the module-global translation mapping that leaked between tests 2026-09-03 03:28:52 -07:00
test_budget_reservation.py test(proxy): inject a fake prisma floor instead of patching SpendCounterReseed.from_db 2026-09-14 23:32:25 +00:00
test_caching_routes.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_chat_completion_metadata.py
test_claude_code_marketplace.py test: run the 30 test files stranded in the second mirror (#37595) 2026-08-20 10:59:43 -07:00
test_collector.py feat(proxy): offload spend tracking to a pod-local collector sidecar (#40545) 2026-09-10 17:14:13 -07:00
test_common_request_processing.py fix(proxy): reject non-string model with 400 and log its spend as unknown-model 2026-09-17 19:37:14 +00:00
test_component_allowlists.py fix(gateway): serve /debug/memory/summary on the data plane so the memory regression test can read each gateway's RSS 2026-09-10 18:12:40 -07:00
test_conftest.py test(proxy): stop monkeypatch.undo re-planting fixture-mocked prisma_client 2026-08-13 20:11:06 -07:00
test_cors_config.py
test_custom_proxy.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_dynamic_mcp_route.py fix(proxy): serve aggregate MCP endpoint on bare /mcp instead of 307-redirecting (#34845) 2026-08-14 17:04:32 -07:00
test_empty_model_list.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_enforce_user_param.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_fallback_management_endpoints.py
test_fastapi_offline_routes.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_filter_models_by_team_access_group.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_health_check_functions.py fix(health): skip background health check DB writes when the latest-row read fails 2026-09-14 23:03:30 +00:00
test_health_check_max_tokens.py fix(health): keep team public names to the owning team and let model_id win over model 2026-09-11 19:49:37 -07:00
test_init_litellm_callbacks.py test: run the 30 test files stranded in the second mirror (#37595) 2026-08-20 10:59:43 -07:00
test_langfuse_passthrough_security.py
test_lazy_openapi_snapshot.py refactor(proxy): type the snapshot fragments and wrap a long test line 2026-08-26 14:39:51 -07:00
test_litellm_pre_call_utils.py Merge pull request #41474 from BerriAI/litellm_router_tpm_rpm_count_before_headers_v2 2026-09-16 14:37:04 -07:00
test_max_budget_env_var.py
test_mcp_asgi_response.py fix(mcp): surface upstream 401 for token-forwarding MCP servers (#27847) 2026-05-13 12:03:36 -07:00
test_model_based_routing_files_batches.py test(batches): move orphan tests into tests/test_litellm for CI coverage (#30510) 2026-06-16 10:20:59 -07:00
test_model_deprecations_endpoint.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_model_dump_with_preserved_fields.py
test_model_id_header_propagation.py feat(proxy): add x-litellm-model-name response header with deployment model string (#33698) 2026-07-17 20:29:42 -07:00
test_model_info_default_limits.py perf(proxy): serialize /model/info listing once with orjson 2026-09-14 19:47:51 +00:00
test_model_level_guardrails.py fix(proxy): apply key/team router_settings.model_group_alias (#35486) 2026-08-03 22:09:47 +00:00
test_model_list_healthy_only.py perf(proxy): serialize /model/info listing once with orjson 2026-09-14 19:47:51 +00:00
test_modify_response_streaming_passthrough.py fix(proxy): use e.request_data for logging_obj in ModifyResponseException streaming passthrough (#30800) 2026-06-18 23:29:08 -07:00
test_openai_ws_passthrough_routes.py fix(proxy): keep the token's team model list in the websocket passthrough gate without a database 2026-09-04 19:05:35 -07:00
test_openapi_schema_validation.py
test_plugin_routes.py refactor(proxy): resolve config and DB settings precedence in one SettingsStore 2026-09-17 23:36:27 -07:00
test_pointfive_dashboard_config.py feat(pointfive): add pointfive to the dashboard logging integrations 2026-09-10 14:02:35 +03:00
test_pointfive_ui_callback.py feat(pointfive): list pointfive in the proxy callback registry 2026-09-10 14:02:35 +03:00
test_pricing_field_strip.py fix(proxy): fold litellm_metadata into metadata on chat routes so tag routing sees merged tags 2026-08-29 00:42:43 -07:00
test_prisma_engine_watchdog.py fix(proxy): recreate the Prisma client when the writer session turns read-only (#40610) 2026-09-10 13:53:42 -07:00
test_prisma_migration.py fix(proxy): run migrations through python -m prisma when the prisma console script is not on PATH 2026-09-09 18:17:12 -07:00
test_prometheus_cleanup.py feat(deploy): metrics sidecar and separate metrics port in Helm and Terraform (#40163) 2026-09-08 13:31:07 -07:00
test_prometheus_metrics_server.py feat(deploy): metrics sidecar and separate metrics port in Helm and Terraform (#40163) 2026-09-08 13:31:07 -07:00
test_provider_url_destination_guard.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_proxy_cli.py fix(proxy): resolve LITELLM_LOG for uvicorn at startup and restore logger state in tests 2026-09-15 22:27:24 +00:00
test_proxy_logging_hook_detection.py refactor(proxy): move llm_api_check moderation dispatch to its own PR 2026-09-17 21:36:13 +00:00
test_proxy_server.py refactor(proxy): make the config file win over the database 2026-09-18 01:28:21 -07:00
test_proxy_types.py fix(router): honor team and key provider weights 2026-09-14 23:31:52 -07:00
test_proxy_utils.py test: keep behavior tests that read the cost map for a later fixture rewrite 2026-09-18 04:52:06 +00:00
test_pyroscope.py
test_read_model_list.py feat: add minimal rust router + axum ai-gateway calling router.realtime (2/2) (#31135) 2026-06-23 19:16:34 -07:00
test_redis_auth_cache_flag.py fix(proxy): share per-model budget counters across replicas through the spend counter cache (#39375) 2026-09-02 12:40:59 -07:00
test_response_model_sanitization.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_route_a2a_models.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_route_llm_request.py fix(proxy): keep the raw model string out of the unknown-model spend-log error message 2026-09-11 18:42:08 -07:00
test_route_priority.py perf(proxy): register liveness and core inference routes first (#40687) 2026-09-11 17:10:38 +00:00
test_sensitive_route_auth.py
test_shared_health_check.py fix(proxy): derive auto-router health from its underlying models (#38174) 2026-08-26 16:41:54 -07:00
test_spend_log_cleanup.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_swagger_chat_completions.py
test_team_member_update.py feat(ui): add budget duration to edit team member form (#29717) 2026-06-06 17:24:55 -07:00
test_team_org_move.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_tools_allowlist_enforcement.py fix(anthropic): close hybrid tool-name allowlist gap and keep native tools through guardrails 2026-08-26 20:37:11 -07:00
test_update_llm_router_resilience.py feat(complexity_router): custom classifier plugins via classifier_type 'custom' (#37249) 2026-08-18 14:09:19 -07:00