The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge origin/litellm_internal_staging into litellm_cli_skip_cost_map_fetch
kerry3a54e5bcb944
diff --cc litellm/litellm_core_utils/get_model_cost_map.pyindex 7d3b67e58c8,f81ddbfee2e..a75aa3a9cc2--- a/litellm/litellm_core_utils/get_model_cost_map.py+++ b/litellm/litellm_core_utils/get_model_cost_map.py@@@ -14,7 -13,7 +14,8 @@@ import hashliimport jsonimport osimport random+import sys+ import threadingimport timefrom collections.abc import Awaitable, Callablefrom dataclasses import dataclass, replace@@@ -540,11 -600,8 +609,12 @@@ def get_model_cost_map"""Public entry point — returns the model cost map dict.- 1. If ``LITELLM_LOCAL_MODEL_COST_MAP`` is set, uses the local backup only.- 2. Otherwise fetches from ``url``, retrying transient errors in a background thread.+ 1. If ``LITELLM_LOCAL_MODEL_COST_MAP`` is set or this is a ``lite`` /+ ``litellm-proxy`` CLI process, uses the local backup only.+ 2. Otherwise fetches from ``url``, retrying transient HTTP errors- (429/5xx/transport) with Retry-After-aware backoff, validates- integrity, and falls back to the local backup on any failure.++ (429/5xx/transport) with Retry-After-aware backoff in a background++ thread, validates integrity, and falls back to the local backup on any++ failure.Only the backup model count is cached (a single int) for validation.The full backup dict is only parsed when it must be *returned* as adiff --cc tests/test_litellm/litellm_core_utils/test_get_model_cost_map.pyindex 6ab3f9a21af,266c2ca1465..c509c8399c9--- a/tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py+++ b/tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py@@@ -6,7 -6,7 +6,8 @@@ count actual model entries, not reserveimport jsonimport os+import sys+ import threadingimport pytest