{"record":{"id":"c5eeb9a4a3d6c197","repo":"BerriAI/litellm","slug":"api-base-is-required-c5eeb9","errorCode":null,"errorMessage":"api_base is required","messagePattern":"api_base is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/vector_store_files/transformation.py","lineNumber":80,"sourceCode":"    @abstractmethod\n    def validate_environment(\n        self,\n        *,\n        headers: dict[str, str],\n        litellm_params: GenericLiteLLMParams | None,\n    ) -> dict[str, str]:\n        return {}\n\n    @abstractmethod\n    def get_complete_url(\n        self,\n        *,\n        api_base: str | None,\n        vector_store_id: str,\n        litellm_params: dict[str, Any],\n    ) -> str:\n        if api_base is None:\n            raise ValueError(\"api_base is required\")\n        return api_base\n\n    @abstractmethod\n    def transform_create_vector_store_file_request(\n        self,\n        *,\n        vector_store_id: str,\n        create_request: VectorStoreFileCreateRequest,\n        api_base: str,\n    ) -> tuple[str, dict[str, Any]]: ...\n\n    @abstractmethod\n    def transform_create_vector_store_file_response(\n        self,\n        *,\n        response: httpx.Response,\n    ) -> VectorStoreFileObject: ...\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/vector_store_files/transformation.py#L62-L98","documentation":"BaseVectorStoreFilesConfig.get_complete_url() builds the URL for vector-store-file operations. Its default implementation returns api_base unchanged but first asserts it is not None, raising ValueError('api_base is required'). Without the guard a None base would produce 'None/vector_stores/.../files' and fail much later with a confusing HTTP error.","triggerScenarios":"Calling vector-store file CRUD (create/get/delete a file within a store) when api_base is unresolvable — no litellm_params.api_base, no provider default, no env var set.","commonSituations":"Self-hosted vector DB backends wired into litellm without api_base in the deployment config; env vars missing in containers/CI; provider config entries created by copying a chat-model template that lacks vector-store fields.","solutions":["Pass api_base via litellm_params on the file call.","Set the provider's API-base env var or add api_base to the provider's vector-store config in litellm's config file.","Override get_complete_url in a custom config to encode the provider's real file endpoint."],"exampleFix":"# before\nawait litellm.acreate_vector_store_file(\n    vector_store_id=\"vs_123\", provider=\"myvdb\", create_request=body,  # ValueError\n)\n\n# after\nawait litellm.acreate_vector_store_file(\n    vector_store_id=\"vs_123\", provider=\"myvdb\", create_request=body,\n    litellm_params={\"api_base\": \"http://vectordb.internal:8080\"},\n)","handlingStrategy":"validation","validationCode":"if not litellm_params.get(\"api_base\") and not os.getenv(\"MYVDB_API_BASE\"):\n    raise ValueError(\"vector-store file ops require api_base\")","typeGuard":null,"tryCatchPattern":"try:\n    f = await litellm.acreate_vector_store_file(vector_store_id=vid, provider=p, create_request=body)\nexcept ValueError as e:\n    if \"api_base is required\" in str(e):\n        raise RuntimeError(\"set MYVDB_API_BASE or litellm_params['api_base']\") from None\n    raise","preventionTips":["Reuse the same validated provider config object for store and file operations so api_base is never missing.","Add config-schema validation for vector-store entries (api_base required field)."],"tags":["vector-store","files","configuration","api-base","value-error","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}