mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
* fix(proxy): keep the TPM reservation when an embedding's provider reports 0 input tokens Bedrock Titan, Vertex multimodalembedding and Gemini API image embeddings report usage 0, so the v3 limiter refunded the whole pre-call estimate and TPM limits never filled. An embedding reported as 0 input tokens now settles at its reservation, while a nonzero count, chat calls and output-only limits settle as before * fix(proxy): keep charging a 0-token embedding's TPM estimate after a failed attempt refunds it * fix(proxy): keep the TPM reservation when an embedding's provider reports 0 tokens, in the native limiter Main moved success settlement into the Rust parallel request limiter, so the earlier Python fix no longer applied. An embedding reported as 0 tokens under an input or total limit now settles at its pre-call estimate, also after a failed attempt refunded it, while a nonzero count, chat calls and output-only limits settle as before * style(proxy): cargo fmt the native limiter's import list * fix(proxy): keep 0-token embedding reservations on PTU and capacity shares, price Marengo images An embedding the provider reports as 0 tokens now keeps its admitting reservation on the PTU window and on team, key, and customer-org capacity shares, as the TPM window already does. A TwelveLabs Marengo request with input_type image is estimated as one image instead of its base64 text * fix(proxy): count 0-token embeddings toward model saturation and priority pools An embedding the provider reports as 0 tokens now adds the request's estimate to the model saturation and priority counters, read from the client request body at success. Team, key and customer-org borrow shares and fallback holds keep their reservation on an estimated charge. A usage with prompt tokens but a total of 0 now counts as reported in both the TPM limiter and the capacity engine. * fix(proxy): refund unpriced embedding media and keep the saturation estimate under redaction Embedding media the estimator cannot price (Marengo video or audio, Nova PDFs) is still reserved as text, and a 0-token report now refunds it instead of keeping a base64-sized charge. The saturation and priority counters read the request body stored at pre-call, so message redaction no longer blanks the estimate. An embedding reporting prompt tokens with a total of 0 is charged its prompt tokens under a total limit. * fix(proxy): treat gs and s3 embedding links as unpriced media and estimate embedding media once Storage links (gs://, s3://) in an embedding input no longer get charged as URL text. The limiter defers them to Python, which counts them as media no deployment prices, so they settle at the reported usage instead of the link text. The unpriced verdict now comes from the same single offloaded pass that builds the estimate, and capacity settles a held embedding from the estimate it remembered at pre-call instead of pricing its media again on the event loop. Capacity also resolves media pricing with the caller's team, and a settle without a logged model group refunds the unpriced share. * fix(proxy): charge gs and s3 embedding links as text again Treating any input that starts with gs:// or s3:// as unpriced media let plain text with that prefix skip TPM on backends that report 0 tokens, since the proxy can't tell a link the provider reads as media from text. Links are charged as their link text again, a few tokens each, and the limiter estimates them natively instead of deferring to Python. * fix(proxy): refund embedding images the estimator can only read as text * fix(proxy): refund embedding audio instances the estimator reads as text --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| litellm_skills | ||
| model_capacity_golden | ||
| __init__.py | ||
| native_capacity_handler.py | ||
| parallel_request_limiter_v3_golden.json | ||
| test_async_post_call_streaming_iterator_hook.py | ||
| test_autorouter_baseline_cache.py | ||
| test_banned_keyword_list.py | ||
| test_batch_enqueued_tokens.py | ||
| test_batch_enqueued_tokens_rust.py | ||
| test_batch_file_validation.py | ||
| test_batch_rate_limiter.py | ||
| test_dynamic_rate_limiter.py | ||
| test_dynamic_rate_limiter_v3_on_native_limiter_rust.py | ||
| test_dynamic_rate_limiter_v3_rust.py | ||
| test_image_generation_guardrails.py | ||
| test_key_management_event_hooks.py | ||
| test_max_budget_per_session_limiter.py | ||
| test_max_iterations_limiter.py | ||
| test_message_thread_ownership.py | ||
| test_model_budget_shared_windows.py | ||
| test_model_capacity_native.golden.json | ||
| test_model_capacity_native.py | ||
| test_model_max_budget_limiter.py | ||
| test_parallel_request_limiter.py | ||
| test_parallel_request_limiter_v3.py | ||
| test_parallel_request_limiter_v3_native.py | ||
| test_parallel_request_limiter_v3_rust.py | ||
| test_post_call_failure_hook_integration.py | ||
| test_post_call_response_headers_hook.py | ||
| test_post_call_streaming_hook_integration.py | ||
| test_post_call_success_hook_integration.py | ||
| test_priority_class_share.py | ||
| test_prompt_cache_observer.py | ||
| test_prompt_injection_detection.py | ||
| test_proxy_hooks_init.py | ||
| test_proxy_rate_limit_provider_field.py | ||
| test_proxy_rate_limit_provider_field_capacity_rust.py | ||
| test_proxy_rate_limit_provider_field_rust.py | ||
| test_proxy_track_cost_callback.py | ||
| test_proxy_track_cost_callback_ledger.py | ||
| test_proxy_track_cost_callback_rust.py | ||
| test_rate_limiter_toctou_capacity_rust.py | ||
| test_rate_limiter_toctou_rust.py | ||
| test_search_free_tier.py | ||
| test_send_invite_email.py | ||
| test_sensitive_data_routing.py | ||
| test_tpm_concurrent.py | ||
| test_tpm_concurrent_rust.py | ||
| test_unit_test_max_model_budget_limiter.py | ||
| test_user_management_event_hooks.py | ||