{"record":{"id":"ff79b95fff5f2536","repo":"BerriAI/litellm","slug":"no-models-configured-on-proxy-ff79b9","errorCode":null,"errorMessage":"No models configured on proxy","messagePattern":"No models configured on proxy","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"litellm/proxy/management_endpoints/customer_endpoints.py","lineNumber":414,"sourceCode":"    - end-user object\n    - currently allowed models \n    \"\"\"\n    from litellm.proxy.proxy_server import (\n        litellm_proxy_admin_name,\n        llm_router,\n        prisma_client,\n    )\n\n    if prisma_client is None:\n        raise HTTPException(\n            status_code=500,\n            detail={\"error\": CommonProxyErrors.db_not_connected_error.value},\n        )\n    try:\n        ## VALIDATION ##\n        if data.default_model is not None:\n            if llm_router is None:\n                raise HTTPException(\n                    status_code=422,\n                    detail={\"error\": CommonProxyErrors.no_llm_router.value},\n                )\n            elif data.default_model not in llm_router.get_model_names():\n                raise HTTPException(\n                    status_code=422,\n                    detail={\n                        \"error\": f\"Default Model not on proxy. Configure via `/model/new` or config.yaml. Default_model={data.default_model}, proxy_model_names={set(llm_router.get_model_names())}\"\n                    },\n                )\n\n        new_end_user_obj: dict[str, object] = {}\n\n        ## CREATE BUDGET ## if set\n        _new_budget: Final = new_budget_request(data)\n        if _new_budget is not None:\n            try:\n                budget_record: Final = await _typed_table(BudgetRepository(prisma_client)).create(","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/customer_endpoints.py#L396-L432","documentation":"When POST /customer/new receives a default_model it must validate it against the router. If llm_router is None - no model_list in config.yaml and nothing added via /model/new - there is nothing to validate against, so the endpoint returns HTTP 422 with CommonProxyErrors.no_llm_router ('No models configured on proxy', litellm/proxy/_types.py:3637).","triggerScenarios":"POST /customer/new with default_model set while the proxy runs with an empty or absent model_list - typically a DB-mode startup before any model was added, or a passthrough/wildcard-only config that never built a router.","commonSituations":"Fresh installs where teams configure customers/keys before models; configs that rely on models being added dynamically at runtime; wildcard-only setups (e.g. openai/*) that skip explicit model_list.","solutions":["Add models first - a model_list block in config.yaml or POST /model/new - then retry the customer create","Or create the customer without default_model and set it later via /customer/update once models exist","Confirm the router is populated via GET /v1/models or /model/info before passing default_model"],"exampleFix":"# before\ncurl -X POST http://localhost:4000/customer/new -d '{\"user_id\": \"u1\", \"default_model\": \"gpt-4o\"}'   # no model_list -> 422\n\n# after\ncurl -X POST http://localhost:4000/model/new -d '{\"model_name\": \"gpt-4o\", \"litellm_params\": {\"model\": \"openai/gpt-4o\"}}'\ncurl -X POST http://localhost:4000/customer/new -d '{\"user_id\": \"u1\", \"default_model\": \"gpt-4o\"}'","handlingStrategy":"validation","validationCode":"import httpx\n\n\ndef router_has_models(base: str, headers: dict) -> bool:\n    data = httpx.get(f\"{base}/v1/models\", headers=headers).json().get(\"data\", [])\n    return len(data) > 0","typeGuard":null,"tryCatchPattern":"try:\n    r = httpx.post(f\"{base}/customer/new\", json=payload, headers=headers)\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 422 and \"No models configured\" in e.response.text:\n        payload.pop(\"default_model\", None)  # create without default, set it later\n        r = httpx.post(f\"{base}/customer/new\", json=payload, headers=headers)\n    raise","preventionTips":["Configure model_list (or add models via /model/new) before onboarding customers that need default models","Order bootstrap scripts: models first, then teams/users/customers","Use GET /v1/models as a readiness probe for the router being usable"],"tags":["litellm","llm-router","model-list","customer-management","validation"],"backgroundTag":"no-models-configured","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}