{"record":{"id":"c3e1fd47def6f3da","repo":"BerriAI/litellm","slug":"api-key-is-required-set-ragflow-api-key-env-var-o","errorCode":null,"errorMessage":"api_key is required (set RAGFLOW_API_KEY env var or pass in litellm_params)","messagePattern":"api_key is required \\(set RAGFLOW_API_KEY env var or pass in litellm_params\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/ragflow/vector_stores/transformation.py","lineNumber":33,"sourceCode":"    VectorStoreSearchResponse,\n)\n\nif TYPE_CHECKING:\n    from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj\nelse:\n    LiteLLMLoggingObj = Any\n\n\nclass RAGFlowVectorStoreConfig(BaseVectorStoreConfig):\n    \"\"\"Vector store configuration for RAGFlow datasets.\"\"\"\n\n    def get_auth_credentials(self, litellm_params: dict) -> BaseVectorStoreAuthCredentials:\n        api_key = litellm_params.get(\"api_key\")\n        if api_key is None:\n            # Try to get from environment variable\n            api_key = get_secret_str(\"RAGFLOW_API_KEY\")\n        if api_key is None:\n            raise ValueError(\"api_key is required (set RAGFLOW_API_KEY env var or pass in litellm_params)\")\n        return {\n            \"headers\": {\n                \"Authorization\": f\"Bearer {api_key}\",\n            },\n        }\n\n    def get_vector_store_endpoints_by_type(self) -> VectorStoreIndexEndpoints:\n        \"\"\"RAGFlow vector stores are management-only, no search support.\"\"\"\n        return {\n            \"read\": [],\n            \"write\": [],\n        }\n\n    def validate_environment(self, headers: dict, litellm_params: GenericLiteLLMParams | None) -> dict:\n        \"\"\"Validate environment and set headers for RAGFlow API.\"\"\"\n        litellm_params = litellm_params or GenericLiteLLMParams()\n        api_key: Final = litellm_params.api_key or get_secret_str(\"RAGFLOW_API_KEY\")\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/ragflow/vector_stores/transformation.py#L15-L51","documentation":"Credential guard in the RAGFlow vector-store get_auth_credentials: neither litellm_params['api_key'] nor the RAGFLOW_API_KEY secret is set, so the Bearer credential for the RAGFlow datasets API cannot be obtained.","triggerScenarios":"Triggered when calling RAGFlow vector stores without an API key: RAGFLOW_API_KEY env var unset and no api_key in litellm_params.","commonSituations":"See trigger scenarios.","solutions":["Set the RAGFLOW_API_KEY environment variable.","Or pass api_key in litellm_params for the vector store call."],"exampleFix":"os.environ[\"RAGFLOW_API_KEY\"] = \"ragflow-<key>\"","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"}