litellm/tests/unit/enterprise/proxy
Mateo Wang 3821e09071
feat(batches): share a model_info batch_enqueued_token_limit pool across teams and projects (#55618)
* feat(batches): share a model_info batch_enqueued_token_limit pool across teams and projects

A model_list entry's model_info.batch_enqueued_token_limit is now one enqueued-token pool per model group, shared by every caller. Teams can hold per-model allocations in model_batch_enqueued_token_limit like projects, and team and project writes answer 400 when the allocations for a model would add up past its pool

The pool never lifts the per-minute counters. A team allocation that covers every model in the batch lifts them like a team-wide limit. Pool and team allocation scopes are saved in a new trailing model_scopes field on the reservation record, so older pods still refund the rest

* fix(proxy): draw wildcard-routed models from the wildcard route's batch enqueued-token pool

* fix(proxy): charge a batch row's pool to the model serving it, not the deployment model an upload rewrote it to

* fix(proxy): keep batch pools on the serving group and lift limits only for pooled team allocations

A named model_list entry no longer draws from a wildcard route's pool, a team
allocation lifts the per-minute and daily batch limits only when every model
serving the batch has a pool, coverage reads the model serving each row so
model-routed uploads count, the allocation query gets a bounded span name, and
the file-reading opt-outs log one warning when they skip a configured pool.

* fix(proxy): lift team batch limits only when the serving entry has a pool and keep project coverage on row models

* fix(proxy): return batch allocation errors as plain text

* fix(proxy): expire each batch pool reservation on its own and keep team allocations from lifting limits

A model pool or team allocation reservation now lives in a per-scope sorted set with its own
expiry, so a batch nobody retrieves through the proxy frees its tokens after the TTL even while
other teams keep sending batches on that model. Key, team and project counters keep the shared
counter older pods charge and refund.

A team's per-model allocation now only caps the team's batches. Only a key or team-wide
batch_enqueued_token_limit, which was admin-only before, lifts the per-minute and daily limits,
so values a team admin saved before the upgrade never lift them.

* perf(proxy): keep a running total beside each batch pool's reservations

A pool or team allocation reserve summed every open reservation in Redis, so
a pool with 10,000 open batches blocked Redis for about 11 ms on each batch
create. The reserve now reads a running total, subtracts only the
reservations that expired since, and rebuilds the total from the
reservations when Redis evicts it. Both keys share one hash slot
2026-12-02 16:03:49 -08:00
..
auth feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
guardrails Return configured guardrail native findings (#49217) (#49460) 2026-10-31 23:37:45 +00:00
hooks fix(batches): deny batch create from another key's provider file id (#55617) 2026-12-02 14:44:38 -08:00
management_endpoints feat(batches): share a model_info batch_enqueued_token_limit pool across teams and projects (#55618) 2026-12-02 16:03:49 -08:00
__init__.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_afile_retrieve_returns_unified_id.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_audit_logging_endpoints.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_batch_retrieve_input_file_id.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_batch_retrieve_registers_missing_output_file_id.py fix(proxy): save file details for every batch output file so they list and retrieve (#41761) 2026-10-08 18:51:45 -07:00
test_batch_retrieve_returns_unified_input_file_id.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_batch_update_db_managed_output_file_id.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_deleted_file_returns_403_not_404.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_enterprise_routes.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_file_deletion_blocking.py fix(batches): stop unbillable batches from blocking file deletes and new-batch polling (#48752) 2026-10-28 12:19:36 -07:00
test_liteadmin.py feat(enterprise): bundle LiteAdmin Slack with native gateway login (#44444) 2026-10-03 17:28:18 -07:00
test_managed_files_access_check.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_managed_files_hook.py fix(managed files): keep one downstream copy per litellm_proxy deployment that covers every target it serves (#54181) 2026-11-25 06:07:13 +00:00