Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
29dd7fa
refactor(proxy): expose public names for private proxy helpers
mateo-berri Oct 7, 2026
c5f9a15
Merge remote-tracking branch 'origin/main' into litellm_private_usage…
mateo-berri Oct 7, 2026
bdcfcdc
fix(proxy): keep original class names behind public aliases
mateo-berri Oct 7, 2026
c18a793
Merge remote-tracking branch 'origin/main' into litellm_private_usage…
mateo-berri Oct 7, 2026
96c88d7
fix(proxy): preserve internal callback filtering
mateo-berri Oct 7, 2026
e356b92
fix(proxy): keep _PROXY_ class names for managed files hooks
mateo-berri Oct 7, 2026
019170f
fix(proxy): keep old private names in package exports
mateo-berri Oct 7, 2026
db818cb
fix(proxy): preserve recursive auth helper name
mateo-berri Oct 7, 2026
a94f922
Merge remote-tracking branch 'origin/main' into litellm_private_usage…
mateo-berri Oct 7, 2026
87afcd7
Merge remote-tracking branch 'origin/main' into litellm_private_usage…
mateo-berri Oct 7, 2026
be34048
Merge remote-tracking branch 'origin/main' into litellm_private_usage…
mateo-berri Oct 7, 2026
1955304
test(proxy): align MCP limiter tests with server enforcement
mateo-berri Oct 7, 2026
9436521
Merge remote-tracking branch 'origin/main' into litellm_private_usage…
mateo-berri Oct 7, 2026
3083e13
test(proxy): match main's MCP limiter tests
mateo-berri Oct 8, 2026
c453aeb
fix(proxy): keep old private names bound in importing modules
mateo-berri Oct 8, 2026
f86982f
Merge origin/main into litellm_private_usage_proxy
mateo-berri Oct 8, 2026
5fa7857
fix(proxy): preserve compatibility imports through strict lint
mateo-berri Oct 8, 2026
675ba26
test(proxy): use exact pyright suppression in password helper test
mateo-berri Oct 8, 2026
453c3e1
style(proxy): add reasons to compatibility import noqa comments
mateo-berri Oct 8, 2026
46b4328
test(proxy): update IN-list baseline for renamed helpers
mateo-berri Oct 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions enterprise/litellm_enterprise/proxy/hooks/managed_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def _storage_metadata_of(file_object: OpenAIFileObject | None) -> Mapping[str, s
_MANAGED_FILES_TARGET: Final = "managed_files"


class PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):
class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints):
# Class variables or attributes
def __init__(self, internal_usage_cache: InternalUsageCache, prisma_client: PrismaClient):
self.internal_usage_cache = internal_usage_cache
Expand Down Expand Up @@ -2110,4 +2110,4 @@ def _update_messages_with_base64_data(
verbose_logger.debug(
f"Converted file {file_id} from storage backend to base64 with format {content_type}"
)
_PROXY_LiteLLMManagedFiles = PROXY_LiteLLMManagedFiles
PROXY_LiteLLMManagedFiles = _PROXY_LiteLLMManagedFiles
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
PrismaClient = Any


class PROXY_LiteLLMManagedVectorStores(
class _PROXY_LiteLLMManagedVectorStores(
CustomLogger, BaseManagedResource[VectorStoreCreateResponse]
):
"""
Expand Down Expand Up @@ -462,4 +462,4 @@ async def async_filter_deployments( # type: ignore[override]
parent_otel_span=parent_otel_span,
resource_id_key="vector_store_id",
)
_PROXY_LiteLLMManagedVectorStores = PROXY_LiteLLMManagedVectorStores
PROXY_LiteLLMManagedVectorStores = _PROXY_LiteLLMManagedVectorStores
4 changes: 2 additions & 2 deletions litellm/batches/batch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,11 @@ def _provider_output_file_id(output_file_id: str) -> str:
llm_output_file_id, model-encoded ids decode to the raw provider id, raw ids pass through.
"""
from litellm.proxy.openai_files_endpoints.common_utils import (
_is_base64_encoded_unified_file_id,
get_original_file_id,
is_base64_encoded_unified_file_id,
)

unified_file_id: Final = _is_base64_encoded_unified_file_id(output_file_id)
unified_file_id: Final = is_base64_encoded_unified_file_id(output_file_id)
if not unified_file_id:
return get_original_file_id(output_file_id)
try:
Expand Down
2 changes: 1 addition & 1 deletion litellm/google_genai/streaming_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def _handle_async_streaming_logging(

end_time: Final = datetime.now()
asyncio.create_task(
PassThroughStreamingHandler._route_streaming_logging_to_handler(
PassThroughStreamingHandler.route_streaming_logging_to_handler(
litellm_logging_obj=self.litellm_logging_obj,
passthrough_success_handler_obj=GLOBAL_PASS_THROUGH_SUCCESS_HANDLER_OBJ,
url_route="/v1/generateContent",
Expand Down
8 changes: 4 additions & 4 deletions litellm/integrations/SlackAlerting/slack_alerting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ async def send_weekly_spend_report(

try:
from litellm.proxy.spend_tracking.spend_management_endpoints import (
_get_spend_report_for_time_range,
get_spend_report_for_time_range,
)

# Parse the time range
Expand All @@ -1862,7 +1862,7 @@ async def send_weekly_spend_report(
if await self.internal_usage_cache.async_get_cache(key=_event_cache_key):
return

_resp: Final = await _get_spend_report_for_time_range(
_resp: Final = await get_spend_report_for_time_range(
start_date=start_date.strftime("%Y-%m-%d"),
end_date=todays_date.strftime("%Y-%m-%d"),
)
Expand Down Expand Up @@ -1909,7 +1909,7 @@ async def send_monthly_spend_report(self):
from calendar import monthrange

from litellm.proxy.spend_tracking.spend_management_endpoints import (
_get_spend_report_for_time_range,
get_spend_report_for_time_range,
)

todays_date: Final = datetime.datetime.now().date()
Expand All @@ -1921,7 +1921,7 @@ async def send_monthly_spend_report(self):
if await self.internal_usage_cache.async_get_cache(key=_event_cache_key):
return

_resp: Final = await _get_spend_report_for_time_range(
_resp: Final = await get_spend_report_for_time_range(
start_date=first_day_of_month.strftime("%Y-%m-%d"),
end_date=last_day_of_month.strftime("%Y-%m-%d"),
)
Expand Down
8 changes: 4 additions & 4 deletions litellm/integrations/gcs_pubsub/pub_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __init__(
topic_id (str): Pub/Sub topic ID
credentials_path (str, optional): Path to Google Cloud credentials JSON file
"""
from litellm.proxy.utils import _premium_user_check
from litellm.proxy.utils import premium_user_check

_premium_user_check()
premium_user_check()

self.async_httpx_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)

Expand Down Expand Up @@ -107,9 +107,9 @@ async def async_log_success_event(self, kwargs, response_obj, start_time, end_ti
from litellm.proxy.spend_tracking.spend_tracking_utils import (
get_logging_payload,
)
from litellm.proxy.utils import _premium_user_check
from litellm.proxy.utils import premium_user_check

_premium_user_check()
premium_user_check()

try:
verbose_logger.debug("PubSub: Logging - Enters logging function for model %s", kwargs)
Expand Down
4 changes: 2 additions & 2 deletions litellm/integrations/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3833,7 +3833,7 @@ async def _initialize_api_key_budget_metrics(self):
"""
from litellm.constants import UI_SESSION_TOKEN_TEAM_ID
from litellm.proxy.management_endpoints.key_management_endpoints import (
_list_key_helper,
list_key_helper,
)
from litellm.proxy.proxy_server import prisma_client

Expand All @@ -3847,7 +3847,7 @@ async def fetch_keys(
list[str | UserAPIKeyAuth | LiteLLM_DeletedVerificationToken],
int | None,
]:
key_list_response: Final = await _list_key_helper(
key_list_response: Final = await list_key_helper(
prisma_client=prisma_client,
page=page,
size=page_size,
Expand Down
8 changes: 4 additions & 4 deletions litellm/integrations/shadow_eval_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ async def _key_or_team_is_over_budget(metadata: Mapping[str, object]) -> bool:
from litellm.exceptions import BudgetExceededError
from litellm.proxy._types import UserAPIKeyAuth
from litellm.proxy.auth.auth_checks import (
_team_max_budget_check,
_virtual_key_max_budget_check,
get_team_object,
team_max_budget_check,
virtual_key_max_budget_check,
)
from litellm.proxy.proxy_server import prisma_client, proxy_logging_obj, user_api_key_cache
except ImportError:
Expand All @@ -645,15 +645,15 @@ async def _key_or_team_is_over_budget(metadata: Mapping[str, object]) -> bool:
if not isinstance(auth, UserAPIKeyAuth):
return False
try:
await _virtual_key_max_budget_check(valid_token=auth, proxy_logging_obj=proxy_logging_obj)
await virtual_key_max_budget_check(valid_token=auth, proxy_logging_obj=proxy_logging_obj)
if auth.team_id:
team: Final = await get_team_object(
team_id=auth.team_id,
prisma_client=prisma_client,
user_api_key_cache=user_api_key_cache,
check_cache_only=True,
)
await _team_max_budget_check(team_object=team, valid_token=auth, proxy_logging_obj=proxy_logging_obj)
await team_max_budget_check(team_object=team, valid_token=auth, proxy_logging_obj=proxy_logging_obj)
except BudgetExceededError:
return True
except Exception as e: # noqa: BLE001 # advisory gate: a failed read must not block sampling
Expand Down
8 changes: 4 additions & 4 deletions litellm/litellm_core_utils/custom_logger_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
VectorStorePreCallHook,
)
from litellm.integrations.zerobus import ZerobusLogger
from litellm.proxy.hooks.dynamic_rate_limiter import _PROXY_DynamicRateLimitHandler
from litellm.proxy.hooks.dynamic_rate_limiter_v3 import _PROXY_DynamicRateLimitHandlerV3
from litellm.proxy.hooks.dynamic_rate_limiter import PROXY_DynamicRateLimitHandler
from litellm.proxy.hooks.dynamic_rate_limiter_v3 import PROXY_DynamicRateLimitHandlerV3


class CustomLoggerRegistry:
Expand Down Expand Up @@ -101,8 +101,8 @@ class CustomLoggerRegistry:
"pointfive": PointFiveLogger,
"zerobus": ZerobusLogger,
"aws_sqs": SQSLogger,
"dynamic_rate_limiter": _PROXY_DynamicRateLimitHandler,
"dynamic_rate_limiter_v3": _PROXY_DynamicRateLimitHandlerV3,
"dynamic_rate_limiter": PROXY_DynamicRateLimitHandler,
"dynamic_rate_limiter_v3": PROXY_DynamicRateLimitHandlerV3,
"vector_store_pre_call_hook": VectorStorePreCallHook,
"dotprompt": DotpromptManager,
"bitbucket": BitBucketPromptManager,
Expand Down
22 changes: 12 additions & 10 deletions litellm/litellm_core_utils/litellm_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4969,35 +4969,37 @@ def _init_custom_logger_compatible_class(
return _otel_logger
elif logging_integration == "dynamic_rate_limiter":
from litellm.proxy.hooks.dynamic_rate_limiter import (
_PROXY_DynamicRateLimitHandler,
PROXY_DynamicRateLimitHandler,
)

for callback in _in_memory_loggers:
if isinstance(callback, _PROXY_DynamicRateLimitHandler):
if isinstance(callback, PROXY_DynamicRateLimitHandler):
return callback

if internal_usage_cache is None:
raise Exception(f"Internal Error: Cache cannot be empty - internal_usage_cache={internal_usage_cache}")

dynamic_rate_limiter_obj: Final = _PROXY_DynamicRateLimitHandler(internal_usage_cache=internal_usage_cache)
dynamic_rate_limiter_obj: Final = PROXY_DynamicRateLimitHandler(internal_usage_cache=internal_usage_cache)

if llm_router is not None and isinstance(llm_router, litellm.Router):
dynamic_rate_limiter_obj.update_variables(llm_router=llm_router)
_in_memory_loggers.append(dynamic_rate_limiter_obj)
return dynamic_rate_limiter_obj
elif logging_integration == "dynamic_rate_limiter_v3":
from litellm.proxy.hooks.dynamic_rate_limiter_v3 import (
_PROXY_DynamicRateLimitHandlerV3,
PROXY_DynamicRateLimitHandlerV3,
)

for callback in _in_memory_loggers:
if isinstance(callback, _PROXY_DynamicRateLimitHandlerV3):
if isinstance(callback, PROXY_DynamicRateLimitHandlerV3):
return callback

if internal_usage_cache is None:
raise Exception(f"Internal Error: Cache cannot be empty - internal_usage_cache={internal_usage_cache}")

dynamic_rate_limiter_obj_v3 = _PROXY_DynamicRateLimitHandlerV3(internal_usage_cache=internal_usage_cache)
dynamic_rate_limiter_obj_v3: Final = PROXY_DynamicRateLimitHandlerV3(
internal_usage_cache=internal_usage_cache
)

if llm_router is not None and isinstance(llm_router, litellm.Router):
dynamic_rate_limiter_obj_v3.update_variables(llm_router=llm_router)
Expand Down Expand Up @@ -5546,19 +5548,19 @@ def get_custom_logger_compatible_class(

elif logging_integration == "dynamic_rate_limiter":
from litellm.proxy.hooks.dynamic_rate_limiter import (
_PROXY_DynamicRateLimitHandler,
PROXY_DynamicRateLimitHandler,
)

for callback in _in_memory_loggers:
if isinstance(callback, _PROXY_DynamicRateLimitHandler):
if isinstance(callback, PROXY_DynamicRateLimitHandler):
return callback
elif logging_integration == "dynamic_rate_limiter_v3":
from litellm.proxy.hooks.dynamic_rate_limiter_v3 import (
_PROXY_DynamicRateLimitHandlerV3,
PROXY_DynamicRateLimitHandlerV3,
)

for callback in _in_memory_loggers:
if isinstance(callback, _PROXY_DynamicRateLimitHandlerV3):
if isinstance(callback, PROXY_DynamicRateLimitHandlerV3):
return callback

elif logging_integration == "langtrace":
Expand Down
8 changes: 4 additions & 4 deletions litellm/litellm_core_utils/prompt_templates/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,9 @@ def update_messages_with_model_file_ids(
}
"""
from litellm.proxy.openai_files_endpoints.common_utils import (
_is_base64_encoded_unified_file_id,
convert_b64_uid_to_unified_uid,
get_original_file_id,
is_base64_encoded_unified_file_id,
is_model_embedded_id,
)

Expand Down Expand Up @@ -603,7 +603,7 @@ def update_messages_with_model_file_ids(
if model_file_id_mapping and model_id is not None
else None
)
if not provider_file_id and _is_base64_encoded_unified_file_id(file_id):
if not provider_file_id and is_base64_encoded_unified_file_id(file_id):
unified_file_id = convert_b64_uid_to_unified_uid(file_id)
if "llm_output_file_id," in unified_file_id:
provider_file_id = unified_file_id.split("llm_output_file_id,")[1].split(";")[0]
Expand Down Expand Up @@ -634,9 +634,9 @@ def update_responses_input_with_model_file_ids(
Format: {"litellm_file_id": {"model_id": "provider_file_id"}}
"""
from litellm.proxy.openai_files_endpoints.common_utils import (
_is_base64_encoded_unified_file_id,
convert_b64_uid_to_unified_uid,
get_original_file_id,
is_base64_encoded_unified_file_id,
is_model_embedded_id,
)

Expand Down Expand Up @@ -671,7 +671,7 @@ def update_responses_input_with_model_file_ids(
updated_content.append(updated_content_item)
else:
# Check if this is a base64-encoded unified file ID without mapping
is_unified_file_id = _is_base64_encoded_unified_file_id(file_id)
is_unified_file_id = is_base64_encoded_unified_file_id(file_id)
if is_unified_file_id:
# Fallback: decode unified file ID
unified_file_id = convert_b64_uid_to_unified_uid(file_id)
Expand Down
4 changes: 2 additions & 2 deletions litellm/llms/anthropic/chat/guardrail_translation/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def _build_streaming_usage_response(
if not chunks:
return None
try:
return AnthropicPassthroughLoggingHandler._build_usage_only_response_from_chunks(
return AnthropicPassthroughLoggingHandler.build_usage_only_response_from_chunks(
all_chunks=chunks,
model=str((request_data or {}).get("model") or ""),
)
Expand Down Expand Up @@ -1226,7 +1226,7 @@ async def process_output_streaming_response(
has_ended: Final = self._check_streaming_has_ended(responses_so_far)
if has_ended:
# build the model response from the responses_so_far
built_response: Final = AnthropicPassthroughLoggingHandler._build_complete_streaming_response(
built_response: Final = AnthropicPassthroughLoggingHandler.build_complete_streaming_response(
all_chunks=responses_so_far,
litellm_logging_obj=cast("LiteLLMLoggingObj", litellm_logging_obj),
model="",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ async def _check_summary_model_access(
try:
from litellm.proxy._types import ProxyException
from litellm.proxy.auth.auth_checks import (
_can_object_call_model,
can_object_call_model,
can_project_access_model,
can_user_call_model,
get_project_object,
Expand Down Expand Up @@ -258,7 +258,7 @@ async def _check_summary_model_access(
if not models:
continue
try:
_can_object_call_model(
can_object_call_model(
model=summary_model,
llm_router=llm_router,
models=models,
Expand Down Expand Up @@ -370,7 +370,7 @@ async def _check_summary_model_access(
)
if member_allowed_models:
try:
_can_object_call_model(
can_object_call_model(
model=summary_model,
llm_router=llm_router,
models=list(member_allowed_models),
Expand Down Expand Up @@ -558,7 +558,7 @@ async def _check_summary_model_rate_limit(
limiter: Final[object] = get_proxy_hook("parallel_request_limiter") if get_proxy_hook is not None else None
should_rate_limit_check: Final[_ShouldRateLimit | None] = getattr(limiter, "should_rate_limit", None)
create_descriptors: Final[_CreateRateLimitDescriptors | None] = getattr(
limiter, "_create_rate_limit_descriptors", None
limiter, "create_rate_limit_descriptors", None
)
add_team_descriptor: Final[_AddModelRateLimitDescriptor | None] = getattr(
limiter, "_add_team_model_rate_limit_descriptor_from_metadata", None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ async def _handle_streaming_logging(self, collected_chunks: list[bytes], *, stre
if self.completion_start_time is not None:
self.litellm_logging_obj.completion_start_time = self.completion_start_time
self.litellm_logging_obj.model_call_details["completion_start_time"] = self.completion_start_time
logging_coroutine: Final = PassThroughStreamingHandler._route_streaming_logging_to_handler(
logging_coroutine: Final = PassThroughStreamingHandler.route_streaming_logging_to_handler(
litellm_logging_obj=self.litellm_logging_obj,
passthrough_success_handler_obj=GLOBAL_PASS_THROUGH_SUCCESS_HANDLER_OBJ,
url_route="/v1/messages",
Expand Down
Loading
Loading