{"record":{"id":"72aa26fd9fbe57b3","repo":"BerriAI/litellm","slug":"api-base-must-be-provided-for-hosted-vllm-rerank-72aa26","errorCode":null,"errorMessage":"api_base must be provided for Hosted VLLM rerank","messagePattern":"api_base must be provided for Hosted VLLM rerank","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/hosted_vllm/transcriptions/transformation.py","lineNumber":48,"sourceCode":"    def __init__(self) -> None:\n        pass\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        optional_params: dict,\n        litellm_params: dict,\n        stream: bool | None = None,\n    ) -> str:\n        if api_base:\n            # Remove trailing slashes and ensure clean base URL\n            api_base = api_base.rstrip(\"/\")\n            if not api_base.endswith(\"/v1/audio/transcriptions\"):\n                api_base = f\"{api_base}/v1/audio/transcriptions\"\n            return api_base\n        raise ValueError(\"api_base must be provided for Hosted VLLM rerank\")\n\n    def transform_audio_transcription_request(\n        self,\n        model: str,\n        audio_file: FileTypes,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> AudioTranscriptionRequestData:\n        \"\"\"\n        Transform the audio transcription request\n        \"\"\"\n\n        data: Final = {\"model\": model, \"file\": audio_file, **optional_params}\n\n        return AudioTranscriptionRequestData(\n            data=data,\n        )\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/hosted_vllm/transcriptions/transformation.py#L30-L66","documentation":"Raised by HostedVLLM TranscriptionConfig.get_complete_url when api_base is falsy for an audio transcription call. The vLLM-compatible server URL is required because hosted_vllm is self-hosted. Note the message text ('...must be provided for Hosted VLLM rerank') is a copy-paste from the rerank handler — it is misleading, but the actual failure is the missing api_base for transcriptions.","triggerScenarios":"Calling litellm.transcription(model='hosted_vllm/whisper-...', file=audio_file) without api_base and without a resolvable default. Like the rerank handler, this method only checks the explicit api_base argument (no env-var fallback in this method).","commonSituations":"New audio-transcription feature added to an existing app where only chat calls passed api_base; assuming HOSTED_VLLM_API_BASE covers transcription (it does not in this handler); the confusing 'rerank' wording sending developers to debug their rerank config instead of supplying the transcription URL.","solutions":["Pass api_base to the transcription call: litellm.transcription(model='hosted_vllm/...', file=f, api_base='http://vllm-host:8000').","Ignore the word 'rerank' in the message — for transcription calls this simply means api_base was empty.","Ensure the vLLM server actually exposes /v1/audio/transcriptions (path appended automatically) with an audio model loaded."],"exampleFix":"# before\nlitellm.transcription(model='hosted_vllm/whisper-large-v3', file=audio_file)\n# raises ValueError: 'api_base must be provided for Hosted VLLM rerank'  (misleading text; it's the transcription api_base)\n\n# after\nlitellm.transcription(\n    model='hosted_vllm/whisper-large-v3',\n    file=audio_file,\n    api_base='http://localhost:8000',\n)\n","handlingStrategy":"validation","validationCode":"def vllm_transcription_base(api_base: str | None) -> str:\n    if not api_base:\n        raise ValueError(\"hosted_vllm transcription requires an explicit api_base\")\n    return api_base","typeGuard":null,"tryCatchPattern":"try:\n    litellm.transcription(model=\"hosted_vllm/...\", file=f, api_base=base)\nexcept ValueError as e:\n    if \"api_base must be provided\" in str(e):\n        # note: message text says 'rerank' but this is the transcription handler\n        raise RuntimeError(\"missing api_base for hosted_vllm transcription\") from e\n    raise","preventionTips":["Pass api_base explicitly to every hosted_vllm call — the transcription handler does not read HOSTED_VLLM_API_BASE.","Don't chase rerank config when this fires during transcription; the message text is copy-pasted and misleading."],"tags":["hosted-vllm","transcription","audio","api-base","configuration","misleading-message"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}