Codex sends messages to /v1/responses instead of Responses API input format

Open 💬 4 comments Opened Mar 15, 2026 by henrydiaosi

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`

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗