diff --git a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py index 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 complete try: 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.py index 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.asyncio async def test_raw_output_file_id_converted_to_managed_id(