fix(codex): drop user parameter — ChatGPT backend rejects it - #22
Open
cheapsteak wants to merge 1 commit into
Open
fix(codex): drop user parameter — ChatGPT backend rejects it#22cheapsteak wants to merge 1 commit into
user parameter — ChatGPT backend rejects it#22cheapsteak wants to merge 1 commit into
Conversation
The ChatGPT Codex backend (consumed via the Anthropic → Responses
translator) rejects requests that include a top-level `user` field with:
HTTP 400 {"detail":"Unsupported parameter: user"}
Claude Code (and any Anthropic-protocol client that populates
`metadata.user_id`) hits this on every request, making the codex
provider unusable from Claude Code.
Drop the `metadata.user_id` → `user` forward in
`anthropicToResponsesRequest`. A comment is left in its place so the
constraint isn't accidentally re-added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
When a request is routed through the codex provider (
anthropicToResponsesRequest→ ChatGPT/responsesbackend), the backend rejects any request that includes a top-leveluserfield:Claude Code (and presumably any Anthropic-protocol client that populates
metadata.user_id, which is part of the public Anthropic Messages API) sendsmetadata.user_idon every/v1/messagesrequest, so the codex provider is effectively unusable from Claude Code today — every turn fails.Where
src/upstream/responses-translator.ts:313, insideanthropicToResponsesRequest:The translator's only consumer is the codex path in
src/handlers/anthropic.ts(proxyCodexMessages, gated onprovider.id === "codex"), so the offending forward fires for every Anthropic-protocol request that targets a codex-served model.Reproduction
With a configured codex account, from any Anthropic-protocol client (or curl):
Upstream response body:
Remove
metadata.user_idfrom the same request and it succeeds.Fix
Drop the unconditional
metadata.user_id→userforward inanthropicToResponsesRequest. Since that translator is codex-only (the only call site isproxyCodexMessages), an unconditional removal is the simplest correct change; this PR takes that route and leaves an inline NOTE comment explaining the constraint so it isn't accidentally re-added.If
anthropicToResponsesRequestever gains a non-codex consumer, the forward can be gated by provider id at the handler layer instead.Likely related (not verified)
src/upstream/responses-translator.ts:184, insidechatToResponsesRequest:This is the Chat-Completions → Responses path. If that translator is ever routed to the codex backend with a client that sends a top-level
user, the same 400 should occur. I have not reproduced this from Claude Code (Claude Code uses the Anthropic path), so I'm flagging it as a separate observation rather than fixing it here.