{"record":{"id":"8556b3e815a6df55","repo":"BerriAI/litellm","slug":"llm-router-not-found-please-set-it-up-by-passing","errorCode":null,"errorMessage":"LLM router not found. Please set it up by passing in a valid config.yaml or adding models via the UI.","messagePattern":"LLM router not found\\. Please set it up by passing in a valid config\\.yaml or adding models via the UI\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":2317,"sourceCode":"    if update_key_request.team_id is not None:\n        team_obj = await get_team_object(\n            team_id=update_key_request.team_id,\n            prisma_client=prisma_client,\n            user_api_key_cache=user_api_key_cache,\n            check_db_only=True,\n        )\n\n        if team_obj is not None and prisma_client is not None:\n            await _check_team_key_limits(\n                team_table=team_obj,\n                data=update_key_request,\n                prisma_client=prisma_client,\n            )\n\n    # Validate team change if team is being changed\n    if is_different_team(data=update_key_request, existing_key_row=existing_key_row):\n        if llm_router is None:\n            raise HTTPException(\n                status_code=400,\n                detail={\n                    \"error\": \"LLM router not found. Please set it up by passing in a valid config.yaml or adding models via the UI.\"\n                },\n            )\n        if team_obj is None:\n            raise HTTPException(\n                status_code=500,\n                detail={\"error\": \"Team object not found for team change validation\"},\n            )\n        await validate_key_team_change(\n            key=existing_key_row,\n            team=team_obj,\n            change_initiated_by=user_api_key_dict,\n            llm_router=llm_router,\n        )\n\n    # Prepare update data","sourceCodeStart":2299,"sourceCodeEnd":2335,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L2299-L2335","documentation":"Changing a key's team via /key/update triggers validate_key_team_change, which checks the key's models/budget against the new team and therefore needs the model router. If the proxy was started without any models configured (llm_router is None), that validation cannot run and LiteLLM refuses the team change with HTTP 400 telling you to set up a valid config.yaml or add models via the UI. Team changes are the specific operation affected -- other updates work without a router.","triggerScenarios":"POST /key/update changing team_id on a proxy running in DB-only/auth-only mode (no model_list in config and no models added); models were expected from the DB (store_model_in_db) but that feature isn't enabled/loaded; config.yaml model_list is empty or malformed so the router never initialized; UI/Config removed all models earlier.","commonSituations":"Using LiteLLM purely as a virtual-key/spend gateway in front of another router; splitting model config from key management into different instances and sending key updates to the wrong one; misconfigured store_model_in_db where models exist in DB but this proxy wasn't started with the flag.","solutions":["Start the proxy with a config.yaml containing model_list (at least one deployment), or add models via the UI/POST /model/new","If models live in the DB, ensure store_model_in_db: true so the router initializes from the DB","Point the team-change request at a proxy instance that has the router loaded","If the team change isn't required, drop team_id from the update payload to avoid validation entirely"],"exampleFix":"# config.yaml (before)\ngeneral_settings:\n  database_url: postgresql://...\n# no model_list / no models\n\n# after\nmodel_list:\n  - model_name: gpt-4o\n    litellm_params:\n      model: openai/gpt-4o\ngeneral_settings:\n  database_url: postgresql://...\n  store_model_in_db: true","handlingStrategy":"validation","validationCode":"models = await client.get(\"/v1/models\")\nif not models.json().get(\"data\"):\n    raise RuntimeError(\"proxy has no models configured; team-change validation requires llm_router\")\n# only then attempt the team_id change","typeGuard":null,"tryCatchPattern":"try:\n    r = await client.post(\"/key/update\", json=payload)\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 400 and \"LLM router not found\" in e.response.text:\n        raise RuntimeError(\"configure model_list (or store_model_in_db) on the proxy, restart, then retry\") from e\n    raise","preventionTips":["Give every proxy instance that serves key management a non-empty model_list or store_model_in_db","Probe GET /v1/models during deployment to catch router-less instances","Route team-change operations to fully-configured proxies; plain field updates don't need the router"],"tags":["litellm","proxy","router","configuration","teams","key-update"],"backgroundTag":"missing-model-config","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}