fix(codex-openai-proxy): strip unsupported user param

LibreChat injects a `user` field into the request body, but the Codex
backend 400s with "Unsupported parameter: user". Drop it in
shape_responses_body alongside the sampling params gpt-5 reasoning
models already reject.

Assisted-by: pi (claude-opus-4-8)
This commit is contained in:
Gabriel Fontes
2026-06-29 00:03:11 -03:00
parent fe0a656ae0
commit 4949b15971
@@ -145,9 +145,10 @@ def shape_responses_body(body: dict) -> dict:
include = set(body.get("include") or [])
include.add("reasoning.encrypted_content")
body["include"] = sorted(include)
# Sampling params gpt-5 reasoning models reject.
# Params the Codex backend rejects: sampling knobs gpt-5 reasoning models
# don't take, plus `user`, which LibreChat injects but the backend 400s on.
for bad in ("temperature", "top_p", "max_tokens", "frequency_penalty",
"presence_penalty"):
"presence_penalty", "user"):
body.pop(bad, None)
return body