BerriAI/litellm · error · ValueError
api_key is required (set RAGFLOW_API_KEY env var or pass in
Error message
api_key is required (set RAGFLOW_API_KEY env var or pass in litellm_params)
What it means
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.
Source
Thrown at litellm/llms/ragflow/vector_stores/transformation.py:33
VectorStoreSearchResponse,
)
if TYPE_CHECKING:
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
else:
LiteLLMLoggingObj = Any
class RAGFlowVectorStoreConfig(BaseVectorStoreConfig):
"""Vector store configuration for RAGFlow datasets."""
def get_auth_credentials(self, litellm_params: dict) -> BaseVectorStoreAuthCredentials:
api_key = litellm_params.get("api_key")
if api_key is None:
# Try to get from environment variable
api_key = get_secret_str("RAGFLOW_API_KEY")
if api_key is None:
raise ValueError("api_key is required (set RAGFLOW_API_KEY env var or pass in litellm_params)")
return {
"headers": {
"Authorization": f"Bearer {api_key}",
},
}
def get_vector_store_endpoints_by_type(self) -> VectorStoreIndexEndpoints:
"""RAGFlow vector stores are management-only, no search support."""
return {
"read": [],
"write": [],
}
def validate_environment(self, headers: dict, litellm_params: GenericLiteLLMParams | None) -> dict:
"""Validate environment and set headers for RAGFlow API."""
litellm_params = litellm_params or GenericLiteLLMParams()
api_key: Final = litellm_params.api_key or get_secret_str("RAGFLOW_API_KEY")
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set the RAGFLOW_API_KEY environment variable.
- Or pass api_key in litellm_params for the vector store call.
Example fix
os.environ["RAGFLOW_API_KEY"] = "ragflow-<key>"
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when calling RAGFlow vector stores without an API key: RAGFLOW_API_KEY env var unset and no api_key in litellm_params.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/c3e1fd47def6f3da.
Report an issue: GitHub.