BerriAI/litellm · error · ValueError

FIREWORKS_API_KEY is not set. Please set…

Error message

FIREWORKS_API_KEY is not set. Please set 'FIREWORKS_API_KEY' or 'FIREWORKS_AI_API_KEY' in your environment

What it means

Error "FIREWORKS_API_KEY is not set. Please set 'FIREWORKS_API_KEY' or 'FIREWORKS_AI_API_KEY' in your environment" thrown in BerriAI/litellm.

Solutions

  1. Set the FIREWORKS_API_KEY environment variable before making the call, e.g. export FIREWORKS_API_KEY=<your-key>.
  2. Alternatively pass the credential directly via the api_key parameter in the litellm call.
  3. FIREWORKS_AI_API_KEY is also accepted by some code paths.

When it happens

Trigger: Thrown at litellm/llms/fireworks_ai/rerank/transformation.py:108 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/e0a214702674600e. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/fireworks_ai/rerank/transformation.py:108

            # Silently ignore max_chunks_per_doc as Fireworks AI doesn't support it
            pass

        if max_tokens_per_doc is not None:
            # Silently ignore max_tokens_per_doc as Fireworks AI doesn't support it
            pass

        return params

    def validate_environment(
        self,
        headers: dict,
        model: str,
        api_key: str | None = None,
        optional_params: dict | None = None,
    ) -> dict:
        api_key = self._get_api_key(api_key)
        if api_key is None:
            raise ValueError(
                "FIREWORKS_API_KEY is not set. Please set 'FIREWORKS_API_KEY' or 'FIREWORKS_AI_API_KEY' in your environment"
            )

        default_headers: Final = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json",
        }

        # If 'Authorization' is provided in headers, it overrides the default.
        if "Authorization" in headers:
            default_headers["Authorization"] = headers["Authorization"]

        # Merge other headers, overriding any default ones except Authorization
        return {**default_headers, **headers}

    def transform_rerank_request(
        self,
        model: str,

View on GitHub (pinned to 77b7c6c40c)