BerriAI/litellm · error · HTTPException
Default Model not on proxy. Configure via `/model/new` or co
Error message
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())} What it means
POST /customer/new rejects a default_model that is not among the router's model names (model_name entries in config.yaml model_list or models added via /model/new). The 422 detail echoes the requested default_model and the full proxy_model_names set, so the exact alias to use is visible in the error itself.
Source
Thrown at litellm/proxy/management_endpoints/customer_endpoints.py:419
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(
data={
**_new_budget.model_dump(exclude_unset=True),
"created_by": user_api_key_dict.user_id or litellm_proxy_admin_name,
"updated_by": user_api_key_dict.user_id or litellm_proxy_admin_name,
}View on GitHub (pinned to 77b7c6c40c)
Solutions
- Use an alias from the error's proxy_model_names set exactly as printed
- Or add the model under the expected name: POST /model/new with model_name equal to the desired default_model
- After creation, /customer/update can repoint default_model to an existing alias
Example fix
# before
curl -X POST http://localhost:4000/customer/new -d '{"user_id": "u1", "default_model": "gpt-4o"}' # proxy only knows "openai/gpt-4o" -> 422
# after
curl -X POST http://localhost:4000/customer/new -d '{"user_id": "u1", "default_model": "openai/gpt-4o"}' Defensive patterns
Strategy: validation
Validate before calling
import httpx
def model_exists(base: str, headers: dict, model: str) -> bool:
data = httpx.get(f"{base}/v1/models", headers=headers).json()["data"]
return model in {m["id"] for m in data}
assert model_exists(BASE, HDR, payload["default_model"]) or "default_model" not in payload 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 "Default Model not on proxy" in e.response.text:
# the detail lists valid proxy_model_names - pick one and retry
raise ValueError(f"default_model invalid; pick from /v1/models") from e
raise Prevention
- Derive default_model from GET /v1/models output instead of hardcoding provider ids
- Keep model aliases consistent across environments via shared config or CI checks
- When removing a model from config, grep customer/team configs for references first
When it happens
Trigger: Passing default_model "gpt-4o" when the proxy exposes it as "openai/gpt-4o" or an Azure deployment alias; typos; referencing a model that was removed from config while customer templates still name it.
Common situations: Teams migrating from the raw OpenAI SDK where provider ids worked directly; alias naming drift between environments (dev names openai/gpt-4o, prod names gpt4o-prod); retired deployments still referenced by onboarding scripts.
Related errors
- No models configured on proxy
- user_id is required, passed user_id = {data.user_id}
- user_id is required, passed user_id = {data.user_ids}
- max_budget cannot be negative. Received: {data.max_budget}
- soft_budget cannot be negative. Received: {data.soft_budget}
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/802c6ee2405e7beb.
Report an issue: GitHub.