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]

use extra_query for get request

eycjur4f1e40908268
diff --git a/docs/my-website/docs/providers/azure/azure.md b/docs/my-website/docs/providers/azure/azure.md
index 8471ca94066..1feec52b3ec 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 \
<TabItem value="sdk" label="OpenAI Python SDK">
```python
-client.batches.list(extra_body={"custom_llm_provider": "azure"})
+client.batches.list(extra_query={"custom_llm_provider": "azure"})
```
</TabItem>
diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py
index f8e3a9109bc..58ec1f27166 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 214a34d4d71..a18ccd0b0c1 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