Skip to content

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]

Fix batch retrieve not setting model_id, causing output_file_id to stay raw

yuneng-jiang4888a31e4f13
diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py
index 143b2607feb..7dbb427ee0c 100644
--- a/litellm/proxy/batches_endpoints/endpoints.py
+++ b/litellm/proxy/batches_endpoints/endpoints.py
@@ -26,6 +26,7 @@ from litellm.proxy.openai_files_endpoints.common_utils import (
encode_file_id_with_model,
get_batch_from_database,
get_credentials_for_model,
+ get_model_id_from_unified_batch_id,
get_models_from_unified_file_id,
get_original_file_id,
prepare_data_with_credentials,
@@ -455,6 +456,10 @@ async def retrieve_batch( # noqa: PLR0915
response = await llm_router.aretrieve_batch(**data) # type: ignore
response._hidden_params["unified_batch_id"] = unified_batch_id
+ if unified_batch_id:
+ model_id_from_batch = get_model_id_from_unified_batch_id(unified_batch_id)
+ if model_id_from_batch:
+ response._hidden_params["model_id"] = model_id_from_batch
# SCENARIO 3: Fallback to custom_llm_provider (uses env variables)
else: