BerriAI/litellm · error · ValueError

FIREWORKS_ACCOUNT_ID is not set. Please set the environment…

Error message

FIREWORKS_ACCOUNT_ID is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint.

What it means

Error "FIREWORKS_ACCOUNT_ID is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint." thrown in BerriAI/litellm.

Solutions

  1. Set the FIREWORKS_ACCOUNT_ID environment variable to your Fireworks account id.

When it happens

Trigger: Thrown at litellm/llms/fireworks_ai/chat/transformation.py:772 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/e5df121bc8a0ad63. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/fireworks_ai/chat/transformation.py:772

        api_base = api_base or get_secret_str("FIREWORKS_API_BASE") or "https://api.fireworks.ai/inference/v1"
        dynamic_api_key: Final = api_key or (
            get_secret_str("FIREWORKS_API_KEY")
            or get_secret_str("FIREWORKS_AI_API_KEY")
            or get_secret_str("FIREWORKSAI_API_KEY")
            or get_secret_str("FIREWORKS_AI_TOKEN")
        )
        return api_base, dynamic_api_key

    def get_models(self, api_key: str | None = None, api_base: str | None = None):
        api_base, api_key = self._get_openai_compatible_provider_info(api_base=api_base, api_key=api_key)
        if api_base is None or api_key is None:
            raise ValueError(
                "FIREWORKS_API_BASE or FIREWORKS_API_KEY is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint."
            )

        account_id: Final = get_secret_str("FIREWORKS_ACCOUNT_ID")
        if account_id is None:
            raise ValueError(
                "FIREWORKS_ACCOUNT_ID is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint."
            )

        base = api_base.rstrip("/")
        base = base.removesuffix("/v1")
        response: Final = litellm.module_level_client.get(
            url=f"{base}/v1/accounts/{account_id}/models",
            headers={"Authorization": f"Bearer {api_key}"},
        )

        if response.status_code != 200:
            raise ValueError(
                f"Failed to fetch models from Fireworks AI. Status code: {response.status_code}, Response: {response.json()}"
            )

        models: Final = response.json()["models"]

        return ["fireworks_ai/" + model["name"] for model in models]

View on GitHub (pinned to 77b7c6c40c)