BerriAI/litellm · error · ValueError

GradientAI API key not found

Error message

GradientAI API key not found

What it means

Error "GradientAI API key not found" thrown in BerriAI/litellm.

Solutions

  1. Set the GRADIENT_AI_API_KEY (or pass api_key) for GradientAI; check litellm docs for the exact variable name for this provider.

When it happens

Trigger: Thrown at litellm/llms/gradient_ai/chat/transformation.py:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at litellm/llms/gradient_ai/chat/transformation.py:90

            "include_guardrails_info",
            "provide_citations",
            "retrieval_method",
        ]
        return supported_params

    def validate_environment(
        self,
        headers: dict,
        model: str,
        messages: list[AllMessageValues],
        optional_params: dict,
        litellm_params: dict,
        api_key: str | None = None,
        api_base: str | None = None,
    ):
        api_key = api_key or get_secret_str("GRADIENT_AI_API_KEY")
        if api_key is None:
            raise ValueError("GradientAI API key not found")
        if headers is None:
            headers = {}
        headers["Authorization"] = f"Bearer {api_key}"
        headers["Content-Type"] = "application/json"
        return headers

    def get_complete_url(
        self,
        api_base: str | None,
        api_key: str | None,
        model: str,
        optional_params: dict,
        litellm_params: dict,
        stream: bool | None = None,
    ) -> str:
        gradient_ai_endpoint: Final = get_secret_str("GRADIENT_AI_AGENT_ENDPOINT")
        complete_url = f"{GRADIENT_AI_SERVERLESS_ENDPOINT}/v1/chat/completions"

View on GitHub (pinned to 77b7c6c40c)