Codex sends messages to /v1/responses instead of Responses API input format
Open 💬 4 comments Opened Mar 15, 2026 by henrydiaosi
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
0.114.0 in terminal; VS Code-integrated sessions reported 0.115.0-alpha.11
What subscription do you have?
OpenAI API
Which model were you using?
gpt-5.4
What platform is your computer?
Windows
What terminal emulator and version are you using (if applicable)?
VS Code Codex integration on Windows, with PowerShell / VS Code integrated terminal
What issue are you seeing?
When Codex is configured to use a custom OpenAI-compatible provider at:
http://127.0.0.1:8688/v1
it sends requests to /v1/responses, but the request body appears to use Chat-style messages instead of a valid Responses API input payload.
In the Codex UI, the failure shows up as:
unexpected status 502 Bad Gateway: Unknown error, url: http://127.0.0.1:8688/v1/responses
From the gateway logs, the upstream error is:
OpenAI upstream error 400: {"detail":"Unsupported parameter: messages"}
I also confirmed that this is not a base URL or network issue:
GET /v1/models works with the same provider and API key
POST /v1/responses works when I manually send a valid Responses API payload
the failure only happens when Codex sends the request
### What steps can reproduce the bug?
1. Configure Codex with a custom OpenAI-compatible provider:
```toml
model_provider = "OpenAI"
model = "gpt-5.4"
review_model = "gpt-5.4"
model_reasoning_effort = "low"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_context_window = 1000000
model_auto_compact_token_limit = 900000
[model_providers.OpenAI]
name = "OpenAI"
base_url = "http://127.0.0.1:8688/v1"
requires_openai_auth = true
[windows]
sandbox = "elevated"
2.Start a Codex session in VS Code.
3.Send a simple prompt such as 你好.
4.Observe the Codex UI retry several times and then fail with:unexpected status 502 Bad Gateway: Unknown error, url: http://127.0.0.1:8688/v1/responses
5.Check the gateway logs and observe:OpenAI upstream error 400: {"detail":"Unsupported parameter: messages"}
### What is the expected behavior?
Codex should send a valid Responses API request body to `/v1/responses`.
For example, it should use the proper Responses API `input` structure rather than Chat Completions-style `messages`.
A correctly formatted manual request to the same `/v1/responses` endpoint succeeds, so the custom provider and endpoint are working.
### Additional information
A few extra observations from debugging:
- `base_url = "http://127.0.0.1:8688/openai/v1"` was incorrect in my setup and returned the Sub2API frontend HTML, but after correcting it to `http://127.0.0.1:8688/v1`, Codex still failed.
- With the corrected `/v1` base URL, the problem is no longer routing; it is specifically the payload format sent to `/v1/responses`.
- Manual tests against the same gateway show:
- `GET /v1/models` returns valid JSON
- `POST /v1/responses` succeeds when `input` is a list in Responses API format
- invalid payloads fail with gateway-forwarded upstream errors such as:
- `{"detail":"Input must be a list"}`
- `{"detail":"Unsupported parameter: messages"}`
- This suggests Codex is sending `messages` to a Responses endpoint.
There may also be a version mismatch:
- `codex --version` in terminal reports `0.114.0`
- VS Code-integrated session metadata reported `0.115.0-alpha.11`
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This may be related to #14695, but I do not think it is a duplicate.
In my case, the failure happens before any tool output handling. Codex sends a request to /v1/responses, and the upstream rejects it with: Unsupported parameter: messages
So this issue is about Codex sending Chat-style messages to a Responses endpoint, rather than the function_call_output formatting problem discussed in #14695.
This is most likely a bug in the upstream responses implementation. Codex works fine with many responses implementations. Which tool, product, or service are you using upstream? Have you reported the issue to its maintainers?
We hit the adjacent custom-provider boundary while wiring DeepSeek V4 into Codex 0.128.0: DeepSeek exposes OpenAI-compatible
/chat/completions, while current Codex custom providers want a Responses-shapedwire_api = "responses"endpoint.We published the small local adapter we are using here:
https://github.com/holo-q/deepseek-responses-proxy
Working shape today:
The proxy accepts Codex
/v1/responses, converts to upstream/chat/completions, and converts the response back to Responses output. It also handles the DeepSeek V4reasoning_contentreplay requirement across tool-call turns. We have it working locally with bothdeepseek-v4-proanddeepseek-v4-flashviacodex -p deepseek-v4-pro/codex -p deepseek-v4-flash.One thing we confirmed: use
-p <profile>, not-m <model>, otherwise Codex keeps the default provider and tries to send the non-OpenAI model through the ChatGPT/OpenAI account path.