codex - 💡(How to fix) Fix Bug: 400 Bad Request "invalid_request_error" when using gpt-5.4/gpt-5.3-codex models [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20976Fetched 2026-05-05 05:55:09
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×5closed ×1commented ×1

Error Message

Whenever I select the models gpt-5.4 or gpt-5.3-codex via a custom API gateway (Piramyd), the first message sent returns a 400 Bad Request error. The system seems to fail during the tool/function calling initialization. Error Message: "error": { The CLI initiates a tool call, and the API returns the 400 error immediately after the first tool execution.

RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

OpenAI Codex (v0.128.0)

What subscription do you have?

OPENAI COMPATIBLE API KEY

Which model were you using?

gpt-5.4, gpt-5.3-codex

What platform is your computer?

"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })" Microsoft Windows NT 10.0.26200.0 x64

What terminal emulator and version are you using (if applicable)?

Powershell 5.1.26100.8115 and 7+

What issue are you seeing?

Whenever I select the models gpt-5.4 or gpt-5.3-codex via a custom API gateway (Piramyd), the first message sent returns a 400 Bad Request error. The system seems to fail during the tool/function calling initialization.

Error Message:

JSON { "error": { "message": "Bad request. Please check the parameters sent.", "type": "invalid_request_error", "code": "invalid_request" } } Context & Logs: The CLI (v0.128.0) attempts to run initial discovery commands (like git status or ls) and fails to sync the call_id with the provider.

Provider: Custom OpenAI-compatible API (Piramyd)

Environment: Windows PowerShell / VS Code

Permissions: YOLO mode enabled

Steps to Reproduce:

Run codex chat (or claude-piramyd).

Select model gpt-5.4 or gpt-5.3-codex.

Send any prompt (e.g., "Hello").

The CLI initiates a tool call, and the API returns the 400 error immediately after the first tool execution.

What steps can reproduce the bug?

Uploaded thread: 019df262-3727-7431-9381-cdb448d61328

What is the expected behavior?

The CLI should correctly format the tool_outputs or function_call parameters to match the expected schema of the API gateway, or allow disabling automatic tool discovery to prevent parameter mismatch.

Additional information

No response

extent analysis

TL;DR

The issue can likely be resolved by adjusting the parameters sent to the custom API gateway to match the expected schema, potentially by disabling automatic tool discovery.

Guidance

  • Verify the parameters being sent to the API gateway during the initial tool/function calling initialization to identify any mismatches with the expected schema.
  • Check the documentation of the custom API gateway (Piramyd) to understand the required format for tool_outputs or function_call parameters.
  • Consider disabling automatic tool discovery if possible, to prevent parameter mismatch and see if the issue persists.
  • Review the logs and error messages for any specific clues about which parameters are causing the "invalid_request_error".

Example

No specific code snippet can be provided without more details on the API gateway's expected schema, but ensuring the parameters match the expected format is key.

Notes

The solution may depend on the specifics of the custom API gateway (Piramyd) and its requirements, which are not fully detailed in the issue.

Recommendation

Apply workaround: Adjust the parameters to match the expected schema or disable automatic tool discovery if the API gateway supports it, as this directly addresses the "invalid_request_error" and allows for a targeted fix without waiting for potential updates.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Bug: 400 Bad Request "invalid_request_error" when using gpt-5.4/gpt-5.3-codex models [1 comments, 2 participants]