mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-05 07:37:50 +00:00
* fix(proxy): attribute retry attempt spend rows to their own deployment and keep them out of daily request counts
Each <request_id>-attempt-<n> row now carries the model, provider, api_base and model group of the deployment that billed it (looked up by model_info.id through the proxy router, injected as deployment_lookup) instead of copying the final row's, and is stamped internal_call_origin=billed_retry_attempt so the daily spend tables keep its spend and tokens while counting zero api_requests and failed_requests for it
* fix(proxy): declare DeploymentLookup as a TypeAlias and leave the test file's untouched lines as they were
* fix(proxy): mark attempt rows with billed_retry_attempt instead of internal_call_origin so model usage keeps their spend
Bugbot: an internal_call_origin stamp made build_model_usage_transaction drop the attempt rows from LiteLLM_DailyModelUsage. The rows now carry their own SpendLogsMetadata flag, which only the daily request counters read
* fix(proxy): read the billed_retry_attempt flag through a typed helper so the basedpyright gate holds
* fix(proxy): keep the typed litellm_params local in _deployment_provider so the basedpyright gate holds
* fix(proxy): annotate the validated litellm_params as LiteLLM_Params in _deployment_provider
* fix(proxy): keep billed retry attempts out of daily request errors and strip the flag from caller metadata
Bugbot: _record_request_error counted every attempt row as a caller failure in LiteLLM_DailyRequestErrors. Veria: a caller could send metadata.billed_retry_attempt to zero its own request counts, so the key joins the untrusted metadata fields the proxy strips on the way in
* fix(proxy): stamp billed_retry_attempt explicitly in the spend log metadata so the basedpyright gate holds
---------
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| db_transaction_queue | ||
| autorouter_session_rollup.py | ||
| base_client.py | ||
| baseline_accounting.py | ||
| budget_window_spend_writer.py | ||
| check_migration.py | ||
| create_views.py | ||
| daily_spend_bulk_upsert.py | ||
| db_lookup_gate.py | ||
| db_span.py | ||
| db_spend_update_writer.py | ||
| db_url_settings.py | ||
| dynamo_db.py | ||
| exception_handler.py | ||
| gateway_request_tracking.py | ||
| health_check_latest.py | ||
| log_db_metrics.py | ||
| master_key_migration.py | ||
| model_insights_tasks.py | ||
| model_usage_rollup.py | ||
| pgbouncer.py | ||
| prisma_client.py | ||
| prisma_query_span.py | ||
| proxy_worker_heartbeat.py | ||
| query_engine_reaper.py | ||
| request_error_tracking.py | ||
| rollup_lock_timeout.py | ||
| routing_prisma_wrapper.py | ||
| shadow_eval_funnel.py | ||
| spend_counter_reseed.py | ||
| spend_log_batching.py | ||
| spend_log_tool_index.py | ||
| token_auth.py | ||
| tool_registry_writer.py | ||