litellm/tests/unit/proxy/management_endpoints
devin-ai-integration[bot] 91d85c9583
test(auth): use the production cache in auth fixtures (#52754)
* test(auth): use the production cache in auth fixtures

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

* feat(gateway): serve one native app in both modes, answering a master key caller's /v1/messages with it in front of Python (#52229)

Forwarding mode forwarded everything to Python with no native app behind it, and standalone mode built its own, so the two modes could not share a layer.

The gateway now builds one native app in main.rs and serves it in both modes. Standalone serves it on its own listener. In front of Python, gateway-forward takes it as any tower Service together with `admit`, never as an axum Router, and composes the two itself, so no request Python answers passes through a native layer. `admit` is the only thing that decides who answers, and x-litellm-gateway names who did.

`admit` is a value built from the config and called per request. It judges a request by its route, POST /v1/messages, and its caller, the master key. One that passes is answered by the native app, and Python never sees it. This is the happy path only. The config's settings and the request's headers and body are not judged yet, so a setting or parameter only Python honors is served natively until a later change adds those judges. A gateway that loaded no config refuses every request with reason configuration. x-litellm-gateway now names which check refused, as configuration, route or credential.

In front of Python the native app is built from the config file Python runs with. The supervisor resolves the local YAML file by Python's own precedence, which is CONFIG_FILE_PATH, else --config, and none when LITELLM_CONFIG_BUCKET_NAME moves the config to a bucket. It passes the path as LITELLM_FORWARD_CONFIG, and the gateway loads it the way standalone mode does. With no local file the config is empty. A file the gateway cannot load, or a config the native app cannot be built from, is logged as an error and also leaves the config empty with every request refused, because the gateway exiting would stop Python with it. Config stored in the database is not read yet.

Forwarding mode now builds the same AppState and verifies the same license as standalone. The new process module reads the environment once and picks the mode, replacing settings.rs. NON_LLM_CONNECTION_TIMEOUT is read the way Python's get_env_int reads it, so a blank or unparsable value no longer stops the gateway, and Python with it, in forwarding mode.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* feat(proxy)!: let every key read its own spend logs and return 403 for filters outside the caller's scope (#52449)

* feat(proxy): let a key read its own rows on /spend/logs and /spend/logs/v2

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

* feat(proxy): refuse internal users' foreign spend-log filters and let route-restricted keys read their own spend logs

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

* fix(proxy): keep org admins' spend-log scope, hold impersonation to the key's allowed_routes and keep deleted keys' history readable

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

* test(proxy): type the new spend-log test parameters

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

* refactor(proxy): keep the spend-log checks inside the type gate

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

* test(proxy): cover a role-less key reading its own spend logs in unit tests

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

* test(proxy): cover missing spend log key identities and deleted keys

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

* refactor(proxy): return spend log filter denials as values

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>

* test(auth): use the production cache in auth fixtures

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

* test(auth): reuse the proxy cache export in fixtures

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

---------

Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: yujonglee <yujong@berri.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Kerry Lu <kerry@berri.ai>
2026-11-19 03:43:24 +00:00
..
management_v1 feat(proxy): let each app decide whether it may create unknown customers (#52485) 2026-11-18 19:42:27 +00:00
policy_endpoints refactor(types): replace Any with proven types in 14 files (#48928) 2026-10-29 07:26:07 -07:00
scim feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
search_endpoints feat(search): add Microsoft Web IQ provider (#50883) 2026-11-10 22:43:36 +00:00
sso ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
usage_endpoints feat(ui): unify gateway and usage assistance as Aria Agent (#48082) 2026-10-23 20:24:19 +00:00
__init__.py
jwt_key_mapping_doubles.py feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
test_access_group_endpoints.py feat(access-groups): name group vector stores and list them on team info (#51484) 2026-11-13 07:53:04 -08:00
test_access_group_management.py fix(budgets): invalidate customer hierarchy caches through stored team IDs (#51654) 2026-11-13 18:43:38 +00:00
test_activity_tenant_scoping.py
test_auto_router_endpoints.py feat(auth): read teams, team memberships and organizations through rust repositories (#52176) 2026-11-18 22:32:05 +00:00
test_budget_endpoints.py feat(customer-portal): reuse budget groups for organizations (#52411) 2026-11-18 00:01:17 -08:00
test_cache_settings_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_callback_management_endpoints.py feat(otel): let team and key Arize callbacks choose the OTLP transport (#44492) 2026-10-06 14:46:50 -05:00
test_common_daily_activity.py feat(customer-portal): show token usage and cache costs (#52601) 2026-11-18 18:49:08 -08:00
test_common_utils.py feat(proxy): per-model team member budgets with router fallback (#43887) 2026-10-10 20:33:55 +00:00
test_compliance_endpoints.py
test_config_override_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_coordination_redis_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_cost_estimate_endpoint.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_cost_tracking_settings.py fix(proxy): keep a cost settings update from being undone by an in-flight config reload (#51273) 2026-11-12 00:54:10 +00:00
test_credential_migration.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_customer_budget.py fix(proxy): /customer/new budgets reset on the same schedule as other budgets (#51689) 2026-11-13 19:22:14 +00:00
test_customer_endpoints.py fix(proxy): require proxy admin role on GET /customer/info (#52451) 2026-11-18 05:25:41 +00:00
test_daily_activity_routes.py feat(customer-portal): show token usage and cache costs (#52601) 2026-11-18 18:49:08 -08:00
test_delete_callbacks_endpoint.py fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
test_delete_verification_tokens_failed.py feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
test_encryption_endpoints.py test: migrate tests/proxy_behavior into integration and unit tiers (#45939) 2026-10-11 08:28:42 -07:00
test_entraid_app_roles.py
test_gateway_request_endpoints.py refactor(proxy): inject gateway activity through a typed repository (#49116) 2026-10-30 16:25:11 -07:00
test_id_jag_assertion_capture.py feat(sso): retain the SAML assertion at login as the saml2 subject token for oauth2_id_jag (#46745) 2026-10-16 12:16:56 -07:00
test_internal_user_endpoints.py feat(proxy): report current budget-window spend on /user/info, /v2/user/info and /team/info (#52673) 2026-11-18 15:43:22 -08:00
test_jwt_key_mapping.py fix(proxy): evict issuer-scoped JWT mapping misses on global mapping writes (#52350) 2026-11-17 14:38:53 -08:00
test_key_budget_change.py feat(auth): read teams, team memberships and organizations through rust repositories (#52176) 2026-11-18 22:32:05 +00:00
test_key_generate_prisma.py test(auth): use the production cache in auth fixtures (#52754) 2026-11-19 03:43:24 +00:00
test_key_management_endpoints.py fix(proxy): keep stored values under LITELLM_SALT_KEY when rotating the master key (#52413) 2026-11-18 18:24:58 -08:00
test_management_route_coverage.py test: migrate tests/proxy_behavior into integration and unit tiers (#45939) 2026-10-11 08:28:42 -07:00
test_mcp_connector_import.py
test_mcp_management_endpoints.py feat(auth): read projects, tags, access groups and object permissions through rust repositories (#52178) 2026-11-18 22:32:06 +00:00
test_mcp_servers.py refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
test_model_deprecation_alerts.py feat(proxy): add model deprecation alerts with daily requests by key (#50022) 2026-11-05 04:03:42 +00:00
test_model_insights_endpoints.py feat(alerts): detect daily changes in recorded usage (#50666) 2026-11-11 18:23:02 -08:00
test_model_management_endpoints.py fix(proxy): preserve explicit model prices when metadata echoes null (#48746) 2026-11-16 08:33:45 -08:00
test_org_admin_team_access.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_organization_endpoints.py feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
test_password_endpoints.py feat(proxy): hash UI passwords with PBKDF2 in FIPS mode (#49874) 2026-11-06 01:31:59 -08:00
test_policy_endpoints.py fix(guardrails): log requests that a guardrail blocks on /apply_guardrail (#51014) 2026-11-16 15:18:08 -08:00
test_project_org_authz.py
test_prompt_cache_prediction.py feat(callbacks-parallel-request-limiter): port parallel request limiter v3 to a rust callback (#51537) 2026-11-16 22:56:38 -08:00
test_prompt_caching_requests.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_ptu_consumption.py fix(router): serve a team's wildcard deployment before a proxy-wide wildcard (#48490) 2026-10-26 17:06:09 -07:00
test_ptu_model_settings.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_request_error_endpoints.py feat(proxy): track failed requests by HTTP status and caller (#45244) 2026-10-09 14:27:56 -07:00
test_roi_calculator_endpoints.py feat(roi): measure shipping velocity, quality, and recorded spend (#44426) 2026-10-03 23:07:34 +00:00
test_router_settings_endpoints.py fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
test_saml_sso.py refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
test_session_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_sso_helper_utils.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_subscription_accounts.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
test_tag_management_endpoints.py feat(control_plane): dataplane registry, credential strategies and client (#49655) 2026-11-16 17:36:23 +00:00
test_team_admin_field_permissions.py feat(dynamic_rate_limiter): customer organizations and keys borrow idle model capacity and split class shares (#51705) 2026-11-15 12:05:58 -08:00
test_team_callback_endpoints.py feat(otel): let a team or key excluded_services override the global setting for its OTel v2 destination (#45880) 2026-10-12 19:25:52 -04:00
test_team_default_params.py feat(team): let default_team_params attach access_group_ids to every new team (#49908) 2026-11-05 19:58:51 -08:00
test_team_endpoints.py feat(proxy): report current budget-window spend on /user/info, /v2/user/info and /team/info (#52673) 2026-11-18 15:43:22 -08:00
test_team_model_alias_merge.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_tool_management_endpoints.py
test_ui_sso.py feat(db): rust repositories for user, end user and budget auth objects (#52170) 2026-11-18 22:32:05 +00:00
test_user_agent_analytics_endpoints.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_workflow_management_endpoints.py feat(control_plane): dataplane registry, credential strategies and client (#49655) 2026-11-16 17:36:23 +00:00