Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9cc5cb5
feat(proxy): fairness under load controls with fair queueing and admi…
yassin-berriai Sep 19, 2026
65dfc9a
refactor(fairness): satisfy lint and type budgets with immutable queu…
yassin-berriai Sep 19, 2026
0d68429
fix(ui): space rejection breakdown text in fairness status table
yassin-berriai Sep 19, 2026
0f30d57
fix(proxy): expose fairness endpoints on the backend component
yassin-berriai Sep 19, 2026
55a179a
test(proxy): construct dynamic rate limiter v3 through __init__ in ra…
yassin-berriai Sep 19, 2026
5017654
Merge remote-tracking branch 'origin/main' into litellm_fairness_unde…
yassin-berriai Sep 25, 2026
c835009
fix(proxy): close fairness review findings on deadlines, disabled set…
yassin-berriai Sep 25, 2026
91df53c
fix(proxy): flatten fairness counter key builders and keep key edit v…
yassin-berriai Sep 25, 2026
c5c7884
fix(proxy): clear mirrored priority reservations when fairness is dis…
yassin-berriai Sep 25, 2026
28c8fe0
fix(proxy): report reservations as enforced only while workload class…
yassin-berriai Sep 25, 2026
d6679b6
fix(proxy): settle fairness reservations from any response usage and …
yassin-berriai Sep 25, 2026
fe36924
Merge remote-tracking branch 'origin/main' into litellm_fairness_unde…
yassin-berriai Sep 25, 2026
87fae76
fix(proxy): charge fair-queue passes only on admission, keep stats fa…
yassin-berriai Sep 25, 2026
a0d2e7f
Merge remote-tracking branch 'origin/main' into litellm_fairness_unde…
yassin-berriai Sep 25, 2026
eeeeea7
fix(proxy): unregister the fairness-owned limiter when fairness is di…
yassin-berriai Sep 25, 2026
85760be
fix(proxy): clear a class's yielded turn when its queue head leaves t…
yassin-berriai Sep 25, 2026
36558fb
fix(proxy): apply fairness settings after configured callbacks load
yassin-berriai Sep 25, 2026
cbc82e1
Merge remote-tracking branch 'origin/main' into litellm_fairness_unde…
yassin-berriai Sep 25, 2026
207989e
fix(proxy): floor fairness reservations at one token and pause the li…
yassin-berriai Sep 25, 2026
31119bd
fix(proxy): release queued waiters and skip billing for requests admi…
yassin-berriai Sep 25, 2026
1f08c3b
Merge remote-tracking branch 'origin/main' into litellm_fairness_unde…
yassin-berriai Sep 26, 2026
f19f5a1
fix(proxy): refund fairness reservations on proxy-side rejection and …
yassin-berriai Sep 26, 2026
93e7c6e
fix(proxy): bill actual usage when a success lands after its reservat…
yassin-berriai Sep 26, 2026
478f7c8
fix(proxy): bill only usage a settlement has not already charged
yassin-berriai Sep 26, 2026
a0e7aba
fix(proxy): record settled usage before the reservation write so a ra…
yassin-berriai Sep 26, 2026
6aff9db
fix(proxy): keep a concurrent billing record when the reservation wri…
yassin-berriai Sep 26, 2026
511e689
fix(proxy): serialize reservation settlement and billing per request
yassin-berriai Sep 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/routes/allowlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"/cost_tracking",
"/cost_optimization/",
"/cost/",
"/fairness/",
"/credentials",
"/credential",
"/provider/budgets",
Expand Down
4 changes: 3 additions & 1 deletion litellm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,12 @@ def _dev_env_hot_reload_enabled() -> bool:
# Old format: { "displayName": "url" } (for backward compatibility)
public_model_groups_links: Dict[str, Union[str, Dict[str, Any]]] = {}
#### REQUEST PRIORITIZATION #######
priority_reservation: Optional[Dict[str, Union[float, "PriorityReservationDict"]]] = None
priority_reservation: Optional[Mapping[str, Union[float, "PriorityReservationDict"]]] = None
# priority_reservation_settings is lazy-loaded via __getattr__
# Only declare for type checking - at runtime __getattr__ handles it
if TYPE_CHECKING:
priority_reservation_settings: Optional["PriorityReservationSettings"] = None
fairness_settings: Optional["FairnessSettings"] = None


######## Networking Settings ########
Expand Down Expand Up @@ -1558,6 +1559,7 @@ def set_global_gitlab_config(config: Dict[str, Any]) -> None:
if TYPE_CHECKING:
from litellm.types.utils import ModelInfo as _ModelInfoType
from litellm.types.utils import PriorityReservationSettings
from litellm.types.proxy.fairness import FairnessSettings
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
from litellm.caching.caching import Cache

Expand Down
1 change: 1 addition & 0 deletions litellm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,7 @@
"cost_margin_config",
"block_requests_for_models_without_pricing",
"budget_exceeded_throttle_percentage",
"fairness_settings",
# Every field editable from the Admin UI (proxy_server._GENERAL_SETTINGS_UI_LITELLM_FIELDS)
# must be listed here so a DB write from one worker overrides the live litellm attribute on
# the others when config reloads; otherwise peer workers stay on their startup value.
Expand Down
16 changes: 16 additions & 0 deletions litellm/proxy/common_utils/active_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from contextvars import ContextVar
from typing import Final

from fastapi import Request

active_request: Final[ContextVar[Request | None]] = ContextVar("litellm_active_request", default=None)


async def active_request_disconnected() -> bool:
request: Final = active_request.get()
if request is None:
return False
try:
return await request.is_disconnected()
except Exception: # noqa: BLE001 # disconnect probing must never fail the request
return False
Loading
Loading