wandb/openui · error · HTTPException

Model not supported

Error message

Model not supported

What it means

chat_completions supports gpt-3.5* and gpt-4-vision style models but explicitly rejects gpt-4 and gpt-4-32k with HTTPException(status=400, data='Model not supported'). Note the bug: HTTPException's keyword is `detail`, not `data`, and `status` should be `status_code`, so this raises a malformed HTTPException/TypeError at runtime rather than a clean 400.

Source

Thrown at backend/openui/server.py:136

        raise HTTPException(status_code=401, detail="Login required to use OpenUI")
    user_id = request.session["user_id"]
    yesterday = datetime.now() - timedelta(days=1)
    tokens = Usage.tokens_since(user_id, yesterday.date())
    if config.ENV == config.Env.PROD and tokens > config.MAX_TOKENS:
        raise HTTPException(
            status_code=429,
            detail="You've exceeded our usage quota, come back tomorrow to generate more UI.",
        )
    try:
        data = await request.json()  # chat_request.model_dump(exclude_unset=True)
        input_tokens = count_tokens(data["messages"])
        # TODO: we always assume 4096 max tokens (random fudge factor here)
        data["max_tokens"] = 4096 - input_tokens - 20
        # TODO: refactor all these blocks into one once Ollama supports vision
        # OpenAI Models
        if data.get("model").startswith("gpt"):
            if data["model"] == "gpt-4" or data["model"] == "gpt-4-32k":
                raise HTTPException(status=400, data="Model not supported")
            response: AsyncStream[
                ChatCompletionChunk
            ] = await openai.chat.completions.create(
                **data,
            )
            # gpt-4 tokens are 20x more expensive
            multiplier = 20 if "gpt-4" in data["model"] else 1
            return StreamingResponse(
                openai_stream_generator(response, input_tokens, user_id, multiplier),
                media_type="text/event-stream",
            )
        # Groq Models
        elif data.get("model").startswith("groq/"):
            data["model"] = data["model"].replace("groq/", "")
            if groq is None:
                raise HTTPException(status=500, detail="Groq API key is not set.")
            response: AsyncStream[
                ChatCompletionChunk

View on GitHub (pinned to 42d7ab4ab6)

Solutions

  1. Use a supported model such as 'gpt-3.5-turbo' or a gpt-4 vision-capable variant the server accepts.
  2. Fix the backend call to HTTPException(status_code=400, detail='Model not supported').
  3. Add client-side model validation against the server's supported list before sending.
  4. Update the OpenUI deployment/config so newer model names are handled.

Example fix

// before
raise HTTPException(status=400, data="Model not supported")
// after
raise HTTPException(status_code=400, detail="Model not supported")
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {'gpt-3.5-turbo'}  # plus vision-capable variants the server accepts
if data['model'] in {'gpt-4', 'gpt-4-32k'}:
    raise ValueError(f'Model {data["model"]!r} not supported by OpenUI')

Try / catch

try:
    r = s.post(url, json=payload)
    r.raise_for_status()
except requests.HTTPError as e:
    if e.response.status_code == 400 and 'not supported' in e.response.text.lower():
        payload['model'] = 'gpt-3.5-turbo'
        r = s.post(url, json=payload)

Prevention

When it happens

Trigger: Requesting chat completions with data['model'] == 'gpt-4' or 'gpt-4-32k' — the server intentionally refuses these models (pricing/vision support reasons).

Common situations: Client defaults to 'gpt-4' in their OpenAI SDK config; older tutorials/examples use gpt-4; model list not filtered before sending.

Related errors


AI-assisted analysis of wandb/openui@42d7ab4ab6 (2026-09-01). Data as JSON: /api/errors/c1589b9ee44dfb23. Report an issue: GitHub.