BerriAI/litellm · error · ValueError

Failed to fetch models from Fireworks AI. Status code

Error message

Failed to fetch models from Fireworks AI. Status code: {response.status_code}, Response: {response.json()}

What it means

Error "Failed to fetch models from Fireworks AI. Status code: {response.status_code}, Response: {response.json()}" thrown in BerriAI/litellm.

Solutions

  1. Read the status code and response body in the error; the /models request was rejected.
  2. Verify FIREWORKS_API_KEY and FIREWORKS_ACCOUNT_ID are correct and the account is active.

When it happens

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

Appendix: source

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

            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]

    @staticmethod
    def get_api_key(api_key: str | None = None) -> str | None:
        return 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")
        )


class FireworksAIChatCompletionStreamingHandler(OpenAIChatCompletionStreamingHandler):

View on GitHub (pinned to 77b7c6c40c)