litellm/litellm/proxy/common_utils
zoveki 4786dd861b
fix(proxy)!: scope /health by wildcard keys and team model allowlists the way auth does (#49155)
* test(proxy): cover /health scoping for wildcard keys and team model allowlists

* fix(proxy): scope /health with the model access check auth runs on a request

* fix(proxy): scope /health to the model group an allowed name routes to

A key alias, team alias, or router model_group_alias lets auth admit a
requested name by checking its target, so /health also kept the deployment
under the requested name, one the key's requests never reach. Keep only the
served model group each admitted name dispatches to, through the same alias
layers /v1/models mirrors, and let alias_map read its own read-only output.

* test(proxy): cover /health skipping a deployment that has no model name for a restricted key

* fix(health): show deployments reached through wildcard and alias allowlists, and by id when an alias shadows the name

* chore(router): drop should_include_deployment from the outside-use allowlist now that /health no longer calls it

* fix(health): never list a default-fallback deployment for an unserved grant, and keep access-group keys to their group's deployments

* fix(health): resolve ?model= through the caller's aliases the way chat does

* fix(proxy): apply user and agent model limits to /health and yield between checks

/health now runs the same user and agent model checks chat runs, so a personal
key whose owner may call only some models, or an agent key limited by its access
group, no longer sees or probes other deployments. Each per-name check yields to
the event loop, and ?model= reaches the wildcard deployment serving an allowed name

* fix(proxy): check owner and agent grants for wildcard routes in /health and fail on non-access auth errors

* fix(proxy): answer /health auth lookup failures the way chat does and record ?model= checks under the requested name

* test(proxy): pass recorded_model_name in the direct health save tests

* fix(proxy): count alias names as /health candidates so aliased names a key may call get probed

* fix(health): narrow wildcard-served deployments to the key's access groups

* fix(health): narrow every deployment serving a name to the key's access groups, team-owned ones included

* fix(health): narrow a team deployment's internal name to the key's access groups like its public name

* fix(health): keep a team deployment's internal name narrow when a limit holds only that name

An agent or key limit that holds one team deployment's internal name no longer reaches every deployment behind the team's public name. The internal name maps to its public name only when the public name is also admitted.

* test(health): cover all-proxy-models next to * for a key that also holds an access group

* refactor(auth): keep the _as_proxy_exception name so main's tests still find it

* fix(health): keep an internal team name a wildcard grant admits as its own target

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-30 07:36:01 -07:00
..
html_forms feat(proxy): let a Claude Code gateway user choose the session team (#49001) 2026-10-29 03:47:27 -07:00
admin_ui_utils.py fix(sso): let CLI and Claude Code gateway sign-in through on DISABLE_ADMIN_UI nodes (#44620) 2026-10-05 21:59:50 +00:00
auth_cache_invalidation_pubsub.py refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
banner.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
cache_aware_routing.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
cache_coordinator.py refactor(typing): replace Any with proven types in 65 backend files 2026-09-02 09:11:36 +00:00
cache_pydantic_utils.py refactor(types): replace Any with real types across 54 more backend files 2026-09-08 12:41:07 +00:00
callback_config_validation.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
callback_utils.py feat(router): opt in to non-chat deployment filtering (#46257) 2026-10-29 08:33:36 -07:00
claude_code_marketplace_auth.py feat(proxy)!: general_settings.claude_code_marketplace_auth_required puts the Claude Code marketplace behind a LiteLLM key (#48980) 2026-10-29 03:48:35 -07:00
codex_base_instructions.md feat(proxy): serve a Codex-native model catalog with per-model service_tiers from /v1/models (#44136) 2026-10-03 20:42:55 +00:00
codex_bundled_models_0.159.3.json feat(proxy): serve a Codex-native model catalog with per-model service_tiers from /v1/models (#44136) 2026-10-03 20:42:55 +00:00
codex_model_catalog.py feat(lite): offer each model group's reasoning efforts in pi, OpenCode and Codex (#48949) 2026-10-29 18:15:44 -07:00
config_includes.py chore(lint): remove the LIT002 mutable-construction rule (#43971) 2026-10-01 12:24:02 -07:00
config_sync_pubsub.py fix(proxy): apply new model rows on every worker as soon as they are written (#49034) 2026-10-30 03:19:25 -07:00
credential_hydration.py fix(secret_managers)!: resolve oidc/file and oidc/env refs in admin-configured api_key per request (#47341) 2026-10-20 01:43:59 +00:00
custom_openapi_spec.py docs(proxy): describe /v1/decisions and /v1/systemone in Swagger UI (#45838) 2026-10-10 21:04:59 +00:00
debug_utils.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
discoverable_model_filter.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
encrypt_decrypt_utils.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
error_body_call_id.py chore(lint): remove the LIT002 mutable-construction rule (#43971) 2026-10-01 12:24:02 -07:00
expired_ui_session_key_cleanup_manager.py refactor(repositories): type prisma table access with one generic protocol 2026-08-25 12:14:17 +00:00
get_routes.py refactor(types): replace Any with real types across 178 backend files 2026-08-27 10:14:58 +00:00
healthy_model_filter.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
http_parsing_utils.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
json_merge_patch.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
key_rotation_manager.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
load_config_utils.py refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
model_deprecation.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
model_listing_utils.py fix(proxy)!: scope /health by wildcard keys and team model allowlists the way auth does (#49155) 2026-10-30 07:36:01 -07:00
openai_endpoint_utils.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
openai_error_payload.py fix(proxy)!: label shared-handler errors the way the route catch-alls do (#39555) 2026-10-30 06:58:05 -07:00
openapi_route.py fix(proxy): build the OpenAPI schema off the event loop so a cold /openapi.json no longer stalls the worker (#47352) 2026-10-20 04:31:37 +00:00
openapi_schema_compat.py fix(proxy): build the OpenAPI schema off the event loop so a cold /openapi.json no longer stalls the worker (#47352) 2026-10-20 04:31:37 +00:00
path_utils.py refactor(core): move path_utils from proxy common_utils to litellm_core_utils (#45775) 2026-10-10 19:07:22 +00:00
periodic_reload_schedule.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
prompt_cache_prediction.py feat(router): opt in to prompt-cache cost routing (#43232) 2026-09-26 18:13:13 -07:00
prompt_cache_pricing.py refactor(anthropic): move prompt cache pricing helper out of the proxy package (#45753) 2026-10-10 20:32:34 +00:00
proxy_rate_limit_error.py refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
proxy_state.py refactor(typing): clear 1143 basedpyright Any errors across 273 files (#46574) 2026-10-15 21:08:47 +00:00
rbac_utils.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
realtime_utils.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
registry_read_through.py fix(proxy): apply new model rows on every worker as soon as they are written (#49034) 2026-10-30 03:19:25 -07:00
request_tag_mappings.py feat(proxy): map baggage values to budget tags (#47358) 2026-10-20 09:09:42 +00:00
reset_budget_job.py fix(proxy): reconcile team member total_spend with current cycle spend (#48260) 2026-10-24 17:57:09 -07:00
resource_ownership.py refactor(core_utils): move resource_ownership out of the proxy (#45805) 2026-10-10 21:02:53 +00:00
responses_stream_errors.py fix(proxy)!: end a chat completions stream with an error event when a guardrail blocks mid-stream (#46953) 2026-10-17 18:00:12 -07:00
scheduled_job_stagger.py perf(proxy): stagger scheduled background jobs across jobs and pods (#36589) 2026-08-12 09:17:31 -07:00
semantic_text_index.py fix(mcp): leave out tool texts too long to embed instead of failing tool search (#43554) 2026-10-14 14:53:00 -07:00
slow_gc_logger.py test(e2e): event_loop_stalls perf case fails on a gateway event-loop hold over 100 ms that is not on its allowlist (#46974) 2026-10-17 06:55:53 +00:00
sse_keepalive.py fix(proxy): send a real error event when a /v1/messages stream fails (#41826) 2026-09-25 15:36:35 -07:00
static_asset_utils.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
swagger_utils.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
timezone_utils.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
token_count_log.py feat(proxy): log one line per token count call (#47657) 2026-10-28 11:23:52 -07:00
token_count_settings.py fix(responses)!: answer 400 before counting a lone Responses built-in tool on Claude (#48798) 2026-10-28 12:12:45 -07:00
user_api_key_cache.py refactor(constants): move AUTH_OBJECTS_TARGET into litellm.constants (#45779) 2026-10-10 20:33:58 +00:00
validation_error_body.py fix(proxy): keep the submitted body out of 422 validation errors (#43231) 2026-09-25 17:05:53 -07:00