BerriAI/litellm · error · HTTPException

No models configured on proxy

Error message

No models configured on proxy

What it means

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).

Source

Thrown at litellm/proxy/management_endpoints/customer_endpoints.py:414

    - end-user object
    - currently allowed models 
    """
    from litellm.proxy.proxy_server import (
        litellm_proxy_admin_name,
        llm_router,
        prisma_client,
    )

    if prisma_client is None:
        raise HTTPException(
            status_code=500,
            detail={"error": CommonProxyErrors.db_not_connected_error.value},
        )
    try:
        ## VALIDATION ##
        if data.default_model is not None:
            if llm_router is None:
                raise HTTPException(
                    status_code=422,
                    detail={"error": CommonProxyErrors.no_llm_router.value},
                )
            elif data.default_model not in llm_router.get_model_names():
                raise HTTPException(
                    status_code=422,
                    detail={
                        "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())}"
                    },
                )

        new_end_user_obj: dict[str, object] = {}

        ## CREATE BUDGET ## if set
        _new_budget: Final = new_budget_request(data)
        if _new_budget is not None:
            try:
                budget_record: Final = await _typed_table(BudgetRepository(prisma_client)).create(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Add models first - a model_list block in config.yaml or POST /model/new - then retry the customer create
  2. Or create the customer without default_model and set it later via /customer/update once models exist
  3. Confirm the router is populated via GET /v1/models or /model/info before passing default_model

Example fix

# before
curl -X POST http://localhost:4000/customer/new -d '{"user_id": "u1", "default_model": "gpt-4o"}'   # no model_list -> 422

# after
curl -X POST http://localhost:4000/model/new -d '{"model_name": "gpt-4o", "litellm_params": {"model": "openai/gpt-4o"}}'
curl -X POST http://localhost:4000/customer/new -d '{"user_id": "u1", "default_model": "gpt-4o"}'
Defensive patterns

Strategy: validation

Validate before calling

import httpx


def router_has_models(base: str, headers: dict) -> bool:
    data = httpx.get(f"{base}/v1/models", headers=headers).json().get("data", [])
    return len(data) > 0

Try / catch

try:
    r = httpx.post(f"{base}/customer/new", json=payload, headers=headers)
except httpx.HTTPStatusError as e:
    if e.response.status_code == 422 and "No models configured" in e.response.text:
        payload.pop("default_model", None)  # create without default, set it later
        r = httpx.post(f"{base}/customer/new", json=payload, headers=headers)
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ff79b95fff5f2536. Report an issue: GitHub.