Back to Blog

Fix: cc-switch Local Proxy Failed on Codex Endpoint — DeepSeek HTTP 400 reasoning_content

2026-08-24·4 min read·CodeRouter Team

TL;DR — This error chain means: your client (via cc-switch's local proxy) called a Codex-style /responses endpoint, the proxy forwarded to DeepSeek with thinking mode enabled plus tool calls, and DeepSeek rejected the follow-up request because the reasoning_content from the previous assistant turn was not sent back. The proxy is stripping (or never storing) the thinking block. Fixes: (1) disable thinking mode for tool-calling sessions through the proxy, (2) switch that route to a non-thinking model variant, or (3) put the traffic through a router that handles reasoning models correctly — either by round-tripping reasoning_content or by running them with thinking off.

Decoding the error chain

Layer Speaks What it does to the request
Your client Codex-style /responses Sends the conversation, including prior tool calls
cc-switch local proxy Translates to chat-completions Drops reasoning_content — the field is not in the target schema
DeepSeek (thinking mode) Its own thinking-mode contract Requires each assistant turn's reasoning_content back → HTTP 400
cc switch local proxy failed while handling codex endpoint /responses.
provider: deepseek; model: deepseek-v4-flash; upstream_status: http 400;
cause: the `reasoning_content` in the thinking mode must be passed back to the api.

Three layers are talking here:

  1. Your client speaks the Codex-style /responses API shape.
  2. cc-switch's local proxy translates that to the provider's chat-completions shape and forwards to DeepSeek.
  3. DeepSeek runs deepseek-v4-flash in thinking mode. When a conversation includes tool calls, DeepSeek's API requires each assistant turn's reasoning_content to be included when you send the conversation back. The proxy layer translated the message history but dropped that field → HTTP 400.

This is the same underlying contract we documented in the reasoning_content 400 fix — the proxy just adds a translation layer where the field gets lost.

Fix 1: Disable thinking mode on the proxied route

If cc-switch (or your client config) lets you set request parameters per provider, turn thinking mode off for coding/tool sessions. Tool-heavy coding loops rarely benefit enough from exposed reasoning to justify the fragile round-trip.

Fix 2: Use a non-thinking model variant

Route the /responses traffic to a model/mode without the round-trip requirement. Within DeepSeek's lineup that means the standard chat variants rather than reasoner/thinking modes — V4 Pro vs Flash trade-offs here.

Fix 3: Put a contract-aware router in the path

Message-history translation is exactly where thin proxies break. CodeRouter applies Fix 1 for you: it sends DeepSeek and GLM requests with thinking mode disabled wherever the model allows it, and keeps deepseek-reasoner out of automatic routing, so tool-calling sessions through it never carry a reasoning_content to lose. (Kimi K2.6 is the exception: its tool-calling requests run with thinking on, and CodeRouter adds an empty reasoning_content to the earlier tool-call turns it can't replay.) It does not store and replay thinking content, so if you specifically need DeepSeek's thinking mode in tool loops, the history has to be fixed on the client side. If you keep cc-switch for client switching, you can still point its upstream at a router endpoint instead of the raw provider.

Pointing Codex at CodeRouter

Added Nov 21, 2026, and current as of that date. Disclosure: CodeRouter is our product.

For Fix 3 with Codex CLI, add CodeRouter as a model provider in ~/.codex/config.toml:

model = "auto"
model_provider = "coderouter"

[model_providers.coderouter]
name = "CodeRouter"
base_url = "https://www.coderouter.io/api/v1"
env_key = "CODEROUTER_API_KEY"
wire_api = "responses"

Then export CODEROUTER_API_KEY=cr_... (your CodeRouter key) and run codex. The details are in the Codex section of our integration docs.

Setup guide · Pricing

Related

Try phase-aware routing on your own workload

One base URL for Claude Code, Cursor or Aider. Free trial, no credit card.

Start free trial

Get weekly AI cost optimization tips

Join developers cutting their agent bills