BerriAI/litellm · error · ValueError

RAGFLOW_API_KEY is required (set env var or pass in litellm_

Error message

RAGFLOW_API_KEY is required (set env var or pass in litellm_params)

What it means

Credential guard in the RAGFlow vector-store validate_environment: the API key resolution (params and env) failed at validation time, so request headers would carry no Authorization and the call is rejected upfront.

Source

Thrown at litellm/llms/ragflow/vector_stores/transformation.py:53

            "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")

        if api_key is None:
            raise ValueError("RAGFLOW_API_KEY is required (set env var or pass in litellm_params)")

        headers.update(
            {
                "Authorization": f"Bearer {api_key}",
                "Content-Type": "application/json",
            }
        )
        return headers

    def get_complete_url(
        self,
        api_base: str | None,
        litellm_params: dict,
    ) -> str:
        """
        Get the complete URL for RAGFlow datasets API.

        Supports:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set the RAGFLOW_API_KEY environment variable.
  2. Or pass api_key in litellm_params.

Example fix

litellm.vector_stores.create(..., 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 key in litellm_params.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/d6a07d74eee62029. Report an issue: GitHub.