litellm/litellm-rust/crates/gateway-hooks
Nate Armstrong 4d7802f169
fix(gateway): stop serving routes outside the hooks and return reservations of failed requests (#47355)
* fix(gateway): refuse spent keys on every route and return reservations of requests that fail before routing

Auth refuses a key or team whose stored spend has reached its budget again, so
/v1/responses, audio and OCR, which skip the hook pipeline, stop exhausted keys
as the proxy does. The budgets hook still enforces the live counters on
messages and chat.

A request whose body is rejected after the hooks ran, such as an invalid
`cache` option, now records its failure so the budget reservation and rate
limit leases are returned. A request dropped mid-route, as when the client
goes away, is recorded as interrupted with status 499 for the same reason.

* fix(gateway): stop serving responses, audio and ocr instead of refusing spent keys in auth

/v1/responses, /v1/audio/transcriptions and /v1/ocr never ran the hook
pipeline, so budgets, rate limits and spend logging did not apply to them.
They now answer 501 like the other routes the gateway does not serve, and the
stored-spend check in auth is dropped again: the budgets hook covers every
route that remains.

* chore(gateway): update Cargo.lock for the dropped route crates

* fix(gateway): keep the reservation of a request cut off after it reached the provider
2026-10-19 14:38:45 -07:00
..
src fix(gateway): stop serving routes outside the hooks and return reservations of failed requests (#47355) 2026-10-19 14:38:45 -07:00
Cargo.toml feat(gateway): enforce key, team, user, member and end-user budgets on shared spend counters (#47044) 2026-10-19 09:58:44 -07:00