From 4f1e409082681fe5860bedd670662e782747e5bc Mon Sep 17 00:00:00 2001 From: eycjur Date: Sun, 28 Sep 2025 18:03:32 +0900 Subject: [PATCH 1/2] use extra_query for get request --- docs/my-website/docs/providers/azure/azure.md | 4 ++-- litellm/proxy/batches_endpoints/endpoints.py | 5 +++-- litellm/proxy/common_utils/openai_endpoint_utils.py | 11 +++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/my-website/docs/providers/azure/azure.md b/docs/my-website/docs/providers/azure/azure.md index 8471ca9406..1feec52b3e 100644 --- a/docs/my-website/docs/providers/azure/azure.md +++ b/docs/my-website/docs/providers/azure/azure.md @@ -931,7 +931,7 @@ curl http://localhost:4000/v1/batches \ ```python retrieved_batch = client.batches.retrieve( batch.id, - extra_body={"custom_llm_provider": "azure"} + extra_query={"custom_llm_provider": "azure"} ) ``` @@ -978,7 +978,7 @@ curl http://localhost:4000/v1/batches/batch_abc123/cancel \ ```python -client.batches.list(extra_body={"custom_llm_provider": "azure"}) +client.batches.list(extra_query={"custom_llm_provider": "azure"}) ``` diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py index f8e3a9109b..58ec1f2716 100644 --- a/litellm/proxy/batches_endpoints/endpoints.py +++ b/litellm/proxy/batches_endpoints/endpoints.py @@ -18,6 +18,7 @@ from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessin from litellm.proxy.common_utils.http_parsing_utils import _read_request_body from litellm.proxy.common_utils.openai_endpoint_utils import ( get_custom_llm_provider_from_request_body, + get_custom_llm_provider_from_request_query, ) from litellm.proxy.openai_files_endpoints.common_utils import ( _is_base64_encoded_unified_file_id, @@ -282,7 +283,7 @@ async def retrieve_batch( else: custom_llm_provider = ( provider - or await get_custom_llm_provider_from_request_body(request=request) + or get_custom_llm_provider_from_request_query(request=request) or "openai" ) response = await litellm.aretrieve_batch( @@ -392,7 +393,7 @@ async def list_batches( else: custom_llm_provider = ( provider - or await get_custom_llm_provider_from_request_body(request=request) + or get_custom_llm_provider_from_request_query(request=request) or "openai" ) response = await litellm.alist_batches( diff --git a/litellm/proxy/common_utils/openai_endpoint_utils.py b/litellm/proxy/common_utils/openai_endpoint_utils.py index 214a34d4d7..a18ccd0b0c 100644 --- a/litellm/proxy/common_utils/openai_endpoint_utils.py +++ b/litellm/proxy/common_utils/openai_endpoint_utils.py @@ -38,3 +38,14 @@ async def get_custom_llm_provider_from_request_body(request: Request) -> Optiona if "custom_llm_provider" in request_body: return request_body["custom_llm_provider"] return None + + +def get_custom_llm_provider_from_request_query(request: Request) -> Optional[str]: + """ + Get the `custom_llm_provider` from the request query parameters + + Safely reads the request query parameters + """ + if "custom_llm_provider" in request.query_params: + return request.query_params["custom_llm_provider"] + return None From 900241e06c575b59bf237e64bf362dd1db099431 Mon Sep 17 00:00:00 2001 From: eycjur Date: Sun, 28 Sep 2025 18:21:18 +0900 Subject: [PATCH 2/2] fix lint error --- litellm/proxy/batches_endpoints/endpoints.py | 1 - 1 file changed, 1 deletion(-) diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py index 58ec1f2716..4f1c4dae08 100644 --- a/litellm/proxy/batches_endpoints/endpoints.py +++ b/litellm/proxy/batches_endpoints/endpoints.py @@ -17,7 +17,6 @@ from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing from litellm.proxy.common_utils.http_parsing_utils import _read_request_body from litellm.proxy.common_utils.openai_endpoint_utils import ( - get_custom_llm_provider_from_request_body, get_custom_llm_provider_from_request_query, ) from litellm.proxy.openai_files_endpoints.common_utils import (