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
fix(cost_map): label the card's loaded_at as per-worker and cover the integrity-failure fallback
mateo-berribb52fd44fa42
diff --git 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.pyindex d9fe6d2f979..7c3ad283639 100644--- 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@@ -684,3 +684,23 @@ def test_boot_load_fallback_to_the_backup_reports_its_blob_id_and_drops_the_remoassert source["source"] == "local"assert source["etag"] is Noneassert source["source_revision"] == _bundled_blob_id()+++def test_boot_load_that_fails_the_integrity_check_reports_the_backup_not_the_rejected_fetch():+ """A fetch that succeeds but fails integrity validation is thrown away, so the provenance must+ describe the backup that got loaded, never the ETag or bytes of the map that was rejected."""+ remote, _ = _mock_client(+ [httpx.Response(200, headers={"ETag": 'W/"boot"'}, content=_real_map_bytes())], client_cls=httpx.Client+ )+ get_model_cost_map(url=_URL, sleep=_SyncSleepRecorder(), rng=random.Random(0), client=remote)+ shrunk_body = b'{"gpt-5.4-mini": {"mode": "chat", "input_cost_per_token": 1e-06, "output_cost_per_token": 2e-06}}'+ shrunk, _ = _mock_client([httpx.Response(200, headers={"ETag": 'W/"shrunk"'}, content=shrunk_body)], client_cls=httpx.Client)++ get_model_cost_map(url=_URL, sleep=_SyncSleepRecorder(), rng=random.Random(0), client=shrunk)++ source = get_model_cost_map_source_info()+ assert source["source"] == "local"+ assert source["fallback_reason"] == "Remote data failed integrity validation"+ assert source["etag"] is None+ assert source["source_revision"] == _bundled_blob_id()+ assert source["source_revision"] != git_blob_id(shrunk_body)diff --git a/ui/litellm-dashboard/src/components/price_data_reload.test.tsx b/ui/litellm-dashboard/src/components/price_data_reload.test.tsxindex 101612993b0..3566ec2c3f2 100644--- a/ui/litellm-dashboard/src/components/price_data_reload.test.tsx+++ b/ui/litellm-dashboard/src/components/price_data_reload.test.tsx@@ -68,6 +68,7 @@ describe("PriceDataReload", () => {expect(screen.getByText("ETag:")).toBeInTheDocument();expect(screen.getByText('W/"eb8e9a53f4cc284b"')).toBeInTheDocument();expect(screen.getByText("Loaded at:")).toBeInTheDocument();+ expect(screen.getByText(/worker that answered this request/)).toBeInTheDocument();expect(screen.getByText(new Date(provenance.loaded_at).toLocaleString())).toBeInTheDocument();});@@ -91,6 +92,7 @@ describe("PriceDataReload", () => {expect(screen.queryByText("Source revision:")).not.toBeInTheDocument();expect(screen.queryByText("ETag:")).not.toBeInTheDocument();expect(screen.queryByText("Loaded at:")).not.toBeInTheDocument();+ expect(screen.queryByText(/worker that answered this request/)).not.toBeInTheDocument();});it("confirms an immediate reload and refreshes dependent data", async () => {diff --git a/ui/litellm-dashboard/src/components/price_data_reload.tsx b/ui/litellm-dashboard/src/components/price_data_reload.tsxindex e5977a1b6e3..1363e306a31 100644--- a/ui/litellm-dashboard/src/components/price_data_reload.tsx+++ b/ui/litellm-dashboard/src/components/price_data_reload.tsx@@ -132,6 +132,15 @@ const CostMapProvenanceRows: React.FC<{ sourceInfo: CostMapSourceInfo }> = ({ so<span className="font-medium">{formatDateTime(sourceInfo.loaded_at)}</span></div>)}++ {sourceInfo.loaded_at && (+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground">+ <Info className="size-3.5 shrink-0" />+ <span>+ Reported by the worker that answered this request. Other workers pick up a reload on their next poll+ </span>+ </div>+ )}</>);