Skip to content

fix(serve): accept chat completions without a model field - #3

Open
tmark00 wants to merge 1 commit into
cometkim:cometkim/devfrom
tmark00:fix/webui-model-optional
Open

tmark00 wants to merge 1 commit into
cometkim:cometkim/devfrom
tmark00:fix/webui-model-optional

Conversation

@tmark00

@tmark00 tmark00 commented Sep 17, 2026

Copy link
Copy Markdown

The bundled llama.cpp webui never sends model on /v1/chat/completions — it treats the server as single-model and takes the display name from /props. The parser rejects that with

400 {"error":{"message":"missing required field: model","param":"model","type":"invalid_request_error"}}

so every message typed into the UI served by --webui fails. It is not a stale-cache or webui-version problem: I reproduced it on both published bucket versions (1789559630374 and 1789652224694), in two browsers, and with --model-id set to the id the UI had listed from /v1/models.

This PR makes an absent model leave the field empty; handle_chat_completions fills in public_model_id_ before validate_openai_model. Unchanged: a model that is present but does not match is still rejected, "model": "" and a non-string model still fail, and the Anthropic and Responses paths are untouched.

Verified on Windows 11 x64, RTX 5090 Laptop, against the QUASAR v3 artifact:

  • webui at /: message sent, answer rendered, POST /v1/chat/completions returns 200 instead of 400;
  • curl without the field returns "model":"qwen3.8-27b" in the response body;
  • curl with a wrong model still returns model_not_found.

Builds on cometkim/dev @ 024f6a94. Independent of #2 (the Windows --webui download fix), though on Windows you need both before the UI can be reached at all.

🤖 Generated with Claude Code

The bundled llama.cpp webui never sends `model` on /v1/chat/completions - it
treats the server as single-model and takes the name from /props. The parser
rejected that with 400 "missing required field: model", so every message typed
into the UI served by --webui failed, whatever --model-id the server ran with.

An absent model now leaves the field empty and the handler fills in the loaded
artifact's public id before validation. A model that is present but does not
match is still rejected, and `"model": ""` still fails as before.

Verified on Windows 11 + RTX 5090 Laptop against the QUASAR v3 artifact: the
webui at / now answers, and a curl POST without the field returns
model=qwen3.8-27b.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant