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(main.py): route vllm calls via the openai sdk route

Krrish Dholakia8443000ca455
diff --git a/litellm/llms/openai/transcriptions/handler.py b/litellm/llms/openai/transcriptions/handler.py
index 03ac34f3dde..19b303bb968 100644
--- a/litellm/llms/openai/transcriptions/handler.py
+++ b/litellm/llms/openai/transcriptions/handler.py
@@ -34,6 +34,7 @@ class OpenAIAudioTranscription(OpenAIChatCompletion):
- call openai_aclient.audio.transcriptions.create by default
"""
try:
+
raw_response = (
await openai_aclient.audio.transcriptions.with_raw_response.create(
**data, timeout=timeout
diff --git a/litellm/llms/openai/transcriptions/whisper_transformation.py b/litellm/llms/openai/transcriptions/whisper_transformation.py
index bb14b4d47aa..fa507e1bc26 100644
--- a/litellm/llms/openai/transcriptions/whisper_transformation.py
+++ b/litellm/llms/openai/transcriptions/whisper_transformation.py
@@ -18,6 +18,34 @@ from ..common_utils import OpenAIError
class OpenAIWhisperAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
+ def get_complete_url(
+ self,
+ api_base: Optional[str],
+ api_key: Optional[str],
+ model: str,
+ optional_params: dict,
+ litellm_params: dict,
+ stream: Optional[bool] = None,
+ ) -> str:
+ """
+ OPTIONAL
+
+ Get the complete url for the request
+
+ Some providers need `model` in `api_base`
+ """
+ ## get the api base, attach the endpoint - v1/audio/transcriptions
+ # strip trailing slash if present
+ api_base = api_base.rstrip("/") if api_base else ""
+
+ # if endswith "/v1"
+ if api_base and api_base.endswith("/v1"):
+ api_base = f"{api_base}/audio/transcriptions"
+ else:
+ api_base = f"{api_base}/v1/audio/transcriptions"
+
+ return api_base or ""
+
def get_supported_openai_params(
self, model: str
) -> List[OpenAIAudioTranscriptionOptionalParams]:
@@ -77,7 +105,6 @@ class OpenAIWhisperAudioTranscriptionConfig(BaseAudioTranscriptionConfig):
"""
Transform the audio transcription request
"""
-
data = {"model": model, "file": audio_file, **optional_params}
if "response_format" not in data or (
diff --git a/litellm/main.py b/litellm/main.py
index 27ffaeba794..c910c88d17c 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -5267,7 +5267,10 @@ def transcription(
model_response = litellm.utils.TranscriptionResponse()
model, custom_llm_provider, dynamic_api_key, api_base = get_llm_provider(
- model=model, custom_llm_provider=custom_llm_provider, api_base=api_base
+ model=model,
+ custom_llm_provider=custom_llm_provider,
+ api_base=api_base,
+ api_key=api_key,
) # type: ignore
if dynamic_api_key is not None:
@@ -5283,6 +5286,7 @@ def transcription(
custom_llm_provider=custom_llm_provider,
**non_default_params,
)
+
litellm_params_dict = get_litellm_params(**kwargs)
litellm_logging_obj.update_environment_variables(
@@ -5349,7 +5353,6 @@ def transcription(
)
elif custom_llm_provider == "openai" or (
custom_llm_provider in litellm.openai_compatible_providers
- and provider_config is None
):
api_base = (
api_base
@@ -5364,6 +5367,7 @@ def transcription(
or None # default - https://github.com/openai/openai-python/blob/284c1799070c723c6a553337134148a7ab088dd8/openai/util.py#L105
)
# set API KEY
+
api_key = api_key or litellm.api_key or litellm.openai_key or get_secret("OPENAI_API_KEY") # type: ignore
response = openai_audio_transcriptions.audio_transcriptions(
model=model,
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index 7ed87144c05..8b9f81b41a2 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -10,3 +10,11 @@ model_list:
- model_name: xai-grok-3
litellm_params:
model: xai/grok-3
+ - model_name: hosted_vllm/whisper-v3
+ litellm_params:
+ model: hosted_vllm/whisper-v3
+ api_base: "https://webhook.site/2f385e05-00aa-402b-86d1-efc9261471a5"
+ api_key: dummy
+
+
+
diff --git a/litellm/utils.py b/litellm/utils.py
index 423f3cfa79e..31b94984e49 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -2428,6 +2428,8 @@ def get_optional_params_transcription(
# retrieve all parameters passed to the function
passed_params = locals()
+
+ passed_params.pop("OPENAI_TRANSCRIPTION_PARAMS")
custom_llm_provider = passed_params.pop("custom_llm_provider")
drop_params = passed_params.pop("drop_params")
special_params = passed_params.pop("kwargs")
@@ -2492,6 +2494,7 @@ def get_optional_params_transcription(
model=model,
drop_params=drop_params if drop_params is not None else False,
)
+
optional_params = add_provider_specific_params_to_optional_params(
optional_params=optional_params,
passed_params=passed_params,
@@ -4089,6 +4092,7 @@ def add_provider_specific_params_to_optional_params(
"""
Add provider specific params to optional_params
"""
+
if (
custom_llm_provider
in ["openai", "azure", "text-completion-openai"]