You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
/v1/completions accepts n and silently returns one choice; /v1/chat/completions refuses n != 1 with 400 #682
I am on the latest release, or on a freshly rebuilt main when building from source.
What happened
CompletionRequest declares n, and /v1/completions answers n=2 (or any n) with HTTP 200 and a single choice. /v1/chat/completions handles the same field by refusing it: 400 "Only n=1 is supported". A client that asks the completions route for several samples (best-of selection, self-consistency, eval harnesses that pass n) silently gets one and has no way to tell. Reproduced 8/8 on main377a3bc (n=2 and n=3, greedy and temperature 1.0, streamed and not); the code is unchanged on 74a3877.
Reproduction
curl -s localhost:1941/v1/completions -H 'Content-Type: application/json' -d '{"model": "gpt-oss-20b", "prompt": "Write one word that rhymes with cat:", "max_tokens": 6, "n": 2, "temperature": 1.0}'# {"id":"cmpl-29c9...","object":"text_completion","created":...,"model":"gpt-oss-20b",# "choices":[{"index":0,"text":" Possibly not provided: \"That","finish_reason":"length","logprobs":null}],# "usage":{"prompt_tokens":9,"completion_tokens":6,"total_tokens":15}} <- one choice, usage of one
curl -s localhost:1941/v1/chat/completions -H 'Content-Type: application/json' -d '{"model": "gpt-oss-20b", "max_tokens": 6, "n": 2, "messages": [{"role": "user", "content": "Write one word that rhymes with cat:"}]}'# {"error":{"message":"Only n=1 is supported","type":"invalid_request_error","param":"n","code":null}}
Activity