wandb/openui · error · HTTPException
Invalid model
Error message
Invalid model
What it means
This is the fallback error in OpenUI's chat_completions endpoint: if the requested model name matches none of the known prefixes (openai, groq/, litellm/, ollama, etc.) and is not the 'dummy' generator, the endpoint raises HTTP 404 'Invalid model'. It means the model string could not be routed to any backend.
Source
Thrown at backend/openui/server.py:208
**data,
)
gen = await ollama_stream_generator(response, data)
else:
response: AsyncStream[
ChatCompletionChunk
] = await ollama_openai.chat.completions.create(
**data,
)
def gen():
return openai_stream_generator(response, input_tokens, user_id, 0)
return StreamingResponse(gen(), media_type="text/event-stream")
elif data.get("model").startswith("dummy"):
return StreamingResponse(
DummyStreamGenerator(data), media_type="text/event-stream"
)
raise HTTPException(status=404, detail="Invalid model")
except (ResponseError, APIStatusError) as e:
traceback.print_exc()
logger.exception("Known Error: %s", str(e))
msg = str(e)
if hasattr(e, "message"):
msg = e.message
raise HTTPException(status_code=e.status_code, detail=msg)
@app.exception_handler(RequestValidationError)
@app.exception_handler(ValidationError)
async def validation_exception_handler(
request: Request, exc: RequestValidationError | ValidationError
):
body = hasattr(exc, "body") and exc.body or None
logger.exception("Validation Error: %s", exc)
traceback.print_exc()
return JSONResponse(View on GitHub (pinned to 42d7ab4ab6)
Solutions
- Prefix the model with a supported backend identifier, e.g. 'openai/gpt-4o', 'groq/llama3-70b-8192', or 'litellm/<model>'.
- Check the exact spelling of the prefix against the elif chain in backend/openui/server.py chat_completions.
- If you need an unlisted provider, add a routing branch in chat_completions or run it behind LiteLLM and use the litellm/ prefix.
- Guard the client payload so model is always a non-empty routed string before calling the endpoint.
Example fix
// before
{"model": "llama3-70b-8192"}
// after
{"model": "groq/llama3-70b-8192"} Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_PREFIXES = ("openai/", "groq/", "litellm/", "ollama/", "dummy")
def validate_model(model: str) -> str:
if not model or not model.startswith(SUPPORTED_PREFIXES):
raise ValueError(f"Model '{model}' lacks a supported routing prefix")
return model Type guard
def is_routed_model(model) -> bool:
return isinstance(model, str) and model.startswith(("openai/", "groq/", "litellm/", "ollama/", "dummy")) Prevention
- Always send models with their routing prefix
- Keep a client-side constant of valid prefixes synced with server.py
- Add an integration test hitting /chat/completions per supported prefix
- Return the supported model list to clients instead of hardcoding
When it happens
Trigger: POSTing to /chat/completions with a model value that lacks a recognized prefix (e.g. model='claude-3' with no 'groq/' or 'litellm/' prefix, or a misspelled prefix like 'groc/llama3'), or model missing/None so startswith never matches.
Common situations: Pasting a raw model id from another provider without the required routing prefix, typos in the prefix, upgrading OpenUI and using a model family the installed version doesn't route, or clients sending model=null.
Related errors
- No session found
- Login required to use OpenUI
- You've exceeded our usage quota, come back tomorrow to gener
- Model not supported
- Groq API key is not set.
AI-assisted analysis of wandb/openui@42d7ab4ab6 (2026-09-01).
Data as JSON: /api/errors/1d2d110b301ec1f6.
Report an issue: GitHub.