litellm/tests/unit/router_rust/invoke
kenneth-berri 13101c8ae7
feat(router)!: let a deployment choose which cache controls a request may override (#54219)
* feat(router): let a deployment choose which cache controls a request may override

A deployment's litellm_params.cache and the request's cache are now merged one control at a time, and
allowed_cache_controls on the deployment names the controls a request may set. A request control outside
that list is ignored and named in the x-litellm-ignored-cache-controls response header.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): lock the s-max-age spelling and keep router default cache controls under a lock

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): lock use-cache, merge the s-max-age spelling as s-maxage, and apply the lock to sync text_completion

* fix(router): apply a deployment's cache controls on prompt-managed completions and report ignored ones on sync text_completion

* fix(router): report a prompt deployment's ignored cache controls when the rendered model is a group

* feat(router): a model's cache lock carries over to its fallbacks

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): a fallback keeps its own cache restrictions under the requested model's lock

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): combine a model's cache locks to the strictest, and match either s-maxage spelling in lists

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): keep a virtual key's cache controls and a locked fallback's stricter rule

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): read a virtual key's cache controls only from the request before fallback params

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(router): a key's cache control is exempt only at the key's exact value and type

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(router): rename the model's allowed_cache_controls to allowed_response_cache_overrides

* fix(router): a key's cache control passes a locked model only where it is at least as strict

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-24 14:33:59 -08:00
..
__init__.py fix(anthropic): skip a stream data line that is not a JSON object (#53393) 2026-11-22 22:54:02 +00:00
test_cache_controls.py feat(router)!: let a deployment choose which cache controls a request may override (#54219) 2026-11-24 14:33:59 -08:00
test_model_cache_controls_attempt.py feat(router)!: let a deployment choose which cache controls a request may override (#54219) 2026-11-24 14:33:59 -08:00
test_streaming.py fix(anthropic): skip a stream data line that is not a JSON object (#53393) 2026-11-22 22:54:02 +00:00