BerriAI/litellm · error · ValueError

FAL_AI_API_KEY is not set

Error message

FAL_AI_API_KEY is not set

What it means

Error "FAL_AI_API_KEY is not set" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/fal_ai/image_generation/transformation.py:65

        complete_url = complete_url.rstrip("/")
        if self.IMAGE_GENERATION_ENDPOINT:
            complete_url = f"{complete_url}/{self.IMAGE_GENERATION_ENDPOINT}"
        return complete_url

    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,
    ) -> dict:
        final_api_key: Final[str | None] = api_key or get_secret_str("FAL_AI_API_KEY")
        if not final_api_key:
            raise ValueError("FAL_AI_API_KEY is not set")

        headers["Authorization"] = f"Key {final_api_key}"
        return headers

    def transform_image_generation_response(
        self,
        model: str,
        raw_response: httpx.Response,
        model_response: ImageResponse,
        logging_obj: LiteLLMLoggingObj,
        request_data: dict,
        optional_params: dict,
        litellm_params: dict,
        encoding: Any,
        api_key: str | None = None,
        json_mode: bool | None = None,
    ) -> ImageResponse:
        """

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set FAL_AI_API_KEY in the environment.

When it happens

Trigger: Thrown at litellm/llms/fal_ai/image_generation/transformation.py:65 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/300394c5df022dcf. Report an issue: GitHub.