{"record":{"id":"e5df121bc8a0ad63","repo":"BerriAI/litellm","slug":"fireworks-account-id-is-not-set-please-set-the-en","errorCode":null,"errorMessage":"FIREWORKS_ACCOUNT_ID is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint.","messagePattern":"FIREWORKS_ACCOUNT_ID is not set\\. Please set the environment variable, to query Fireworks AI's `/models` endpoint\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/fireworks_ai/chat/transformation.py","lineNumber":770,"sourceCode":"        api_base = api_base or get_secret_str(\"FIREWORKS_API_BASE\") or \"https://api.fireworks.ai/inference/v1\"\n        dynamic_api_key: Final = api_key or (\n            get_secret_str(\"FIREWORKS_API_KEY\")\n            or get_secret_str(\"FIREWORKS_AI_API_KEY\")\n            or get_secret_str(\"FIREWORKSAI_API_KEY\")\n            or get_secret_str(\"FIREWORKS_AI_TOKEN\")\n        )\n        return api_base, dynamic_api_key\n\n    def get_models(self, api_key: str | None = None, api_base: str | None = None):\n        api_base, api_key = self._get_openai_compatible_provider_info(api_base=api_base, api_key=api_key)\n        if api_base is None or api_key is None:\n            raise ValueError(\n                \"FIREWORKS_API_BASE or FIREWORKS_API_KEY is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint.\"\n            )\n\n        account_id: Final = get_secret_str(\"FIREWORKS_ACCOUNT_ID\")\n        if account_id is None:\n            raise ValueError(\n                \"FIREWORKS_ACCOUNT_ID is not set. Please set the environment variable, to query Fireworks AI's `/models` endpoint.\"\n            )\n\n        base = api_base.rstrip(\"/\")\n        base = base.removesuffix(\"/v1\")\n        response: Final = litellm.module_level_client.get(\n            url=f\"{base}/v1/accounts/{account_id}/models\",\n            headers={\"Authorization\": f\"Bearer {api_key}\"},\n        )\n\n        if response.status_code != 200:\n            raise ValueError(\n                f\"Failed to fetch models from Fireworks AI. Status code: {response.status_code}, Response: {response.json()}\"\n            )\n\n        models: Final = response.json()[\"models\"]\n\n        return [\"fireworks_ai/\" + model[\"name\"] for model in models]","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/fireworks_ai/chat/transformation.py#L752-L788","documentation":"FireworksAIConfig.get_models() lists models via Fireworks AI's account-scoped endpoint /v1/accounts/{account_id}/models. Before issuing the request it resolves FIREWORKS_ACCOUNT_ID from the environment/secrets; if that variable is absent it raises this ValueError. Unlike the OpenAI-compatible /models route, Firewalls requires an explicit account id to scope the query.","triggerScenarios":"Calling litellm.get_model_list('fireworks_ai') (or any path into FireworksAIConfig.get_models) while FIREWORKS_API_KEY/FIREWORKS_API_BASE are set but FIREWORKS_ACCOUNT_ID is not exported in the environment.","commonSituations":"CI jobs, Docker containers, or proxy deployments where only FIREWORKS_API_KEY was configured; using a Fireworks key from a workspace where the account id was never exported because chat/rerank calls work fine without it.","solutions":["Export FIREWORKS_ACCOUNT_ID (the numeric account id from the Fireworks console URL, e.g. 1234567890) in the environment where litellm runs.","If set via a secret manager or .env, confirm the variable name spelling and that the file is actually loaded before litellm is imported/used.","As a workaround, call the OpenAI-compatible models endpoint instead (GET {FIREWORKS_API_BASE}/models with the Bearer key) which does not need the account id."],"exampleFix":"# before\nexport FIREWORKS_API_KEY=fw_...\npython -c \"import litellm; litellm.get_model_list('fireworks_ai')\"  # ValueError\n\n# after\nexport FIREWORKS_API_KEY=fw_...\nexport FIREWORKS_ACCOUNT_ID=1234567890\npython -c \"import litellm; litellm.get_model_list('fireworks_ai')\"","handlingStrategy":"validation","validationCode":"import os\n\ndef can_list_fireworks_models() -> bool:\n    return all([\n        bool(os.getenv(\"FIREWORKS_API_KEY\")),\n        bool(os.getenv(\"FIREWORKS_API_BASE\") or True),  # defaults internally\n        bool(os.getenv(\"FIREWORKS_ACCOUNT_ID\")),\n    ])\n\nif not can_list_fireworks_models():\n    print(\"FIREWORKS_ACCOUNT_ID (and FIREWORKS_API_KEY) must be set before listing models\")","typeGuard":null,"tryCatchPattern":"try:\n    models = litellm.get_model_list(\"fireworks_ai\")\nexcept ValueError as e:\n    if \"FIREWORKS_ACCOUNT_ID\" in str(e):\n        os.environ[\"FIREWORKS_ACCOUNT_ID\"] = load_account_id_from_vault()\n        models = litellm.get_model_list(\"fireworks_ai\")\n    else:\n        raise","preventionTips":["Centralize Fireworks env setup (key + account id) in one bootstrap function run at app start.","Add a startup readiness check that asserts all required Fireworks env vars are non-empty before serving traffic.","Document that model listing needs FIREWORKS_ACCOUNT_ID even though chat does not."],"tags":["fireworks-ai","configuration","environment-variables","model-listing"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}