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(batches): persist real terminal status when billing expired batches
mateo-berrieacea13a257d
diff --git a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.pyindex 00cc184a515..38266f6c3ea 100644--- a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py+++ b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py@@ -698,7 +698,7 @@ class CheckBatchCost:# mark the job as completetry:update_data: dict = {- "status": "complete",+ "status": response.status if response.status != "completed" else "complete","file_object": response.model_dump_json(),}if self._has_batch_processed_column:diff --git a/tests/proxy_unit_tests/test_check_batch_cost.py b/tests/proxy_unit_tests/test_check_batch_cost.pyindex 7616a1d5ddc..ca9d5f7f7d4 100644--- a/tests/proxy_unit_tests/test_check_batch_cost.py+++ b/tests/proxy_unit_tests/test_check_batch_cost.py@@ -1036,6 +1036,9 @@ class TestCheckBatchCost:1]["data"]assert update_data["batch_processed"] is True+ assert (+ update_data["status"] == "expired"+ ), "billed expired batch must keep its real terminal status in the DB"@pytest.mark.asyncioasync def test_raw_output_file_id_converted_to_managed_id(