{"record":{"id":"58566a3277af3b3a","repo":"BerriAI/litellm","slug":"api-base-is-required-for-ragflow-provider-set-it","errorCode":null,"errorMessage":"api_base is required for RAGFlow provider. Set it via api_base parameter, RAGFLOW_API_BASE environment variable, or litellm.api_base","messagePattern":"api_base is required for RAGFlow provider\\. Set it via api_base parameter, RAGFLOW_API_BASE environment variable, or litellm\\.api_base","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/ragflow/chat/transformation.py","lineNumber":97,"sourceCode":"        Args:\n            api_base: Base API URL (e.g., http://ragflow-server:port or http://ragflow-server:port/v1)\n            api_key: API key (not used in URL construction)\n            model: Model name in format ragflow/{endpoint_type}/{id}/{model}\n            optional_params: Optional parameters\n            litellm_params: LiteLLM parameters (may contain api_base)\n            stream: Whether streaming is enabled\n\n        Returns:\n            Complete URL for the API call\n        \"\"\"\n        # Get api_base from multiple sources: input param, litellm_params, environment, or global litellm setting\n        if litellm_params and hasattr(litellm_params, \"api_base\") and litellm_params.api_base:\n            api_base = api_base or litellm_params.api_base\n\n        api_base = api_base or litellm.api_base or get_secret(\"RAGFLOW_API_BASE\") or get_secret_str(\"RAGFLOW_API_BASE\")\n\n        if api_base is None:\n            raise ValueError(\n                \"api_base is required for RAGFlow provider. Set it via api_base parameter, RAGFLOW_API_BASE environment variable, or litellm.api_base\"\n            )\n\n        # Parse model name to extract endpoint type and ID\n        endpoint_type, entity_id, _ = self._parse_ragflow_model(model)\n\n        # Remove trailing slash from api_base if present\n        api_base = api_base.rstrip(\"/\")\n\n        # Strip /v1 or /api/v1 from api_base if present, since we'll add the full path\n        # Check /api/v1 first because /api/v1 ends with /v1\n        if api_base.endswith(\"/api/v1\"):\n            api_base = api_base[:-7]  # Remove /api/v1\n        elif api_base.endswith(\"/v1\"):\n            api_base = api_base[:-3]  # Remove /v1\n\n        # Construct the RAGFlow-specific path\n        encoded_entity_id: Final = encode_url_path_segment(entity_id, field_name=\"entity_id\")","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/ragflow/chat/transformation.py#L79-L115","documentation":"Configuration guard in the RAGFlow get_complete_url: no base URL could be resolved from the argument, litellm_params, RAGFLOW_API_BASE env var, or global litellm.api_base, so the chat/agent endpoint URL cannot be constructed.","triggerScenarios":"Triggered when calling the RAGFlow provider without api_base: parameter, RAGFLOW_API_BASE env var, and litellm.api_base all unset.","commonSituations":"See trigger scenarios.","solutions":["Set the RAGFLOW_API_BASE environment variable to your RAGFlow server URL.","Or pass api_base parameter / set litellm.api_base."],"exampleFix":"os.environ[\"RAGFLOW_API_BASE\"] = \"http://localhost:9380\"","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}