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]

Merge remote-tracking branch 'origin/main' into litellm_vllm_batch_runner

mateo-berri608f8e218428
diff --cc litellm/proxy/batches_endpoints/endpoints.py
index 19e56e97338,0e348fa6e06..1284690172a
--- a/litellm/proxy/batches_endpoints/endpoints.py
+++ b/litellm/proxy/batches_endpoints/endpoints.py
@@@ -388,8 -293,13 +391,9 @@@ async def create_batch
detail={"error": f"Expected 1 model, got {len(target_model_names)}"},
)
model: Final = target_model_names[0]
+ await authorize_model_for_key(model_id=model, llm_router=llm_router, user_api_key_dict=user_api_key_dict)
_create_batch_data["model"] = model
- resolved_storage_url: Final = await _resolve_managed_input_file_storage_url(input_file_id)
- if resolved_storage_url is not None:
- _create_batch_data["input_file_id"] = resolved_storage_url
-
if llm_router is None:
raise HTTPException(
status_code=500,
@@@ -424,12 -319,12 +428,13 @@@
# SCENARIO 2 & 3: Model from header/query OR custom_llm_provider fallback
if model_param:
# SCENARIO 2: Use model-based routing from header/query/body
- credentials = get_credentials_for_model(
+ credentials = await get_authorized_credentials_for_model(
llm_router=llm_router,
model_id=model_param,
+ user_api_key_dict=user_api_key_dict,
operation_context="batch creation",
)
+ await _raise_when_input_file_must_be_managed(model_param, credentials)
prepare_data_with_credentials(
data=_create_batch_data,
diff --cc tests/test_litellm/proxy/batches_endpoints/test_endpoints.py
index 59c0e05d97b,1b3f3806d79..c2101abd350
--- a/tests/test_litellm/proxy/batches_endpoints/test_endpoints.py
+++ b/tests/test_litellm/proxy/batches_endpoints/test_endpoints.py
@@@ -54,7 -51,8 +54,8 @@@ from litellm.proxy.openai_files_endpoin
from litellm.proxy.utils import ProxyLogging
from litellm.router import Router
from litellm.types.llms.openai import BatchJobStatus
+ from litellm.types.router import Deployment, LiteLLM_Params, ModelInfo
-from litellm.types.utils import CredentialItem, LiteLLMBatch
+from litellm.types.utils import CredentialItem, LiteLLMBatch, SpecialEnums
from fastapi import Request, Response