mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* fix(router): count a Responses WebSocket turn's input against deployment ITPM A socket turn was only refused once the minute's input count already sat at the deployment's itpm limit, so a turn whose own input pushed the count past the limit went through while the same HTTP request got a 429. The socket open and every later turn now hand their request to the check, which adds the turn's input estimate before comparing, the way the HTTP route does. Responses item-list input is now estimated through the shared Responses-to-chat converter instead of counting as 0 on both routes. * fix(router): stop the ITPM estimate from downloading item-list image URLs * fix(router): keep item-list text counted when a media block cannot be counted * fix(router): leave item-list input out of the ITPM estimate Counting item lists refused cached conversations larger than the limit on every minute, including compaction calls, and parsed PDFs during admission. The turn check now reads only the frame's input, so an extra prompt or messages field cannot shrink its estimate * fix(responses): skip cooldown for a socket turn larger than ITPM and keep valid first-frame hints * fix(responses): route a socket turn to a deployment with ITPM room and skip warmup input A first frame that does not fit one deployment now moves to a deployment with room, and a deployment that still has room is no longer cooled down. A generate false warmup no longer counts its input against ITPM, and refusals keep the plain RateLimitError class * refactor(router): type the deployment in the ITPM pre-call check * fix(router): run the ITPM deployment filter only for a new socket turn The filter made every async request on a router with enforce_model_rate_limits read its deployments back, so HTTP calls on large model groups got slower. Requests the check does not filter now keep the no-filter shortcut, and other filters still run * fix(responses): refund a refused socket turn's project quota A deployment refusal on a later WebSocket turn now gives back that turn's project ITPM and OTPM charge, matching the HTTP route, and only while the charged window is still open The ITPM deployment filter now turns on only for a real client socket, so an HTTP body field named first_message can no longer switch it on * fix(responses): answer a refused WebSocket turn before returning its quota charge Send the 429 and bill the refusal first so a slow Redis cannot delay them, floor window-guarded counters at zero so a refund cannot create credit, keep the deployment filter to Responses sockets, and ignore non-callable quota callback returns * fix(responses): ignore a quota callback's return value unless it is an async refund --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_endpoints.py | ||