Skip to content

HTTP 400 Invalid JSON /responses - CC Switch

Quick fix

Change meta.apiFormat of the Codex provider to openai_responses so requests are forwarded straight through.

Error output
Expecting ',' delimiter: line 1 column 87 (char 86)

With ChatGPT Powered by Codex & OWL version 26.715.72359, CC Switch sets meta.apiFormat for that provider (agnes) to "openai_chat" by default. CC Switch then tries to convert the /responses request the client sends into /chat/completions format. Serializing a multi-turn conversation request containing instructions, tools, tool_choice, reasoning, and message input, the converter produces syntactically illegal JSON. The upstream service (agnes) cannot parse it and returns HTTP 400.

Because of the same conversion logic, you may also see related 400 errors such as "No user query found in messages" or "Input items must contain at least one message", and ID format mismatch errors (Expected an ID that begins with 'rs'). All of them come down to the same root cause: a failed request conversion from an API format mismatch.

  1. Open the cc-switch config file and find the codex provider configuration currently in use.

  2. Change the meta.apiFormat field of that provider from "openai_chat" to "openai_responses". CC Switch then stops converting the format and passes the /responses request straight through to the upstream.

ToolCodex
Version3.17.0 - 3.18.0
PlatformsmacOSWindows
Why does it still error in a newly opened conversation window?
The problem is not caused by cached conversation history but by a defect in the API format conversion itself. New conversation or not, as long as meta.apiFormat is "openai_chat", the complex fields in a multi-turn request are serialized into illegal JSON. Follow the fix steps to change apiFormat.
Besides the JSON syntax error, I also see "No user query found in messages". Is that the same problem?
Yes. When CC Switch wrongly converts the /responses structure into a /chat/completions structure, it may fail to extract or map the user message field, so the upstream concludes there is no user query. Changing apiFormat to "openai_responses" resolves all of these 400 errors.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.