mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* fix(proxy): bill a refused /v1/messages stream on its failure row only * fix(proxy): count a Presidio block as a guardrail refusal so a refused stream bills one failure row * fix(proxy): refuse every /v1/messages stream by route so the Rust-served stream also bills one failure row * fix(proxy): bill refused gateway /v1/messages streams and reads cut mid-event A refused stream on /claude_code_gateway/v1/messages kept its success row, because the route check missed the gateway prefix. The failure row now also joins the bytes read before parsing them, as the success path does, so an event or a character split across reads still bills * fix(proxy): count billed failures toward per-model and router budgets * fix(proxy): stop and fully bill a refused native /v1/messages stream A post-call hook that refuses a native /v1/messages stream now stops the provider stream and bills every chunk the provider sent on the one failure row, instead of only the bytes the hooks had read. The read tap forwards the stream's attributes, so iterator hooks can still read the response's hidden params. The agent session budget now counts a billed failure, as the router budgets do. * fix(proxy): bill a refused /v1/messages stream once and keep Presidio prompt blocks out of failure logs A refusal that arrives after the stream's success log already ran no longer bills a second failure row. A Presidio block now logs a failure only when it refused a stream, so a prompt block sends nothing to the failure callbacks and a non-stream block keeps its billed tokens. A refused stream the Rust bridge serves is closed at the block, so the provider stops generating past the bytes the guardrail read * fix(proxy): keep one spend row when a /v1/messages stream is refused after its success log ran * fix(proxy): keep the $0 failure row for a stream refused after its success log ran Skipping the failure row and event for every claimed stream also dropped the refusal on streamGenerateContent and pass-through streams, which log it at base. A refusal after the success log now keeps the billed success row and the usual $0 failure row, so failure callbacks still see it. The test covers /v1/messages and streamGenerateContent on python and bridged streams * fix(proxy): count a cut stream's partial once in budgets and drop the unused provider-stop path * test(proxy): cover the key per-model and session budgets counting a retried attempt once * fix(proxy): subtract only the retried attempts whose failure the budgets counted * fix(proxy): ignore a request param that claims a success was already counted in budgets * fix(proxy): mask a refused stream's failure log with logging-only guardrails * fix(proxy): log a Presidio block after a stream's success log as a refusal * fix(logging): keep a refused stream's prompt from logging-only guardrails when message logging is off --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| adaptive_router | ||
| complexity_router | ||
| switchyard_router | ||
| __init__.py | ||
| test_auto_router.py | ||
| test_auto_router_model_naming.py | ||
| test_auto_router_tuning_baseline.py | ||
| test_base_routing_strategy.py | ||
| test_baseline_request.py | ||
| test_budget_limiter.py | ||
| test_budget_limiter_hotpath.py | ||
| test_complexity_router.py | ||
| test_complexity_tier_predictor.py | ||
| test_fuse_presets.py | ||
| test_lar1_routing.py | ||
| test_least_busy.py | ||
| test_litellm_encoder.py | ||
| test_llm_v2.py | ||
| test_lowest_cost.py | ||
| test_lowest_latency.py | ||
| test_lowest_tpm_rpm.py | ||
| test_lowest_tpm_rpm_v2.py | ||
| test_quality_router.py | ||
| test_router_routing_groups.py | ||
| test_router_routing_plugins.py | ||
| test_router_tag_regex_routing.py | ||
| test_router_tag_routing.py | ||
| test_savings_baseline.py | ||
| test_simple_shuffle.py | ||
| test_stall_detector.py | ||